on 03-15-2006 10:54 AM
I have a problem with encoding, in my case with "German Umlaute" (öäüÖÄÜ).
I have a Java Client (Eclipse Rich Client).
With Axis 1.2.1 (wsdl2java) I was generating the classes to access the SAP Webservices.
(The SAP-WS Server provides me the *.wsdl file).
On the client side I am using JaxB (JAXB Reference Implementation 1.0.4 from jwsdp-1.5) to generate an XML String from Model-Objects (marshall).
I try it with the two marshaller Methods:
- "ByteArrayOutputStream" = UTF-8 Encoded (marshaller.marshal(obj, byteArrayOutputStream);)
- "StringWriter" = Plain text (marshaller.marshal(obj, stringWriter);)
The German Umlaute in the marshalled string looks like this:
- ByteArrayOutputStream: Ä=à / ä=ä / Ö=à / ö=ö / Ü=à / ü=ü
- StringWriter: Ä=Ä / ä=ä ....
Then I send the string through the Axis generated classes to the SAP Server. (The XML string is an parameter of an Webservice Method/Call)
I debuged the Axis Layer (Soap Envelop) and I saw that the SAOP encodes my String to be able to sended it over the net.
Axis encodes my string like this:
- on the ByteArrayOutputStream String
Ã(Ä) -> Ã
ä(ä) -> ä
Ã(Ö) -> Ã
ö(ö) -> ö
Ã(Ü) -> Ã
ü(ü) -> zu ü
- on the StringWriter String
ä -> ä
Ä -> Ä
ö -> ö
Ö -> Ö
ü -> ü
Ü -> Ü
My problem is on the Server Side; The SAP Developers assert that my encoding is not right.
The character they become are wrong. They cannot handle my string, and cannot save the "German Umlauts"
What I am doing wrong, or what are they doing wrong?
Is there something special that I missed in my WebService Call procedure?
Is this the wrong way to access SAP Webservices from Java? Can this be so complicated?
Thank you.
Hi,
check you message in binary format, probably your writer has corrupted the UTF-8 encoding localy at the client side
Check in binary/hex format what are the umlauts' codes:
in UTF-8 they suppose to be:
ö - c3 b6
ä - c3 a4
ü - c3 bc
Ö - c3 96
Ä - c3 84
Ü - c3 9c
Regards, Angel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I don't think that the UTF is corrupted, I think the problem is that I encode the String two times. That means:
- the JaxB marshaller makes from Ä -> Ã (ByteArrayOutputStream)
- soap/axis encodes the à -> Ä (à is à / is „)
This is wrong, because the SAP Server received Ä --> Ã
and on the server side i don't think there is a backward encoding
from à --> Ä
I have to use the StringWriter method of JaxB marshaller to generate the string, and I have to passed the generated string without encoding to Axis/Soap.
Soap encodes automatically this String to UTF-8, like:
äÄöÖüÜ = äÄöÖüÜ
If there is a special character like for example so Soap encodes this to „
On the Server Side the recevied string will be converted by Soap to the original sended String.
String>>SOAP CLIENT(Encoding)....>Internet>...SOAP SERVER(Decoding)>>String
What do you think?
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.