Ksoap2 on android, unable to parse MOTM encoded response

Like the subject.

I run the grails web application, providing the service as a web service through the Axis2 plugin (then it uses Apache Axis2).

Everything is fine except that Android running ksoap2 fails to process the HTTP response.

The progress message that I get:

org.xmlpull.v1.XmlPullParserException: Unexpected token (position: TEXT --MIMEBoundaryur ... @ 4: 13 in java.io.InputStreamReader@40fdd958 )

Now I figured it out a bit and found that my web application, responding to a call caused by a soapy web service, returns data as multipart/related .

In particular, it returns something

  HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Content-Type: multipart/related; boundary=MIMEBoundaryurn_uuid_AC5A47086C51CDF4581329104304545; type="text/xml"; start="<0.urn:uuid: AC5A47086C51CDF4581329104304546@apache.org >" Date: Mon, 13 Feb 2012 03:38:24 GMT Connection: close --MIMEBoundaryurn_uuid_AC5A47086C51CDF4581329104304545 Content-Type: text/xml; charset=utf-8 Content-Transfer-Encoding: 8bit Content-ID: <0.urn:uuid: AC5A47086C51CDF4581329104304546@apache.org > <?xml version='1.0' encoding='utf-8'?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Body> <ns:sayHelloResponse xmlns:ns="http://api.account.mycompany.com"> <ns:return>Just a test... Hello John Doe! </ns:return> </ns:sayHelloResponse> </soapenv:Body> </soapenv:Envelope> --MIMEBoundaryurn_uuid_AC5A47086C51CDF4581329104304545-- 

So, apparently, XmlPullParser fails when it reaches:

  --MIMEBoundaryurn_uuid_AC5A47086C51CDF4581329104304545 

XML is probably expected to start alredy, but received MOTM headers.

Now the question is ... How to solve this problem?

+4
source share

Source: https://habr.com/ru/post/1396120/


All Articles