4

As of subject.

I run a grails web application, exposing a service as a web-service via the Axis2 plugin (it then makes use of Apache Axis2).

Everything's fine, except that Android running ksoap2 fails when processing http response.

The execption message I get is:

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

Now, I investigated a bit and found that my web-app, when answering to a soap-encoded web-service call, returns data as multipart/related.

More specifically, it return 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, the XmlPullParser fails when it gets to:

    --MIMEBoundaryurn_uuid_AC5A47086C51CDF4581329104304545

It probably expected the begin of XML alredy, but got MOTM headers.

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

znpy
  • 474
  • 2
  • 10

0 Answers0