xsi:type or maybe SoapVar misuse?
| From: | Andrew Ettinger | Date: | Mon, 30 Apr 2007 23:20:53 +0000 |
| Subject: | xsi:type or maybe SoapVar misuse? | ||
| Groups: | php.soap | ||
| Request: | Send a blank email to php-soap+get-2528@lists.php.net to get a copy of this message | ||
I'm pretty sure what I'm up against now is a namespace issue and/or a misunderstanding of how to use SoapVar.
From the NetSuite docs, the request should look something like:
<soapenv:Body>
<search xmlns="urn:messages_2_5.platform.webservices.netsuite.com">
<searchRecord xsi:type="ns1:ContactSearch" xmlns:ns1="urn:relationships_2_5.lists.webservices.netsuite.com">
<ns1:customerJoin xsi:type="ns2:CustomerSearchBasic" xmlns:ns2="urn:common_2_5.platform.webservices.netsuite.com">
<ns2:internalId operator="anyOf" xsi:type="ns3:SearchMultiSelectField" xmlns:ns3="urn:core_2_5.platform.webservices.netsuite.com">
<ns3:searchValue internalId="1" type="customer" xsi:type="ns3:RecordRef"/ >
</ns2:internalId>
</ns1:customerJoin>
</searchRecord>
</search>
</soapenv:Body>
But what I'm actually requesting looks like:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:messages_2_5.platform.webservices.netsuite.com">
<SOAP-ENV:Body>
<ns1:search>
<customerJoin>
<internalId>
<operator>anyOf</operator>
<searchValue>1</searchValue>
</internalId>
</customerJoin>
</ns1:search>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
The code to do so looks something along the lines of:
$ssr = new SOAPContactSearch();
$ssr->customerJoin = new SOAPCustomerSearchBasic();
$ssr->customerJoin->internalId = new SOAPSearchMultiSelectField();
$ssr->customerJoin->internalId->operator = SOAPSearchMultiSelectFieldOperator::$anyOf;
$ssr->customerJoin->internalId->searchValue = "1";
$param = new SoapVar($ssr, SOAP_ENC_OBJECT);
$search_result = $netsuite_service->search($param); // $netsuite_service extends SoapClient, naturally
The generated error is:
org.xml.sax.SAXException: Unable to marshall between XML and Castor Objects :unable to find FieldDescriptor for 'internalId' in ClassDescriptor of SearchRecord
I assume I'm using SoapVar() incorrectly or this is a namespace issue (like I'm not specifying xsi:type)???
Thanks for any help!
~ Andrew