aspose file tools*
The moose likes Web Services and the fly likes Xml document as a SOAP payload Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Xml document as a SOAP payload" Watch "Xml document as a SOAP payload" New topic
Author

Xml document as a SOAP payload

Suhas Joshi
Greenhorn

Joined: Nov 16, 2008
Posts: 2
Hi,
I'm presently working on a web services implementation in which it is required that the Client must send a xml document as the request payload. I'm using the SOAP UI to send the request and get the response. How to include the xml file in the SOAP request? What should be the parameter type in the service method?
The response payload is also an xml.
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2906
In WSDL the presence of a generic XML document is flagged with the "xsd:anyType" (Mapping XML document to xsd:anyType) or "xsd:any". Under JAX-RPC 1.1 "xsd:any" automatically maps to javax.xml.soap.SOAPElement from which you can extract your org.w3c.dom.Document (which is a org.w3c.dom.Node) for incoming XML. For outgoing XML you simply populate the javax.xml.soap.SOAPElement parameter/return value with your org.w3c.dom.Document.

JAX-WS 2.0 maps "xsd:any" and "xsd:anyType" to org.w3c.dom.Element rather than javax.xml.soap.SOAPElement. (See: Realizing Strategies for Document-Based Web Services With JAX-WS 2.0: Part 3 in a Series)

Tip: xsd:any: A cautionary tale


"Don't succumb to the false authority of a tool or model. There is no substitute for thinking."
Andy Hunt, Pragmatic Thinking & Learning: Refactor Your Wetware p.41
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Xml document as a SOAP payload
 
Similar Threads
what is SOAP and what for it is used?
Soap and payload
XML-RPC
How can I create a simple soap client servlet to send XML?
soap payload max size and http post