tags:

views:

21

answers:

0

EDIT:

The following two are examples of what works and what doesn't work. I can pass the latter through __doRequest, but I would really rather use the other SOAP related functions (for example they provide a better response, object instead of string). Is there any way using PHP to get the the second example just using arrays, SoapVar, SoapParam, and __call

Throws a Bad Request exception:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://example.com"&gt;
    <SOAP-ENV:Body>
    <ns1:ReadFromDB>
    <ns0:idSecurity>999</ns0:idSecurity>
    <ns0:filters>
    <ns0:FilterType xsi:type="ns0:FilterString">
        <ns0:PropertyId>16</ns0:PropertyId>
        <ns0:Operator>Equal</ns0:Operator>
        <ns0:Value>[email protected]</ns0:Value>
    </ns0:FilterType>
    </ns0:filters>
    <ns0:language>English</ns0:language>
    </ns1:ReadFromDB>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>

Works:

<SOAP-ENV:Envelope xmlns:ns0="http://example.com" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&gt;
<SOAP-ENV:Header/>
<ns1:Body>
<ns0:ReadFromDB>
<ns0:idSecurity>999</ns0:idSecurity>
<ns0:databaseName></ns0:databaseName>
<ns0:filters>
<ns0:FilterType xsi:type="ns0:FilterString">
    <ns0:PropertyId>16</ns0:PropertyId>
    <ns0:Operator>Equal</ns0:Operator>
    <ns0:Value>[email protected]</ns0:Value>
</ns0:FilterType>
</ns0:filters>
<ns0:language>English</ns0:language>
</ns0:ReadFromDB>
</ns1:Body>
</SOAP-ENV:Envelope>

Original Post: I am trying to use PHP Soap with abstract types. I don't have control over the WSDL. Anyway, I have an abstract type GENERAL and a type that extends it called STRING. If I add Stuff in my request, I get a bad request exception from SOAP. If I remove the xsi:type="ns1:GENERAL" I don't get an error, but it also doesn't work. Thanks

$myXml = '<ns1:filters><ns1:filterType xsi:type="ns1:filterString"><ns1:PropertyId>16</ns1:PropertyId><ns1:Operator>Equal</ns1:Operator><ns1:Value>"[email protected]"</ns1:Value></ns1:filterType></ns1:filters>';

$params = array(
    'foo' => new SoapVar('bar', XSD_STRING, 'String', 'http://www.w3.org/2001/XMLSchema-instance'),
    'filters' => new SoapVar($myXml, XSD_ANYXML),
    'idSecurity' => new SoapVar($IdSecurity, XSD_STRING),
    'language' => new SoapVar('English', XSD_STRING),
);

$response = $contacts->functionCall9000($params);