Re: encoding problem
Marc Logemann <[email protected]> Fri, 5 Dec 2003 11:05:29 +0100
| Newsgroups | gmane.comp.java.enhydra.ksoap |
|---|---|
| Message-ID | <NqSY4sRwOyd3mQTw77Byo7PFqlxRN10rHPG494jkHmr@akmail> |
Hi,
> on which configuration did you test kSOAP? WTK? ME4SE? An actual phone =
/
> Emulator? If so, which one?
i tested Siemens S55 Emulator and the WTK 2.1beta. Now with clear mind, i=
got slightly different
results.
With this Reply from axis:
HTTP/1.1 200 OK
Content-Type: text/xml; charset=3Dutf-8
Transfer-Encoding: chunked
Date: Fri, 05 Dec 2003 09:48:43 GMT
Server: Apache Coyote/1.0
<?xml version=3D"1.0" encoding=3D"UTF-8"?>
<soapenv:Envelope xmlns:soapenv=3D"http://schemas.xmlsoap.org/soap/envelo=
pe/" xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema" xmlns:xsi=3D"http://w=
ww.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:TestUTFResponse soapenv:encodingStyle=3D"http://schemas.xmlsoap.or=
g/soap/encoding/" xmlns:ns1=3D"urn:CourseService">
<ns1:TestUTFReturn xsi:type=3D"xsd:string">=C3=A4=C3=B6=C3=BC</ns1:Tes=
tUTFReturn>
</ns1:TestUTFResponse>
</soapenv:Body>
</soapenv:Envelope>
I got nice results with WTK 2.1beta, and a UTF-8 not supported message on=
S55. (I thought each MIDP device must implement
UTF-8?!?) How do i get the S55 (and probably other phones from Siemens) t=
o handle this kind of data?
However, when calling a different service, where i have this:
HTTP/1.1 200 OK
Content-Type: text/xml; charset=3Dutf-8
Transfer-Encoding: chunked
Date: Fri, 05 Dec 2003 09:57:54 GMT
Server: Apache Coyote/1.0
2000
<?xml version=3D"1.0" encoding=3D"UTF-8"?>
<soapenv:Envelope xmlns:soapenv=3D"http://schemas.xmlsoap.org/soap/envelo=
pe/" xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema" xmlns:xsi=3D"http://w=
ww.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:getAllCourseNamesResponse soapenv:encodingStyle=3D"http://schemas.=
xmlsoap.org/soap/encoding/" xmlns:ns1=3D"urn:CourseService">
<ns1:getAllCourseNamesReturn href=3D"#id0"/>
</ns1:getAllCourseNamesResponse>
<multiRef id=3D"id0" soapenc:root=3D"0" soapenv:encodingStyle=3D"http:/=
/schemas.xmlsoap.org/soap/encoding/" xsi:type=3D"ns2:Vector" xmlns:soapen=
c=3D"http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2=3D"http://xml.a=
pache.org/xml-soap">
<item xsi:type=3D"xsd:string">GC Schlo=C3=9F Sickendorf</item>
<item xsi:type=3D"xsd:string">Attighof</item>
[..]
</multiRef>
</soapenv:Body>
</soapenv:Envelope>
Having this client code, i got trouble with both.
SoapObject soapObject =3D (SoapObject) httptransport.call(soapobject);
for (int i =3D 0; i < soapObject.getPropertyCount(); i++) {
resultItem.setText((String) soapObject.getProperty(i));
if (i =3D=3D 0) break;
}
I assume this is because SoapObject doesnt handle encoding properly? So b=
esides the point that with S55 i never get good
results another question would be how to handle a Vector with Strings com=
ing back? Or should i just change to returning
String[] in the WEbservice instead of Vector?
To me, as the encoding dumb guy i am, it seems that axis returns UTF-8 ba=
ck, so all my trouble is on client side...
---
regards
Marc Logemann
check http://www.logemann.org