Overriding charset

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Overriding charset

Martin Voelkle
Hi list,

I am writing a service client using Axis2/C 1.6 (win32 binary
distribution) and WSDL2C, but I have a few issues:
I am only sending numerical values, but the reply contains text nodes
with non-ASCII characters. When the reply is deserialized in the
generated code, the first element containing non-ASCII chars is empty
and any following element is missing, a bit like the description in
issue AXIS2C-1265.

Looking through tcpmon, I see that both the request and the reply are
UTF8, so I first tried to change this with the following code:
        axis2_options_t* options = axis2_stub_get_options(stub, env);
        axutil_property_t* charset = axutil_property_create(env);
        axutil_property_set_value(charset, env, "Windows-1252");
        axis2_options_set_property(options, env, "CHARACTER_SET_ENCODING", charset);
and:
        axis2_options_set_property(options, env, "CHARACTER_SET_ENCODING",
"Windows-1252");
But none of these have any effect on the outgoing message or the reply
deserialization (I also tried ISO-8859-1).

I tried to set the Accept-Charset HTTP header using
axis2_options_set_http_headers, which is sent correctly, but the
service still replies using UTF-8.

I added a Content-Type HTTP header
(application/soap+xml;charset=Windows-1252;action="urn:action") and
the service finally replied using a Windows-1252 charset. This has 2
problems:
- the Content-Type HTTP header is sent twice, once set by me (with the
Windows-1252 charset) and once set by Axis2/C (with the UTF-8
charset). I guess that I am lucky that my header is sent first.
- the original problem is not solved, as the deserialization still has
the same bug as with UTF-8!

Is there an other way to override the outgoing charset?
Is there a way to receive non-ASCII characters?

Thank you,

Martin Voelkle
Reply | Threaded
Open this post in threaded view
|

Re: Overriding charset

Martin Benedix
Hi Martin, Hi List.

I would like bump this mail up again, because I have nearly
the same problem. Special characters like the german Ä,Ü,Ö
are somehow affecting the tcp communication between service
and client. Which leads to the general question:
How can the char set encoding of a soap transmission
be altered?

Thanks in advance and best regards

Martin Benedix

Am 14.01.2010 17:26, schrieb Martin Voelkle:

> Hi list,
>
> I am writing a service client using Axis2/C 1.6 (win32 binary
> distribution) and WSDL2C, but I have a few issues:
> I am only sending numerical values, but the reply contains text nodes
> with non-ASCII characters. When the reply is deserialized in the
> generated code, the first element containing non-ASCII chars is empty
> and any following element is missing, a bit like the description in
> issue AXIS2C-1265.
>
> Looking through tcpmon, I see that both the request and the reply are
> UTF8, so I first tried to change this with the following code:
> axis2_options_t* options = axis2_stub_get_options(stub, env);
> axutil_property_t* charset = axutil_property_create(env);
> axutil_property_set_value(charset, env, "Windows-1252");
> axis2_options_set_property(options, env, "CHARACTER_SET_ENCODING", charset);
> and:
> axis2_options_set_property(options, env, "CHARACTER_SET_ENCODING",
> "Windows-1252");
> But none of these have any effect on the outgoing message or the reply
> deserialization (I also tried ISO-8859-1).
>
> I tried to set the Accept-Charset HTTP header using
> axis2_options_set_http_headers, which is sent correctly, but the
> service still replies using UTF-8.
>
> I added a Content-Type HTTP header
> (application/soap+xml;charset=Windows-1252;action="urn:action") and
> the service finally replied using a Windows-1252 charset. This has 2
> problems:
> - the Content-Type HTTP header is sent twice, once set by me (with the
> Windows-1252 charset) and once set by Axis2/C (with the UTF-8
> charset). I guess that I am lucky that my header is sent first.
> - the original problem is not solved, as the deserialization still has
> the same bug as with UTF-8!
>
> Is there an other way to override the outgoing charset?
> Is there a way to receive non-ASCII characters?
>
> Thank you,
>
> Martin Voelkle
>    


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Overriding charset

Patrick Duflot
Late reply, but perhaps still useful...

I remember having trouble with UTF-8 and the guththilla parser that comes with axis 1.6.
I took the latest version of the guththilla parser from axis2c svn and I can send and receive russian characters (maybe, you can also try the libxml parser integration, it should handle UTF-8 properly as well). Of course, you have to decode them to match the encoding you are using inide your client code.

To send german characters Ä,Ü,Ö. You have to encode them to UTF-8 (which is axis2c default encoding and the most popular character encoding for webservices). Though axis2c is very permissive with character encoding, it can alter the communication with other frameworks.

Regards,

Patrick

On Fri, Sep 3, 2010 at 3:54 PM, Martin Benedix <[hidden email]> wrote:
Hi Martin, Hi List.

I would like bump this mail up again, because I have nearly
the same problem. Special characters like the german Ä,Ü,Ö
are somehow affecting the tcp communication between service
and client. Which leads to the general question:
How can the char set encoding of a soap transmission
be altered?

Thanks in advance and best regards

Martin Benedix

Am 14.01.2010 17:26, schrieb Martin Voelkle:

Hi list,

I am writing a service client using Axis2/C 1.6 (win32 binary
distribution) and WSDL2C, but I have a few issues:
I am only sending numerical values, but the reply contains text nodes
with non-ASCII characters. When the reply is deserialized in the
generated code, the first element containing non-ASCII chars is empty
and any following element is missing, a bit like the description in
issue AXIS2C-1265.

Looking through tcpmon, I see that both the request and the reply are
UTF8, so I first tried to change this with the following code:
       axis2_options_t* options = axis2_stub_get_options(stub, env);
       axutil_property_t* charset = axutil_property_create(env);
       axutil_property_set_value(charset, env, "Windows-1252");
       axis2_options_set_property(options, env, "CHARACTER_SET_ENCODING", charset);
and:
       axis2_options_set_property(options, env, "CHARACTER_SET_ENCODING",
"Windows-1252");
But none of these have any effect on the outgoing message or the reply
deserialization (I also tried ISO-8859-1).

I tried to set the Accept-Charset HTTP header using
axis2_options_set_http_headers, which is sent correctly, but the
service still replies using UTF-8.

I added a Content-Type HTTP header
(application/soap+xml;charset=Windows-1252;action="urn:action") and
the service finally replied using a Windows-1252 charset. This has 2
problems:
- the Content-Type HTTP header is sent twice, once set by me (with the
Windows-1252 charset) and once set by Axis2/C (with the UTF-8
charset). I guess that I am lucky that my header is sent first.
- the original problem is not solved, as the deserialization still has
the same bug as with UTF-8!

Is there an other way to override the outgoing charset?
Is there a way to receive non-ASCII characters?

Thank you,

Martin Voelkle
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]