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 Robert Evans <ax...@webdev.apl.jhu.edu> on 2002/04/02 00:59:16 UTC

Beginner trying to understand how to pass XML document instead of RPC calls

Greetings,

I have been trying to figure out how to pass an XML document to a web 
service instead of just making RPC calls.  I think I found a way, based 
on the example in the AXIS documentation, but I want to see if I am 
correct, or if there is an easier/better way.

It seems that once you have a Document, you can use XMLUtils to convert 
it to a String, convert the String to a StringBufferInputStream, and 
then use this InputStream to create a Message object, which in turn can 
be used by setRequestMessage(...).  Finally invoke can be called.

Now even though I think this works, it seems to be rather cumbersome. 
 Have I missed something?  I'm working from the AXIS release 
documentation and Building Web Services with Java (out of date based on 
the new Axis release).

I'd appreciate any pointers in the right location.....

Bob Evans
JHU/APL


RE: Beginner trying to understand how to pass XML document instead of RPC calls

Posted by Chris Haddad <ch...@cobia.net>.
Robert -

You description sounds correct.

See /samples/message or /samples/proxy for examples of how to perform
XML document based messaging.

Another way to pass an XML document over the wire would be to use an RPC
call with a String argument whose value is encoded in XML.  The string
would then need to be serialized/deserialized by your service and/or
client methods.  It is a bit of a kludge to have the ser/desers inside
the service/client stub, but you get to re-use the simple plumbing
framework that is created automagically by Java2WSDL and WSDL2Java.  In
other words, the upside is that you don't see the under the hood
MessageContext or Call objects. The downside is that you see a fair
amount of XML DOM manipulation.


Cheers,

/Chris


-----Original Message-----
From: Robert Evans [mailto:axis@webdev.apl.jhu.edu] 
Sent: Monday, April 01, 2002 5:59 PM
To: axis-user@xml.apache.org
Subject: Beginner trying to understand how to pass XML document instead
of RPC calls

Greetings,

I have been trying to figure out how to pass an XML document to a web 
service instead of just making RPC calls.  I think I found a way, based 
on the example in the AXIS documentation, but I want to see if I am 
correct, or if there is an easier/better way.

It seems that once you have a Document, you can use XMLUtils to convert 
it to a String, convert the String to a StringBufferInputStream, and 
then use this InputStream to create a Message object, which in turn can 
be used by setRequestMessage(...).  Finally invoke can be called.

Now even though I think this works, it seems to be rather cumbersome. 
 Have I missed something?  I'm working from the AXIS release 
documentation and Building Web Services with Java (out of date based on 
the new Axis release).

I'd appreciate any pointers in the right location.....

Bob Evans
JHU/APL