views:

33

answers:

1

I'm making an identical SOAP Request, one using the Zend Framework and the other not. The Zend one is not working and the only difference seems to be the envelope namespace.

How is the envelope set and why would one of them fail?

Zend Soap Call

<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://wsapi" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:enc="http://www.w3.org/2003/05/soap-encoding"&gt;
<env:Body>
<ns1:incomingRequest env:encodingStyle="http://www.w3.org/2003/05/soap-encoding"&gt;
<username xsi:type="xsd:string">myuser</username>
<password xsi:type="xsd:string">mypass</password>
<request xsi:type="xsd:string">&amp;lt;incoming-requests&amp;gt;&amp;lt;request description="getEmailMessageStatus"&amp;gt;&amp;lt;incoming-data&amp;gt;&amp;lt;email-message messageID="messageID"/&amp;gt;&amp;lt;/incoming-data&amp;gt;&amp;lt;/request&amp;gt;&amp;lt;/incoming-requests&amp;gt;</request>
</ns1:incomingRequest>
</env:Body>
</env:Envelope>

PHP Soap Call

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://wsapi" 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:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;
<SOAP-ENV:Body>
<ns1:incomingRequest>
<username xsi:type="xsd:string">myuser</username>
<password xsi:type="xsd:string">mypass</password>
<request xsi:type="xsd:string">&lt;incoming-requests&gt;&lt;request description="getEmailMessageStatus"&gt;&lt;incoming-data&gt;&lt;email-message messageID="messageID"/&gt;&lt;/incoming-data&gt;&lt;/request&gt;&lt;/incoming-requests&gt;</request>
</ns1:incomingRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope> 
+1  A: 

I've figured this out.

It turns out, the Soap server is only compatible with SOAP version 1.1.

In Zend, you can specify the version like so:

$client = new Zend_Soap_Client('wsdl url', array('soap_version' => SOAP_1_1));

This changed the envelope and the Soap server began responding as it should.

jmcginnis