When developing Android WebService, users generally use the WebService server when they accept the returned values.
Soapobject = (soapobject) envelope. getresponse (); this is used to accept the returned value, but this method usually produces Java. lang. classcastexception: Org. ksoap2.serialization. soapprimitive.
Based on my actual operations and help from others, I finally solved this problem.
Use soapobject = (soapobject) envelope. getresponse (); and soapobject result = (soapobject) envelope. bodyin; both methods will report the value.
Java. Lang. classcastexception: org. ksoap2.serialization. soapprimitive. We can use object =
(Object) envelope. getresponse (); To solve this error.
However, I still have some questions about this. When I use WebService to query the weather, soapobject = (soapobject) envelope. getresponse () is correct and no error will occur. However, Java appears when I check whether QQ is online. lang. classcastexception: Org. ksoap2.serialization. for errors such as soapprimitive, WebService is also used. Why is there a difference? If you have the same question, leave a message to me.