hi
I wonder if you could help me query a SOAP API. I have all the documentation and passwords, but this isn’t a lot of good when you’re stuck at first base. OK here’s a snapshot of my WSDL file:
[CODE]
#14
<!– User authentication –>
<element name=”UserAuthentication”>
<complexType>
<sequence>
<element name=”iId” type=”xsd:int” />
<element name=”sPassword” type=”xsd:string” />
<element name=”sType” type=”api:UserType” />
</sequence>
</complexType>
</element>
# 663
<operation name=”getProductList”>
<soap:operation soapAction=”” />
<input>
<soap:header message=”api:UserAuthentication” part=”parameters” use=”literal” />
<soap:header message=”api:getQuotaRequest” part=”parameters” use=”literal” />
<soap:body use=”literal” />
</input>
<output>
<soap:header message=”api:getQuotaResponse” part=”return” use=”literal” />
<soap:body use=”literal” />
</output>
<fault name=”ApiException”>
<soap:fault name=”ApiException” use=”literal” />
</fault>
</operation>
<!– MESSAGES –>
<!– Headers –>
<message name=”UserAuthentication”>
<part name=”parameters” element=”api:UserAuthentication” />
</message>
<!– Product List –>
<element name=”getProductList”>
<complexType>
<sequence>
<element name=”sQuery” type=”xsd:string” minOccurs=”0″ />
<element name=”bAdult” type=”xsd:boolean” minOccurs=”0″ />
<element name=”bHotPick” type=”xsd:boolean” minOccurs=”0″ />
<element name=”bIncludeTree” type=”xsd:boolean” minOccurs=”0″ />
<element name=”sSort” type=”api:ProductListSortOption” minOccurs=”0″ />
<element name=”iOffset” type=”xsd:int” minOccurs=”0″ />
<element name=”iLimit” type=”xsd:int” minOccurs=”0″ />
<element name=”oActiveRefineByGroup” minOccurs=”0″ maxOccurs=”unbounded” type=”api:RefineByGroup” />
<element name=”iLimitRefineBy” type=”xsd:int” minOccurs=”0″ />
</sequence>
</complexType>
</element>
I’m only interested in the
[code=php]
[17] => struct getProductList {
string sQuery;
boolean bAdult;
boolean bHotPick;
boolean bIncludeTree;
ProductListSortOption sSort;
int iOffset;
int iLimit;
RefineByGroup oActiveRefineByGroup;
int iLimitRefineBy;
}
[code=php]getProductList()
method from the API.
Just to start with, I am correct to kick off with:
[code=php]
$client = new SoapClient(“http://api.example.com/v2/Example?wsdl”,
array(
‘iId’ => 123456,
‘sPassword’ => ‘gkgkgkgkgkgkgkkgkgkggkkgkgkgkg’,
‘sType’ => ‘fhfhfhfhhfhffhfhfhhffhhfhfhfhfhfh’));
Is this right? I mean from the error message ‘Authentication Failed’ I’m thinking something is missing at this point. Moreover the rest of the script:
[code=php]
$oRefineByDefinition = new stdClass();
$oRefineByDefinition->sId = 1203;
$oRefineByDefinition->sName = ”;
$oRefineBy->oRefineByDefinition = $oRefineByDefinition;
$aParams7 = array(
“sQuery” => “jeans”,
“bAdult” => 0,
“iOffset” => 0,
“iLimit” => 30,
//”oActiveRefineByGroup” => $oRefineBy,
“sColumnToReturn” => array(“sDescription”,”sBrand”));
$products = $client->getProductList($aParams7);
print_r($products);
fails to execute?