Re: help with soapvar and xml list

From: Date: Mon, 11 Jun 2007 16:06:12 +0000
Subject: Re: help with soapvar and xml list
References: 1  Groups: php.soap 
Request: Send a blank email to php-soap+get-2558@lists.php.net to get a copy of this message
$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).

« previous php.soap (#2558) next »