Hi all,
I'm a newbie in PHP trying to move away from the .net platform. I seem to have run into my first challenge passing a complex type back to my web service. The web service is a live test site to test against. I've tested the service on .net and it works fine...but I think I'm missing something as I try porting over to PHP?
I've written some short code to keep it simple:
<?php
$SearchCriteria = array("ObjectType"=>1);
$parameters['user'] = "johndoe1";
$parameters['password'] = "snowball";
$parameters['SearchCriteria'] = $SearchCriteria ;
$client = new SoapClient("https://servicestest.mcquaig.com/mws.asmx?WSDL");
$result = $client->__soapCall('Find', $parameters);
?>
....against this portion of XML:
<s:element name="Find">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="user" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="password" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="criteria" type="tns:SearchCriteria"/>
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="SearchCriteria">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="AccountName" type="s:string"/>
<s:element minOccurs="1" maxOccurs="1" name="ApplySharing" type="s:boolean"/>
<s:element minOccurs="1" maxOccurs="1" name="CGType" type="s:int"/>
<s:element minOccurs="0" maxOccurs="1" name="ClientRefID" type="s:string"/>
<s:element minOccurs="1" maxOccurs="1" name="Composites" type="s:int"/>
<s:element minOccurs="0" maxOccurs="1" name="ConfNo" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Email" type="s:string"/>
<s:element minOccurs="1" maxOccurs="1" name="Expired" type="s:int"/>
<s:element minOccurs="1" maxOccurs="1" name="ExpiryTSA" type="s:dateTime"/>
<s:element minOccurs="1" maxOccurs="1" name="ExpiryTSZ" type="s:dateTime"/>
<s:element minOccurs="0" maxOccurs="1" name="FirstName" type="s:string"/>
<s:element minOccurs="1" maxOccurs="1" name="FormLangID" type="s:unsignedLong"/>
<s:element minOccurs="1" maxOccurs="1" name="FunctionalArea" type="s:int"/>
<s:element minOccurs="1" maxOccurs="1" name="Gender" type="s:int"/>
<s:element minOccurs="1" maxOccurs="1" name="Industry" type="s:int"/>
<s:element minOccurs="0" maxOccurs="1" name="JobTitle" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="LastName" type="s:string"/>
<s:element minOccurs="1" maxOccurs="1" name="LastUsedTSA" type="s:dateTime"/>
<s:element minOccurs="1" maxOccurs="1" name="LastUsedTSZ" type="s:dateTime"/>
<s:element minOccurs="1" maxOccurs="1" name="NoRelated" type="s:boolean"/>
<s:element minOccurs="1" maxOccurs="1" name="ObjectType" type="s:int"/>
<s:element minOccurs="1" maxOccurs="1" name="OrgID" type="s:unsignedLong"/>
<s:element minOccurs="1" maxOccurs="1" name="Position" type="s:int"/>
<s:element minOccurs="1" maxOccurs="1" name="ProfileType" type="s:int"/>
<s:element minOccurs="1" maxOccurs="1" name="Recursive" type="s:boolean"/>
<s:element minOccurs="1" maxOccurs="1" name="Status" type="s:int"/>
<s:element minOccurs="1" maxOccurs="1" name="Type" type="s:int"/>
<s:element minOccurs="1" maxOccurs="1" name="UnitsRemain" type="s:int"/>
<s:element minOccurs="1" maxOccurs="1" name="UnitsRemainGT" type="s:boolean"/>
</s:sequence>
</s:complexType>
Nothing I seem to do works. I end up with the same error:
Uncaught SoapFault exception: [soap:Server] Server was unable to process request. ---> Value does not fall within the expected range.
Using NuSoap as:
<?php
require_once('lib/nusoap.php');
$SearchCriteria = array("ObjectType"=>1);
$wsdlURL = "https://servicestest.mcquaig.com/mws.asmx?WSDL";
$soap = new nusoap_client($wsdlURL);
$parameters['user'] = "johndoe1";
$parameters['password'] = "snowball";
$parameters['criteria'] = $SearchCriteria ;
$result = $soap->call("Find", $parameters);
if($error = $soap->getError()){ die($error);}
?>
I get this error:
soap:Client: Server did not recognize the value of HTTP Header SOAPAction: .
I'm stumped and sure it's something small, but I just don't see what I'm missing?? Any suggestions are greatly appreciated!!
Gary