Re: help with soapvar and xml list

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

 



$params->SecurityToken = new SoapVar($sectoken, XSD_STRING, 'string', "http://www.w3.org/2001/XMLSchema";); $params->DepartureDateTime = new SoapVar('2007-06-06', XSD_STRING, 'string', "http://www.w3.org/2001/XMLSchema";); $params->DepAirportCode = new SoapVar('BOI', XSD_STRING, 'string', "http://www.w3.org/2001/XMLSchema";);
$client = new SoapClient('file.wsdl');
$airresult = $client->OFSByAirportPairPerHour($air);
$airport = $airresult->OFSByAirportPairPerHourResult;


It all depends on if you REALLY need to use SoapVars.

Without SoapVars it is very simple:

 $params->CarrierCodeFilterList = new StdClass();
 $params->CarrierCodeFilterList->CarrierCode = array("string1", "string2");

If you have to use SoapVars (which is not always - in fact I found using SoapVars necessary only where ComplexType with extensions were used in WSDL - rare thing):

$carrierCode1 = new SoapVar("string1", XSD_STRING, "string", "http://www.w3.org/2001/XMLSchema";); $carrierCode2 = new SoapVar("string1", XSD_STRING, "string", "http://www.w3.org/2001/XMLSchema";);

 $carrierCodeFilterList = new StdClass();
 $carrierCodeFilterList->CarrierCode = array($carrierCode1, $carrierCode2);

$params->CarrierCodeFilterList = new SoapVar($carrierCodeFilterList, SOAP_ENC_OBJECT, "CarrierCodeFilterList", "http://ws.oag.com";);


The main trick is to use arrays where some element is defined with maxOccurs > 1 in WSDL. (I guessed type name of CarrierCodeFilterList - it should be easily found in WSDL. I'm not sure what should be there if it is an anonymous type)

Hope it helps (I didn't test the code above).

--
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