users@jax-rpc.java.net

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

From: <mohit.saigal_at_us.abb.com>
Date: Thu, 2 Dec 2004 13:03:18 -0800

Thanks for the response Russel,

I tried with the CDATA earlier on before sending the message, but the
JAXRPC runtime SOAP handlers still treat it as a string
and escape whatever is in the CDATA section: <![CDATA[ ....... ]]>

I wanted to see if i could tweek the JAXRPC runtime classes (since the
java code is supplied) to ignore the escaping of the characters,
since the JAXRPC runtime classes do the encoding.

Thanks,

Mohit


Message from Russell Butek <butek_at_us.ibm.com> received on 12/02/2004 10:49
AM

12/02/2004 10:49 AM
Internal


Russell Butek <butek_at_us.ibm.com>





        To: Mohit Saigal/USTRA/ABB_at_ABB
        cc:
        Subject: Re: JAXRPC - "string" as return params - escape chars problem







Try wrapping your string inside a CDATA block:

myString = "CDATA[[" + myString + "]]";

A SOAP engine will wrap data inside a CDATA block if it wants to ignore
what's in that block. Since engines do it, I don't see why you can't.
I've never tried this, though, and I'm not exactly sure about the format
of
the CDATA block (ie., does it really have two [[ and ]]? I think so). You
may want to do a google search for CDATA to find out for sure.

Russell Butek
Web services consultant
IBM Software Services for WebSphere
butek_at_us.ibm.com
512 940 8592


mohit.saigal_at_us.abb.com wrote on 12/01/2004 10:20:48 PM:

> 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

Attention: Attachment "C.htm" has been removed from this note on December
02 2004 by Mohit Saigal/USTRA/ABB