Closed GoogleCodeExporter closed 8 years ago
I found out that the encoding coming from the web service is not UTF-8, but
ISO-8859-1. I managed to convert the inputstream to UTF-8, and now the umlauts
are displayed properly.
Original comment by laistryg...@googlemail.com
on 14 Apr 2011 at 5:15
Thanks. I will close the issue therefore.
Original comment by mosa...@gmail.com
on 6 Jun 2011 at 10:44
hi u,
i also have this problem, can you show your code?
my code:
String info = new String(body.toString().getBytes("ISO-8859-1"),"UTF-8");
but not correctly.
thanks u.
Original comment by laodaih...@gmail.com
on 6 Sep 2011 at 4:43
Do not use bodyIn .. and then toString... use getResponse and parse the output
properly..
Original comment by mosa...@gmail.com
on 6 Sep 2011 at 3:06
Hi u,
I tried it your away, but getResponse or bodyIn both need toString() to get data and parse string output.
I still have not solved the problem, please help me.
Thanks u repy.
Original comment by laodaih...@gmail.com
on 7 Sep 2011 at 5:09
Not true. If you you getResponse you get a tree or SoapObjects that allow you
to use the various gettters like getAttribute, getProperty, getPropertyAsString
and so on.
Original comment by mosa...@gmail.com
on 7 Sep 2011 at 3:15
Hi u,
U true, but not solved the problem :(
Here my code:
//use getRespone
Vector<SoapObject> vector = (Vector<SoapObject>) envelope.getResponse();
SoapObject so = null;
for (int c=0; c < vector.size(); c++)
{
so = vector.elementAt(c);
Log.i("--trying--0-->>>>>",so.getPropertyAsString("categoryName"));
Log.i("--trying--01-->>>>>",so.getPropertySafelyAsString("categoryName"));
}
//use bodyin
SoapObject body=(SoapObject)envelope.bodyIn;
int count = body.getPropertyCount();
if(count>0){
SoapObject so = null;
Log.i("---getCategory--11-","--count--"+count+"--->"+body);
for (int i = 0; i < count; i++)
{
so = (SoapObject) body.getProperty(i);
Log.i("---trying--02--","-->"+so.getProperty("categoryName").toString());
}
}
both show:
09-08 10:04:47.891: INFO/--trying--0-->>>>>(313): D� sử - cổ trang
09-08 10:04:47.901: INFO/--trying--01-->>>>>(313): D� sử - cổ trang
09-08 10:06:44.901: INFO/--trying--02-->>>>>(313): D� sử - cổ trang
thanks u repy.
Original comment by laodaih...@gmail.com
on 8 Sep 2011 at 3:07
Just use SoapObject response = (SoapObject) envelope.getRepsonse()
and parse from there. The response is not a vector. Just set a break point
right there aand check it all out.
Original comment by mosa...@gmail.com
on 8 Sep 2011 at 5:31
thanks u repy, I think my problem that is set encoding for envelope, because
when i set encoding = iso-8859-1 and test in soapUI, response is D� s&#xleed;
- c&xled5; trang, and when i set encoding = utf-8 and test soapUI, response is
Dã sử - cổ trang.
thanks u very much.
Original comment by laodaih...@gmail.com
on 8 Sep 2011 at 9:22
:) i fixed my problem, true ís set encoding = utf-8 for header repuest
thanks u very much. good luck!
Original comment by laodaih...@gmail.com
on 8 Sep 2011 at 10:51
Hello laodaih!
Can you please post a snippet of your code?
im looking for that fix too but is not working for me.
thank you!
Original comment by elizeire@gmail.com
on 18 Oct 2011 at 7:24
hi u,
- i use: ksoap2-android-assembly-2.5.7-jar-with-dependencies .jar
- i download class AndroidHttpTransport.java (if need
AndroidServiceConnection.java) and custom its:
public class AndroidHttpTransport extends Transport {
..
public void call(String soapAction, SoapEnvelope envelope)
throws IOException, XmlPullParserException {
...
connection.setRequestProperty("User-Agent", "kSOAP/2.0");
connection.setRequestProperty("SOAPAction", soapAction);
connection.setRequestProperty("Content-Type", "text/xml;charset=UTF-8");
connection.setRequestProperty("Connection", "close");
...
}
..
}
- code use it:
...
AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport(URL);
androidHttpTransport.call(SOAP_ACTION_GET_CATEGORY, envelope);
SoapObject body = (SoapObject) envelope.bodyIn;
...
hope, usefull for u.
thanks. :)
Original comment by laodaih...@gmail.com
on 28 Nov 2011 at 6:22
Attachments:
With the 2.6.0 release utf encoding is activated by default and you do not have
to do anything. Just use the normal HttpTransportSE classes as usual.
Original comment by mosa...@gmail.com
on 29 Nov 2011 at 7:17
With the 2.6.0 release utf encoding is activated by default and you do not have
to do anything. Just use the normal HttpTransportSE classes as usual.
Original comment by mosa...@gmail.com
on 29 Nov 2011 at 7:17
i think im gettin this issue.. how can i know if the webservice enconding is
utf-8??
Original comment by tiarsoft...@gmail.com
on 25 Aug 2012 at 3:47
I just merged a fix into master that can set the encoding.. build from master
and try it or wait for the 3.0.0-Rc.2 release.
Original comment by mosa...@gmail.com
on 13 Sep 2012 at 5:15
Hi i use ksoap2 3.3 in my project , i have problem to get string result from
webservice ! it`s i get this on android : ???·???§?? ?¯?²?????? (???§??)
?§???²?§???? ????µ???? ?±?§ ???´?®?µ ?©?????¯
but when i test it on pc browser it`s show correctly
this is my code :
env = new SoapSerializationEnvelope(SoapEnvelope.VER11);
env.dotNet = false;
env.xsd = SoapSerializationEnvelope.XSD;
env.enc = SoapSerializationEnvelope.ENC;
request = new SoapObject("customWebService","addProductToCart");
request.addProperty("sessionID", sessionId);
request.addProperty("cartID", cartID);
request.addProperty("productID", productID);
request.addProperty("qty", qty);
request.addProperty("sku", productSKU);
env.setOutputSoapObject(request);
androidHttpTransport = new HttpTransportSE(
"http://mysiteeee.com/WebServiceSOAP/server.php?wsdl/",
60000);
androidHttpTransport.debug = true;
androidHttpTransport.call("", env);
result = env.getResponse();
can any body help me ?
thanks
Original comment by MAHDI.FA...@gmail.com
on 22 Jul 2014 at 8:24
Original issue reported on code.google.com by
laistryg...@googlemail.com
on 14 Apr 2011 at 11:30