You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Vibhor_Sharma <vs...@gryphonnetworks.com> on 2007/05/16 15:08:35 UTC

Stax and Axis2

Hi 
    Few conceptual question 
 
why did we use the STAX in Axis2 and why is it so important to use it ? why was'nt SAX used?
 
Why only woodstox STAX used why not some other implementation?
 
Is it possible to plugin any other event based parser in Axis2?  or it relies on woodstox and for that matter STAX only?
 
 
Thanks
Vibhor
 
 

Re: Stax and Axis2

Posted by Michele Mazzucco <Mi...@ncl.ac.uk>.
On Wed, 2007-05-16 at 09:08 -0400, Vibhor_Sharma wrote:
> Hi 
>     Few conceptual question 
>  
> why did we use the STAX in Axis2 and why is it so important to use
> it ? why was'nt SAX used?

They have a completely different approach, push (SAX) vs.pull (StAX)
(see [1,2] for example).
>  
> Why only woodstox STAX used why not some other implementation?

I guess it's because you have to choose one ;)
>  
> Is it possible to plugin any other event based parser in Axis2?  or it
> relies on woodstox and for that matter STAX only?
>  
I think AXIOM relies on woodstox

>  
> Thanks
> Vibhor
>  
>  

Michele


[1] http://java.sun.com/webservices/docs/1.6/tutorial/doc/SJSXP2.html
[2] http://www.devx.com/Java/Article/30298?trk=DXRSS_LATEST


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


RE: Stax and Axis2

Posted by Vibhor_Sharma <vs...@gryphonnetworks.com>.
Thanks to every body 
it helped
 
Vibhor

________________________________

From: Eran Chinthaka [mailto:chinthaka@opensource.lk]
Sent: Thu 5/17/2007 12:44 AM
To: axis-user@ws.apache.org
Subject: Re: Stax and Axis2



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Vibhor_Sharma wrote:
> Hi
>     Few conceptual question
> 
> why did we use the STAX in Axis2

There are couple of reasons behind we using StAX instead of SAX or DOM.
If you look at why StAX is better compared to SAX or DOM, you will get
first few reasons. In addition to that we wanted to have deferred
building capability for Axiom. Meaning, sometime you do not need to
build the whole XML tree within Axis2 to access required information.
Only StAX provides the controlled parsing approach. When you start
parsing XML with SAX or DOM they will not stop until you finish reading
the whole XML.

> and why is it so important to use it ?

I hope the above answered this as well.

> why was'nt SAX used?

Please see a tutorial on StAX.

> 
> Why only woodstox STAX used why not some other implementation?

We initially used BEA implementation and it sometimes had problems.
Woodstox seemed to better in-terms of performance and implementation.
Tatu, who mainly maintains woodstox helps to improve woodstox a lot.

> 
> Is it possible to plugin any other event based parser in Axis2?  or it
> relies on woodstox and for that matter STAX only?

You can plugin any StAX implementation. But some implementations *might*
have some bugs in them. If you want to switch implementations it is just
a matter of putting the required implementation in the classpath.


BTW, interesting set of questions from you, which I didn't hear from
anyone in this list. Thanks for motivating us to re-think about our
initial strategies and I think they still hold even now :)

Chinthaka
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org <http://enigmail.mozdev.org/> 

iD8DBQFGS929jON2uBzUhh8RAipxAJ4lqpsGqwVP3wLdTc3pRP/j+GxzTACdEE8a
ywHXUJfH+E2mxkaVUObB4Iw=
=09gd
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org




Re: Stax and Axis2

Posted by Eran Chinthaka <ch...@opensource.lk>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Vibhor_Sharma wrote:
> Hi
>     Few conceptual question
>  
> why did we use the STAX in Axis2

There are couple of reasons behind we using StAX instead of SAX or DOM.
If you look at why StAX is better compared to SAX or DOM, you will get
first few reasons. In addition to that we wanted to have deferred
building capability for Axiom. Meaning, sometime you do not need to
build the whole XML tree within Axis2 to access required information.
Only StAX provides the controlled parsing approach. When you start
parsing XML with SAX or DOM they will not stop until you finish reading
the whole XML.

> and why is it so important to use it ?

I hope the above answered this as well.

> why was'nt SAX used?

Please see a tutorial on StAX.

>  
> Why only woodstox STAX used why not some other implementation?

We initially used BEA implementation and it sometimes had problems.
Woodstox seemed to better in-terms of performance and implementation.
Tatu, who mainly maintains woodstox helps to improve woodstox a lot.

>  
> Is it possible to plugin any other event based parser in Axis2?  or it
> relies on woodstox and for that matter STAX only?

You can plugin any StAX implementation. But some implementations *might*
have some bugs in them. If you want to switch implementations it is just
a matter of putting the required implementation in the classpath.


BTW, interesting set of questions from you, which I didn't hear from
anyone in this list. Thanks for motivating us to re-think about our
initial strategies and I think they still hold even now :)

Chinthaka
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGS929jON2uBzUhh8RAipxAJ4lqpsGqwVP3wLdTc3pRP/j+GxzTACdEE8a
ywHXUJfH+E2mxkaVUObB4Iw=
=09gd
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Call other web services

Posted by Christian Doyle <ch...@gmail.com>.
The goal here is when a call is made to the service to add an iEngine it 
queries that iEngine (which is also a service) to get the remote 
system's date.  This isn't particularly pratical, but it does make for a 
pretty good test case as getDate is probably the most simplistic method 
which the service exposes.  I feel like there is some sort of addressing 
problem occurring but I am not knowledgeable enough to know exactly 
what.  Also the service.xml and wsdl file were generated by the eclipse 
plugin and I did not modify them at all.

Relevant pieces of code:
 From IEngine.java (the web service):
/**
     * @param ip
     *            address of the iengine to begin polling
     * @throws Exception
     * @throws AxisFault
     */
    private synchronized void addIEngineHop(String ip, String nextHop) {

        if (!iEngines.containsKey(ip)) {

            // get the iengine that was just added's known devices and 
iengines
            // in order to build a tree structure
            IEngineRPCConnection conn;

            try {
                conn = new IEngineRPCConnection(ip);
                conn.open();

                final SortedSet<String> devices = conn.getDevices();
                final SortedSet<String> iEngines = conn.getIEngines();

                // add all of the deivces and set up their
                // routing table appropriately
                for (String device : devices) {
                    addDevice(device, ip);
                }

                for (String iEngine : iEngines) {
                    IEngine.iEngines.put(iEngine, ip);
                    insertIEngine(iEngine, ip);
                }

                IEngine.iEngines.put(ip, nextHop);
                insertIEngine(ip, nextHop);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

from IEngineRPCConnection (the service client):
public static final String XSD = 
"http://iengine.rfid.odintechnologies.com/xsd";
public static final String URL = "/axis2/services/IEngine";

    public IEngineRPCConnection(String ip) throws AxisFault {
        this.ip = ip;
        client = new RPCServiceClient();
    }

/**
     * opens the connections
     *
     * @throws AxisFault
     */
    public void open() throws AxisFault {
        // set up client options
        final Options options = client.getOptions();
        final EndpointReference er = new EndpointReference("http://" + ip
                + ":8080" + URL);
        options.setTo(er);
        final TransportOutDescription tod = new TransportOutDescription(
                Constants.TRANSPORT_HTTP);
        tod.setSender(new CommonsHTTPTransportSender());
        options.setTransportOut(tod);

    }

public Date getDate() throws AxisFault {

         // set up a call to the service
         final QName opName = new QName(XSD, "getDate");
         final Object[] opArgs = new Object[] {};
         final Class[] returnTypes = new Class[] { Date.class };
       
         // call the service
         final Object[] response = client.invokeBlocking(opName, opArgs,
         returnTypes);
         final Date date = (Date) response[0];
       
         return date;
    }

Deepal Jayasinghe wrote:
> Hi Christian ,
> Yes you can do that  and I have done that too. Sometimes you might have
> done smt wrong , so please send me the src code then I can try and see.
>
> Thanks
> Deepal
>   
>> Is it possible to make calls to other Axis 2 services from within an
>> Axis 2 service using the RPCServiceClient?  When I try this I receive
>> a vague AxisFault:
>>
>> rg.apache.axis2.AxisFault: outboundNoAction
>>    at
>> org.apache.axis2.handlers.addressing.AddressingOutHandler$WSAHeaderWriter.processWSAAction(AddressingOutHandler.java:257)
>>
>>    at
>> org.apache.axis2.handlers.addressing.AddressingOutHandler$WSAHeaderWriter.writeHeaders(AddressingOutHandler.java:184)
>>
>>    at
>> org.apache.axis2.handlers.addressing.AddressingOutHandler.invoke(AddressingOutHandler.java:109)
>>
>>    at org.apache.axis2.engine.Phase.invoke(Phase.java:383)
>>    at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:203)
>>    at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:433)
>>    at
>> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:330)
>>
>>    at
>> org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:294)
>>
>>    at
>> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:520)
>>    at
>> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:500)
>>    at
>> org.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(RPCServiceClient.java:97)
>>
>>    at
>> com.odintechnologies.iengine.connection.IEngineRPCConnection.getDevices(IEngineRPCConnection.java:189)
>>
>>    at
>> com.odintechnologies.rfid.iengine.IEngine.addIEngineHop(IEngine.java:452)
>>    at
>> com.odintechnologies.rfid.iengine.IEngine.addIEngine(IEngine.java:497)
>>
>> thanks!
>> -Christian
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>>
>>
>>     
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Call other web services

