Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 2 of 2

Thread: Accessing WSI using PHP

  1. #1
    chillsphere is offline Junior Member
    Join Date
    Jun 2011
    Posts
    2

    Default 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

  2. #2
    chillsphere is offline Junior Member
    Join Date
    Jun 2011
    Posts
    2

    Default 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