wood burning stoves 2.0*
The moose likes Web Services and the fly likes XML result as a String Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "XML result as a String" Watch "XML result as a String" New topic
Author

XML result as a String

Kristian Ledung
Greenhorn

Joined: Jan 23, 2006
Posts: 9
Hello!
How bad is it to return a result from a webservice that is XML as a String? My webservice returns XML this way, but I want to do it according to good practice.
[ January 23, 2006: Message edited by: Kristian Ledung ]

Kristian
Reid M. Pinchback
Ranch Hand

Joined: Jan 25, 2002
Posts: 775
Sounds like you are probably looking for something like soap-with-attachments. If your result is naturally an XML document that is probably the cleanest approach.


Reid - SCJP2 (April 2002)
Reid M. Pinchback
Ranch Hand

Joined: Jan 25, 2002
Posts: 775
When the encoding of the SOAP XML and the encoding of the XML result being returned are the same, sending it as a String would seem to work fine. Anybody ever tried that when the XML result is in a different encoding? That may be the criterion for deciding on one approach versus the other: needing to ensure that serialization/deserialization of the XML doc by SOAP preserved the character encoding.
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Hi Reid,
Regd preserving encoding format, can you specify in what soap encoding style or how we can send a xml with different encoding ??
because the de/serialization will not happen for soap with xml attachments.
Also the java complex object will be sent as an SOAP inline complex types.


Spritle Software Blogs
Reid M. Pinchback
Ranch Hand

Joined: Jan 25, 2002
Posts: 775
No idea what happens with attachements, haven't used them yet. That was pretty much my question - which of the two approaches, if either, would be "safe" when dealing with docs including more than vanilla 7-bit ASCII characters?
Kristian Ledung
Greenhorn

Joined: Jan 23, 2006
Posts: 9
This is a part of my WSDL. This is the only thing my clients know about the result. The String is actually XML. What can I do to show the clients how the XML looks? I�m using RPC/encoded style.

<wsdl:message name="searchResponse">
<wsdl : part name="searchReturn" type="xsd:string"/>
</wsdl:message>
[ January 24, 2006: Message edited by: Kristian Ledung ]
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Ok Kristian,
Unless you consume the service and print the string result, you will not be able to tell on xml structure.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XML result as a String