Posted by Deepal Jayasinghe <de...@opensource.lk>.
Hi Christian ,
Yes you can do that  and I have done that too. Sometimes you might have
done smt wrong , so please send me the src code then I can try and see.

Thanks
Deepal
> Is it possible to make calls to other Axis 2 services from within an
> Axis 2 service using the RPCServiceClient?  When I try this I receive
> a vague AxisFault:
>
> rg.apache.axis2.AxisFault: outboundNoAction
>    at
> org.apache.axis2.handlers.addressing.AddressingOutHandler$WSAHeaderWriter.processWSAAction(AddressingOutHandler.java:257)
>
>    at
> org.apache.axis2.handlers.addressing.AddressingOutHandler$WSAHeaderWriter.writeHeaders(AddressingOutHandler.java:184)
>
>    at
> org.apache.axis2.handlers.addressing.AddressingOutHandler.invoke(AddressingOutHandler.java:109)
>
>    at org.apache.axis2.engine.Phase.invoke(Phase.java:383)
>    at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:203)
>    at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:433)
>    at
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:330)
>
>    at
> org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:294)
>
>    at
> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:520)
>    at
> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:500)
>    at
> org.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(RPCServiceClient.java:97)
>
>    at
> com.odintechnologies.iengine.connection.IEngineRPCConnection.getDevices(IEngineRPCConnection.java:189)
>
>    at
> com.odintechnologies.rfid.iengine.IEngine.addIEngineHop(IEngine.java:452)
>    at
> com.odintechnologies.rfid.iengine.IEngine.addIEngine(IEngine.java:497)
>
> thanks!
> -Christian
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
>

-- 
Thanks,
Deepal
................................................................
"The highest tower is built one brick at a time"



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


RE: Can't get the right kind of header

Posted by Furash Gary <fu...@mcao.maricopa.gov>.
Duh!  Argh!  I hate it when I mess something up that's this obvious.  Of
course the headers look different.  Axis is doing just what I was
telling it :-) 

