ext/soap getting better
I recently encountered a problem in the ext/soap extension in PHP5 (version 5.0.2). I’ve been using the extension in development only so far and it has proved to be quite stable.
The PHP soap server I’ve written run on Tru64 and exposes a weird C API that I wrapped in a custom extension. So this soap server is going to be used as a wrapper for this legacy proprietary system. It all seemed to work great until a system written in a.NET environment wanted to hook up a client to the server…
.NET sends function call parameters outside of the actual function element of the soap body using references. PHP interpreted this as being too many function calls. The extension explicitly disallowed more than one child element in the body. The below was not allowed.
<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://spock/kunta/kunta" xmlns:types="http://spock/kunta/kunta/encodedTypes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <q1:bassCall xmlns:q1="http://spock/bass/types/kunta"> <system xsi:type="xsd:string">XXX</system> <function xsi:type="xsd:string">TASKTEST</function> <parameter href="#id1" /> </q1:bassCall> <soapenc:Array id="id1" soapenc:arrayType="tns:Item[1]"> <Item href="#id2" /> </soapenc:Array> <tns:Item id="id2" xsi:type="tns:Item"> <key xsi:type="xsd:string">ABCabc123</key> <val xsi:type="xsd:string">123456</val> </tns:Item> </soap:Body> </soap:Envelope>
It was easy to see in the source of ext/soap/soap.c that this wasn’t handled properly. Speaking to a Mirek on the PHP soap list that had the same problem led to Mirek submitting this as bug 30994. Shortly after I added some more information to the bug. One week after submitting the bug it was fixed and is now included in the PHP 5.0.3 release together with many more bug fixes.
It is great to see open source projects usually fix bugs quicker than companies charging tens of thousands of dollars per year and license. It is just amazing how people can complain about “lack of support” in projects like PHP.
To be honest I haven’t had time to test it but I’m sure it’ll work. I mean – it is open source.
If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.
