Uncategorized

Tip o’ the Day: eTapestry and NuSOAP 0.9.5

This is my first usage of NuSoap, and in crafting up my current eTapesty API integration project, I kept getting the following WSDL error:

wsdl error: XML error parsing WSDL from https://sna.etapestry.com/v2messaging/service?WSDL on line 1: Not well-formed (invalid token)

Playing around with outputting the $this->debug variable (unittesting + NuSOAP is making my life sad) revealed that headers weren’t being removed from the WSDL response, and so the XML wasn’t valid. I verified that by adding my own debug statement around line 3184 of nusoap.php to see how many headers it found.

$this->debug('Header array size: ' . count($header_array));

It was finding 1 header, which wasn’t correct, because this was what my headers looked like:

HTTP/1.1 200 Connection established

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/xml
Date: Fri, 26 Aug 2011 15:53:36 GMT
Set-Cookie: ,gibberish.;path=/;secure;httponly
Cache-Control: private
Content-Encoding: gzip
Transfer-Encoding: chunked

The issue was in the isSkippableCurlHeader() call about 40 lines up. That function (declared around line 2762 of nusoap.php) lists HTTP headers that can be ignored, but is missing “HTTP/1.1 200 Connection established”. It only has “HTTP/1.0 200 Connection established”.

Add “HTTP/1.1 200 Connection established” to the $skipHeaders array, and you’re set.

…And don’t redownload the NuSOAP library and overwrite your changes.