-----Original Message-----
From: Samisa Abeysinghe [mailto:samisa@wso2.com] 
Sent: Wednesday, May 16, 2007 8:29 PM
To: axis-user@ws.apache.org
Subject: Re: Can't get the right kind of header

Samisa Abeysinghe wrote:
> Furash Gary wrote:
>> Yes, before you ask, I know I'm just supposed to use WSDL2Java, but 
>> I'm just trying to get a feel for this first :-)
>>
>> I'm calling a .NET service from Java.  The header I'm generating in 
>> AXIS doesn't look like the header the .NET service wants, so it's 
>> failing with "Unable to handle request without a valid action
parameter".
>>
>> The .NET service wants this in the HTTP header:
>>
>> POST /objacctwebservices/Login.asmx HTTP/1.1
>> Host: mcaosappstest
>> Content-Type: text/xml; charset=utf-8
>> Content-Length: length
>> SOAPAction: "http://xml.objacct.com/GetLoginKey"
>>
>> Instead, my code does something like this:
>>
>> Content-Type: application/soap+xml; charset=utf-8; 
>> action="http://xml.objacct.com/GetLoginKey"
>>
>> And doesn't have a "SOAPAction: " parameter.
>>   
> You have to use SOAP 1.1 version. By default Axis2/C use SOAP 1.2.
See
http://spteam-lists.blogspot.com/2007/05/re-creating-axis2-soap-header.h
tml
on how to set SOAP version with options.
>
> Samisa...
>


--
Samisa Abeysinghe : http://www.wso2.org/ (WSO2 Oxygen Tank - Web
Services Developers' Portal)


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Can't get the right kind of header

Posted by Samisa Abeysinghe <sa...@wso2.com>.
Samisa Abeysinghe wrote:
> Furash Gary wrote:
>> Yes, before you ask, I know I'm just supposed to use WSDL2Java, but I'm
>> just trying to get a feel for this first :-)
>>
>> I'm calling a .NET service from Java.  The header I'm generating in AXIS
>> doesn't look like the header the .NET service wants, so it's failing
>> with "Unable to handle request without a valid action parameter".
>>
>> The .NET service wants this in the HTTP header:
>>
>> POST /objacctwebservices/Login.asmx HTTP/1.1
>> Host: mcaosappstest
>> Content-Type: text/xml; charset=utf-8
>> Content-Length: length
>> SOAPAction: "http://xml.objacct.com/GetLoginKey"
>>
>> Instead, my code does something like this:
>>
>> Content-Type: application/soap+xml; charset=utf-8;
>> action="http://xml.objacct.com/GetLoginKey"
>>
>> And doesn't have a "SOAPAction: " parameter.
>>   
> You have to use SOAP 1.1 version. By default Axis2/C use SOAP 1.2.
See 
http://spteam-lists.blogspot.com/2007/05/re-creating-axis2-soap-header.html 
on how to set SOAP version with options.
>
> Samisa...
>


-- 
Samisa Abeysinghe : http://www.wso2.org/ (WSO2 Oxygen Tank - Web Services Developers' Portal)


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Can't get the right kind of header

Posted by Samisa Abeysinghe <sa...@wso2.com>.
Furash Gary wrote:
> Yes, before you ask, I know I'm just supposed to use WSDL2Java, but I'm
> just trying to get a feel for this first :-)
>
> I'm calling a .NET service from Java.  The header I'm generating in AXIS
> doesn't look like the header the .NET service wants, so it's failing
> with "Unable to handle request without a valid action parameter".
>
> The .NET service wants this in the HTTP header:
>
> POST /objacctwebservices/Login.asmx HTTP/1.1
> Host: mcaosappstest
> Content-Type: text/xml; charset=utf-8
> Content-Length: length
> SOAPAction: "http://xml.objacct.com/GetLoginKey"
>
> Instead, my code does something like this:
>
> Content-Type: application/soap+xml; charset=utf-8;
> action="http://xml.objacct.com/GetLoginKey"
>
> And doesn't have a "SOAPAction: " parameter.
>   
You have to use SOAP 1.1 version. By default Axis2/C use SOAP 1.2.

