You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Anna Krajewska <a....@wasko.pl> on 2006/03/24 12:43:48 UTC
web-service String parameter encoding problem
Hi
I have a problem with String parameter encoding. I have a web-service that takes as a parameter java.lang.String which is serialized xml DOM document. This document has proper header:
<?xml version="1.0" encoding="UTF-8" ?>
but when I try to save my SOAPEnvelope with my own created BaseHandler:
Handler serviceHandler = msgContext.getService();
MessageContext msgctx = msgContext.getCurrentContext();
org.apache.axis.Message msg = msgctx.getCurrentMessage();
File file = new File("C:\\envelope.xml");
FileOutputStream fos = new FileOutputStream(file);
msg.writeTo(fos);
fos.flush();
fos.close();
the whole SOAPEnvelope looks good but the xml document (String parameter) looks terrible. I don't know how to force axis to write that string for me also in UTF-8 encoding to the envelope - just as the whole envelope is encoded. Is it possible anyway?
HELP!
ania
Re: web-service String parameter encoding problem
Posted by Anna Krajewska <a....@wasko.pl>.
Ok, I managed to send normal xml tags by sending SOAPBodyElement instead of String but there is another problem - polish characters (those with tails). When I read polish signs to DOM element and then write it back to the file - everything is ok, but when I pass the same DOM Document as parameter of axis service method - something strange is happening to those polish signs - the rest of the letters are ok - only each polish sign is encoded on 7 bytes!!! What encoding is that! How can I change it?
----- Original Message -----
From: Anne Thomas Manes
To: axis-user@ws.apache.org
Sent: Saturday, March 25, 2006 6:18 PM
Subject: Re: web-service String parameter encoding problem
The embedded XML document must be escaped. That's why it looks funny.
Anne
On 3/24/06, Anna Krajewska <a.krajewska@wasko.pl > wrote:
Hi
I have a problem with String parameter encoding. I have a web-service that takes as a parameter java.lang.String which is serialized xml DOM document. This document has proper header:
<?xml version="1.0" encoding="UTF-8" ?>
but when I try to save my SOAPEnvelope with my own created BaseHandler:
Handler serviceHandler = msgContext.getService();
MessageContext msgctx = msgContext.getCurrentContext();
org.apache.axis.Message msg = msgctx.getCurrentMessage();
File file = new File("C:\\envelope.xml");
FileOutputStream fos = new FileOutputStream(file);
msg.writeTo(fos);
fos.flush();
fos.close();
the whole SOAPEnvelope looks good but the xml document (String parameter) looks terrible. I don't know how to force axis to write that string for me also in UTF-8 encoding to the envelope - just as the whole envelope is encoded. Is it possible anyway?
HELP!
ania
Re: web-service String parameter encoding problem
Posted by Anne Thomas Manes <at...@gmail.com>.
The embedded XML document must be escaped. That's why it looks funny.
Anne
On 3/24/06, Anna Krajewska <a....@wasko.pl> wrote:
>
> Hi
>
> I have a problem with String parameter encoding. I have a web-service that
> takes as a parameter java.lang.String which is serialized xml DOM
> document. This document has proper header:
>
> <?xml version="1.0" encoding="UTF-8" ?>
>
> but when I try to save my SOAPEnvelope with my own created BaseHandler:
>
> Handler serviceHandler = msgContext.getService();
> MessageContext msgctx = msgContext.getCurrentContext();
> org.apache.axis.Message msg = msgctx.getCurrentMessage();
> File file = new File("C:\\envelope.xml");
> FileOutputStream fos = new FileOutputStream(file);
> msg.writeTo(fos);
> fos.flush();
> fos.close();
>
> the whole SOAPEnvelope looks good but the xml document (String parameter)
> looks terrible. I don't know how to force axis to write that string for me
> also in UTF-8 encoding to the envelope - just as the whole envelope is
> encoded. Is it possible anyway?
>
> HELP!
>
> ania
>
>
>
>
>