users@jax-rpc.java.net

Re: JAXRPC - "string" as return params - escape chars problem

From: Steve W. Jackson <stevewjackson_at_charter.net>
Date: Thu, 2 Dec 2004 12:54:59 -0600

On Dec 1, 2004, at 10:20 PM, mohit.saigal_at_us.abb.com wrote:

> Hi Folks,
>
> Got your emails from the "java.net" website. Some very helpful
> articles on the web site. I am faced with a problem regarding "string"
> return parameters from a web serice. Explanation is below, would
> appreciate all the help. I tried searching the mailing lists, but to
> no avail.
>
> By default, if i have a string (which contains xml data) being
> returned as part of a JAXRPC webservice return parameter, the escape
> characters are showing up (which i presume is the default behaviour).
>
> At this time, i want to avoid a doc-literal style, xml-fragment style
> and soap attachments. This is because the rpc-encoded string parameter
> works best for our clients.
> Is there a way to make the soap handlers AVOID escaping the xml
> string data within the soap message? Using JWSDP 1.5
>
> All the help is much appreciated ... example is below:
>
> For example: ....
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:ns0="http://iem.org/types"
> env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
>
> <env:Body><ans1:getResListResponse xmlns:ans1="iem.org/wsdl">
> <result xsi:type="xsd:string">
>
> &lt;resourcelist&gt; &lt;resource name="RES1"
> type="GEN" participant="MP1" user="USER1"
> delivery_date="2004-11-01" /&gt; &lt;/resourcelist&gt;
>
> </result>
> </ans1:getResListResponse>
> </env:Body>
> </env:Envelope>
>
> Regards,
>
> Mohit Saigal
>

I would suspect that it's not possible to have the SOAP handlers not
escape the XML, since it would wreak havoc internally. But it's a
simple matter to simply parse the string you receive as a valid XML
fragment, which will recognize and correctly handle those escaped
characters. And then you can serialize the resulting string and handle
it as needed.

= Steve =
Steve W. Jackson
Montgomery, Alabama


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net