Re: New to SOAP and PHP, hopefully simple question :)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



$client = new SoapClient("https://gsx.apple.com/gsxws.wsdl";);

Everything is in WSDL, if you are able to read it.

$test = $client->Authenticate("macnet@mauimac.net", "pass", "24521",
"EN", "PST"); // This works
// code returned from var_dump = object(stdClass)#2 (2)
{ ["instanceID"]=> string(1) "6" ["sessionID"]=> string(22)
"z1AcbmuiCBF5FGKsekgTRM" }

Ok, so you successfully authenticated and have session data.

$test = $client->PartsLookup('PartLookupinfo', $temp);

According to WSDL, this function takes two params: sessionInfo and partLookupInfo. Both are complexTypes - why are you trying to send string instead of first param?

First is equivalent to what you received from Authenticate() function.
You could simply send output of Authenticate() as first param (I would),
but let's do it step-by-step, like the WSDL file says:

 $sessionInfo = new StdClass();
 $sessionInfo->instanceID = "6";
 $sessionInfo->sessionID = "z1AcbmuiCBF5FGKsekgTRM";

Second param contains your query data:

 $partLookupInfo = new StdClass();
 $partLookupInfo->description = "";
 $partLookupInfo->eeeCode = "";
 $partLookupInfo->partNumber = "661-3350";
 $partLookupInfo->productName = "";
 $partLookupInfo->serialNumber = "";

then you can execute the query

 $test = $client->PartsLookup($sessionInfo, $partLookupInfo);

That should do it in terms of correct syntax. Supplying correct data in partLookupInfo is your business - I have no idea what should go there other what WSDL file tells me (and it does only tell that it is complexType with five named strings which have to go in specific order and all are nillable).

Generally, you should operate on objects (StdClass object) whenever you encounter complexType in WSDL file. Arrays can sometimes be used instead, but _only_ associative arrays (e.g. array("description" => "something", "eeeCode" => "blah"...)). I never use arrays - SoapClient always returns objects for complexTypes so I try to be consistent with this behaviour.

Hope this helps.

--
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux