-
Accessing WSI using PHP
Hi Guys
Really hoping someone can help - has anyone successfully managed to access the WSI interface using PHP?
I've spent some time looking for examples but with little success. Any pointers in the right direction or example code to complete the authentication would be really appreciated.
Cheers
Andy
-
Success!
Hi - manage to crack it! and actually has turned out to be a lot simplier than first imagined.
So for those of you in a similar position to me here's some sample code I've used to access the ASPDotNetStoreFront using a PHP SoapClient.
//Location of wsdl
$wsdl='https://staging.myshop.com/ipx.asmx?WSDL';
// Create XML command to retrieve ProductID = 1234
$xml_command = "<AspDotNetStorefrontImport Verbose=\"false\"><GetProduct ID=\"1234\" /></AspDotNetStorefrontImport>";
try {
$client = new SoapClient($wsdl, array("connection_timeout"=>30, "compression" => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP));
//Call any function in the webservice using
$parameters = array(
"AuthenticationEMail" => "my_super_username",
"AuthenticationPassword" => "my_super_password",
"XmlInputRequestString" => $xml_command
);
$result = $client->DoItUsernamePwd($parameters);// Parameters to include only if you need to pass any value.
//process the xml returned
$xml = simplexml_load_string($result->DoItUsernamePwdResult);
echo $xml->GetProduct->Product->Name;
// OR use print_r to view full result
print_r($xml);
} catch (Exception $e) {
// note - to see trace ensure "trace" => 1 in opening SoapClient call
die("exception:" . $e->getMessage() . "\r\n".print_r($e->getTrace(),true));
}
The bit that hexed me was constructing the XML command, at present this is using the DoItUsernamePwd mechanism
I'd prefer to work with DoItWSE as soon as I have this working, shall post my findings.
Hope this helps
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules