The error org. ksoap2.serialization. soapprimitive is reported when Android calls. Net WebService.

Source: Internet
Author: User

Android WebService is usually used when users accept the WebService server's return 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.

 

Use soapobject = (soapobject)

 

Envelope. getresponse (); and soapobject result = (soapobject) envelope. bodyin;

 

Java. Lang. classcastexception: org. ksoap2.serialization. soapprimitive. We can use object =

 

Envelope. getresponse (); To solve this error.

 

If the type returned by the server is byte [], use object = envelope. getresponse (); and soapobject result = (soapobject)

 

Envelope. bodyin; errors will not occur, but an error will be reported when using object = envelope. getresponse (); The retrieved value is decoded and encoded using base64. If soapobject result = (soapobject) envelope. bodyin; is used, the byte [] can be fully decoded and encoded.

, Byte [] Ops = base64.decode (result. getproperty (0). tostring ());

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.