Samisa...

-- 
Samisa Abeysinghe : http://www.wso2.org/ (WSO2 Oxygen Tank - Web Services Developers' Portal)


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Can't get the right kind of header

Posted by Furash Gary <fu...@mcao.maricopa.gov>.
Yes, before you ask, I know I'm just supposed to use WSDL2Java, but I'm
just trying to get a feel for this first :-)

I'm calling a .NET service from Java.  The header I'm generating in AXIS
doesn't look like the header the .NET service wants, so it's failing
with "Unable to handle request without a valid action parameter".

The .NET service wants this in the HTTP header:

POST /objacctwebservices/Login.asmx HTTP/1.1
Host: mcaosappstest
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://xml.objacct.com/GetLoginKey"

Instead, my code does something like this:

Content-Type: application/soap+xml; charset=utf-8;
action="http://xml.objacct.com/GetLoginKey"

And doesn't have a "SOAPAction: " parameter.

Here's my nifty code:

	ServiceClient client = new ServiceClient();
		Options options = new Options();
		options.setTo(new EndpointReference(uri));
		options.setAction("http://xml.objacct.com/GetLoginKey");
		client.setOptions(options);
		MessageContext msgctx = new MessageContext();
	
msgctx.setEnvelope(LoginKeyMsg.createLoginKeyMessage("MCAO", "admin",
"abc123"));
		OperationClient opClient =
client.createClient(ServiceClient.ANON_OUT_IN_OP);
		opClient.addMessageContext(msgctx);
		opClient.execute(true);
		MessageContext respMsgCtx =
opClient.getMessageContext("In");
		SOAPEnvelope respEnvelope = respMsgCtx.getEnvelope();





---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Call other web services

Posted by Christian Doyle <ch...@gmail.com>.
Is it possible to make calls to other Axis 2 services from within an 
Axis 2 service using the RPCServiceClient?  When I try this I receive a 
vague AxisFault:

rg.apache.axis2.AxisFault: outboundNoAction
    at 
org.apache.axis2.handlers.addressing.AddressingOutHandler$WSAHeaderWriter.processWSAAction(AddressingOutHandler.java:257)
    at 
org.apache.axis2.handlers.addressing.AddressingOutHandler$WSAHeaderWriter.writeHeaders(AddressingOutHandler.java:184)
    at 
org.apache.axis2.handlers.addressing.AddressingOutHandler.invoke(AddressingOutHandler.java:109)
    at org.apache.axis2.engine.Phase.invoke(Phase.java:383)
    at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:203)
    at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:433)
    at 
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:330)
    at 
org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:294)
    at 
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:520)
    at 
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:500)
    at 
org.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(RPCServiceClient.java:97)
    at 
com.odintechnologies.iengine.connection.IEngineRPCConnection.getDevices(IEngineRPCConnection.java:189)
    at 
com.odintechnologies.rfid.iengine.IEngine.addIEngineHop(IEngine.java:452)
    at 
com.odintechnologies.rfid.iengine.IEngine.addIEngine(IEngine.java:497)

thanks!
-Christian

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Stax and Axis2

Posted by Rishi krish <ri...@gmail.com>.
AXIOM implementation is based on StAX - but u can plugin any stax
implemenation with it. We have tried both IBM and BEA implementation of stax
and it works great with all of them.



On 5/16/07, Vibhor_Sharma <vs...@gryphonnetworks.com> wrote:
>
>  Hi
>     Few conceptual question
>
> why did we use the STAX in Axis2 and why is it so important to use it ?
> why was'nt SAX used?
>
> Why only woodstox STAX used why not some other implementation?
>
> Is it possible to plugin any other event based parser in Axis2?  or it
> relies on woodstox and for that matter STAX only?
>
>
> Thanks
> Vibhor
>
>
>



-- 
thanks
Rishi