Page 1 of 1

java.io.IoException Error Condition

Posted: Tue Dec 29, 2015 3:28 am
by dcpbarrington
Forum,

I have an Android App that connects to a Apache server to share information using a basic SOAP/XML interface.

The interface has been working just fine for over a year and all of a sudden something has changed and I'm now getting the following error condition when I try to retrieve a large XML packet from the server.

java.io.IOException: ID1ID2: actual 0x00003c63!= expected 0x00001f8b

I'm building the SOAP XML packet.
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body><ns3241:process xmlns:ns3241="http://tempuri.org"><data xsi:type="xsd:string">$DOC_BODY</data></ns3241:process></SOAP-ENV:Body>
</SOAP-ENV:Envelope>

I'm simply POSTing the message to the server with the following code.

Code: Select all

  
    put Empty into tHTTPHeaders
   -- set the http headers
   put SOAP.AddHeader("User-Agent", "NuSOAP/0.9.5 (1.123)") after tHTTPHeaders
   put SOAP.AddHeader("Content-Type", "text/xml;charset=UTF-8") after tHTTPHeaders
   put SOAP.AddHeader("SOAPAction", quote & pAction & quote) after tHTTPHeaders
   put SOAP.AddHeader("Content-length", the length of pSOAPEnvelope) after tHTTPHeaders
   
   set the httpheaders to tHTTPHeaders
   -- ignore the fact that we don't have a valid certificate
   libUrlSetSSLVerification false
   
   -- note that post is a blocking call: may need to set the timeout
   put 1 into tTryCount
   put False into tConnectSuccess
   repeat while tTryCount <= 2 AND tConnectSuccess = false
      post pSOAPEnvelope to Url pUrl
      put it into tSOAPResponse
      put the result into tRslt
      if tSOAPResponse is not Empty AND tRslt is Empty then
         put True into tConnectSuccess
      else
         logSaverError "Post Message Error:" && tRslt
         add 1 to tTryCount
      end if
   end repeat
I've tried both UTF-8 and ISO-8859-1 formats and they both have the same issue.

NOTE: The code works just fine when it runs on the development PC, but only fails when it runs on an ANDROID device.

I've also used both LiveCode IDE V6.7.6 and V7.1.1 and the issue occurs the same with both version

The interface doesn't have any problems when the response packet is small.

From the error message it looks like it has something to do with the GZIP header, but that's as far as I can tell.

Wanted to see if anyone else would have an idea of where I should be looking or who I should talk to.

Any help would be appreciated.
Dan

Re: java.io.IoException Error Condition

Posted: Mon Jan 04, 2016 10:42 pm
by dcpbarrington
Forum,

Wanted to let you know that I figured out the cause of the issue.

In the larger response the Apache2 web server was compressing the data because the mod_deflate feature was enabled.

I added "Accept-Encoding:None" to the header of the message and the web server stopped compressing the response.

Simple, but took a while to find.