You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@xml.apache.org by Davenport Todd S GS-09 96 CG/SCTOA <to...@eglin.af.mil> on 2001/12/06 16:13:24 UTC
Escaping special characters inside the SOAP body
Hello all. I've got a quick question.
I'm using Tomcat 4.0.1 with SOAP 2.2 servlet. My deployed service is a Java
class method, and returns an XML fragment as a String.
public String foo() {
return "<reply>foo</reply>";
}
So I would expect the SOAP reply to look something like this:
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="Some-URI"
SOAP-ENV:encodingStyle="Some-URI"/>
<SOAP-ENV:Body>
<m:foo xmlns:m="Some-URI">
<reply>foo</reply>
</m:foo>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
However, the reply I'm getting is this
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="Some-URI"
SOAP-ENV:encodingStyle="Some-URI"/>
<SOAP-ENV:Body>
<m:foo xmlns:m="Some-URI">
<reply>foo</reply>
</m:foo>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
So now the problem is my client cannot parse the XML reply. I'm using a
Perl LWP client, but I've snooped the connection and the server is the one
escaping the special characters inside the Body tag. I do not want to make
the client translate the escaped characters back, because I may want to use
Java clients, VB clients, etc., so I'd rather solve this problem once,
instead of for every type of client.
How can I prevent the special characters inside the Body tag to not be
escaped?
Thanks in advance!
~tsd
****************************
Todd S. Davenport
96 CG/SCTOA
Eglin AFB, FL
COM: (850) 882-5498
DSN: 872-5498
todd.davenport@eglin.af.mil
****************************
Re: Escaping special characters inside the SOAP body
Posted by Gus <gu...@netquotient.com>.
Your can return an Element <Reply> that way it will be XML and any
parser will be able to parse it.
Davenport Todd S GS-09 96 CG/SCTOA wrote:
> Hello all. I've got a quick question.
>
> I'm using Tomcat 4.0.1 with SOAP 2.2 servlet. My deployed service is
> a Java class method, and returns an XML fragment as a String.
>
> public String foo() {
> return "<reply>foo</reply>";
> }
>
> So I would expect the SOAP reply to look something like this:
>
> <SOAP-ENV:Envelope
> xmlns:SOAP-ENV="Some-URI"
> SOAP-ENV:encodingStyle="Some-URI"/>
> <SOAP-ENV:Body>
> <m:foo xmlns:m="Some-URI">
> <reply>foo</reply>
> </m:foo>
> </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
>
> However, the reply I'm getting is this
>
> <SOAP-ENV:Envelope
> xmlns:SOAP-ENV="Some-URI"
> SOAP-ENV:encodingStyle="Some-URI"/>
> <SOAP-ENV:Body>
> <m:foo xmlns:m="Some-URI">
> <reply>foo</reply>
> </m:foo>
> </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
>
> So now the problem is my client cannot parse the XML reply. I'm using
> a Perl LWP client, but I've snooped the connection and the server is
> the one escaping the special characters inside the Body tag. I do not
> want to make the client translate the escaped characters back, because
> I may want to use Java clients, VB clients, etc., so I'd rather solve
> this problem once, instead of for every type of client.
>
> How can I prevent the special characters inside the Body tag to not be
> escaped?
>
> Thanks in advance!
>
> ~tsd
>
> ****************************
> Todd S. Davenport
> 96 CG/SCTOA
> Eglin AFB, FL
> COM: (850) 882-5498
> DSN: 872-5498
> todd.davenport@eglin.af.mil
> ****************************
>
Re: Escaping special characters inside the SOAP body
Posted by Gus <gu...@netquotient.com>.
Your can return an Element <Reply> that way it will be XML and any
parser will be able to parse it.
Davenport Todd S GS-09 96 CG/SCTOA wrote:
> Hello all. I've got a quick question.
>
> I'm using Tomcat 4.0.1 with SOAP 2.2 servlet. My deployed service is
> a Java class method, and returns an XML fragment as a String.
>
> public String foo() {
> return "<reply>foo</reply>";
> }
>
> So I would expect the SOAP reply to look something like this:
>
> <SOAP-ENV:Envelope
> xmlns:SOAP-ENV="Some-URI"
> SOAP-ENV:encodingStyle="Some-URI"/>
> <SOAP-ENV:Body>
> <m:foo xmlns:m="Some-URI">
> <reply>foo</reply>
> </m:foo>
> </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
>
> However, the reply I'm getting is this
>
> <SOAP-ENV:Envelope
> xmlns:SOAP-ENV="Some-URI"
> SOAP-ENV:encodingStyle="Some-URI"/>
> <SOAP-ENV:Body>
> <m:foo xmlns:m="Some-URI">
> <reply>foo</reply>
> </m:foo>
> </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
>
> So now the problem is my client cannot parse the XML reply. I'm using
> a Perl LWP client, but I've snooped the connection and the server is
> the one escaping the special characters inside the Body tag. I do not
> want to make the client translate the escaped characters back, because
> I may want to use Java clients, VB clients, etc., so I'd rather solve
> this problem once, instead of for every type of client.
>
> How can I prevent the special characters inside the Body tag to not be
> escaped?
>
> Thanks in advance!
>
> ~tsd
>
> ****************************
> Todd S. Davenport
> 96 CG/SCTOA
> Eglin AFB, FL
> COM: (850) 882-5498
> DSN: 872-5498
> todd.davenport@eglin.af.mil
> ****************************
>