cancel
Showing results for 
Search instead for 
Did you mean: 

Encoding Problems: Java Client, Axis and SAP Webservice Call

Former Member
0 Kudos

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.

Accepted Solutions (0)

Answers (1)

Answers (1)

angel_dichev
Active Participant
0 Kudos

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

Former Member
0 Kudos

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?