I've been given access to a 3rd party API which will let me search for holidays.
I'm trying to create xml which looks like this
<?xml version="1.0" encoding="UTF-8"?>
<FAB_PkgAvailRQ Target="test" Version="2002A" xmlns="????"><SyndicatorInfo SyndicatorId="fabguest" SyndicatorPassword="blah"/><SessionInfo CreateNewSession="true"/><HolidaySearchRequest ResponseTimeoutSecs="120" ExcludeNonBookableSuppliers="true"><ResultSetPreferences SortCode="cost" MaxItems="100"/><InitialViewInfo Offset="0" Length="50"/><SearchCriteria FlightOnly="true" OneWayOnly="false" NumberOfAdults="2" NumberOfChildren="2"><DepartureDateRange StartDate="20041014" EndDate="20041014"/><DepartureAirports><Airport>LGW</Airport></DepartureAirports><DestinationChoice><DestinationAirports><Airport>MAD</Airport></DestinationAirports></DestinationChoice><HolidayDuration MinNumberOfNights="7" MaxNumberOfNights="7"/></SearchCriteria></HolidaySearchRequest></FAB_PkgAvailRQ>
however I can't seem to get it right, when I use the call command of nusoap($result = $soapclient->call('parent',$parameters, ""); ), it creates a tag called 'parent', no, I either dont want that tag there, or I want to be able to add attributes to the tag, i.e. <parent target="test">
This is the XML code I have so far
<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><parent><FAB_PkgAvailRQ Target="test" Version="2002A"><SyndicateInfo xsi:type="xsd:string" SyndicatorID="fabguest" SyndicatorPassword="blah"></SyndicateInfo><SessionInfo xsi:type="xsd:string" CreateNewSession="True"></SessionInfo><HolidaySearchRequest ResponseTimeoutSecs="120" ExcludeNonBookableSuppliers="True"><ResultSetPreferences xsi:type="xsd:string" SortCode="Cost" MaxItems="100"></ResultSetPreferences><InitialViewInfo xsi:type="xsd:string" Offset="0" Length="50"></InitialViewInfo></HolidaySearchRequest></FAB_PkgAvailRQ></parent></SOAP-ENV:Body></SOAP-ENV:Envelope>
here is the code I'm using so far
$target = "test";
$version = "2002A";
$syndicateid = "fabguest";
$syndicatepassword = "blah";
$createnewsession = "true";
$attributes_FAB_PkgAvailRQ = array(
'Target' => 'test',
'Version' => '2002A'
);
$attributes_SyndicatorInfo = array(
'SyndicatorID' => 'fabguest',
'SyndicatorPassword' => 'blah'
);
$attributes_HolidaySearchRequest = array(
'ResponseTimeoutSecs' => '120',
'ExcludeNonBookableSuppliers' => 'True'
);
$attributes_ResultSetPreferences = array(
'SortCode' => 'Cost',
'MaxItems' => '100'
);
$attributes_InitialViewInfo = array(
'Offset' => '0',
'Length' => '50'
);
$attributes_SessionInfo = array(
'CreateNewSession' => 'True'
);
$params_HolidaySearchRequest = array (
"ResultSetPreferences" => new soapval('ResultSetPreferences',false,'',false,false,$attributes_ResultSetPreferences),
"initialViewInfo" => new soapval('InitialViewInfo',false,'',false,false,$attributes_InitialViewInfo)
);
$params_FAB_PkgAvailRQ = array (
"SynidicateInfo" => new soapval('SyndicateInfo',false,'',false,false,$attributes_SyndicatorInfo),
"SessionInfo" => new soapval('SessionInfo',false,'',false,false,$attributes_SessionInfo),
"HolidaySearchRequest" => new soapval('HolidaySearchRequest',false,$params_HolidaySearchRequest,false,false, $attributes_HolidaySearchRequest)
);
$parameters = array(
"FAB_PkgAvailRQ" => new soapval('FAB_PkgAvailRQ',false,$params_FAB_PkgAvailRQ,false,false,$attributes_FAB_PkgAvailRQ)
);
$soapclient = new soapclient("http://www.???"); // [1]
$result = $soapclient->call('parent',$parameters, "");
$searchtime = $result["searchTime"];
$begin = $start + 1;
$end = $start + $parameters["maxResults"];
$total = $result["estimatedTotalResultsCount"];
echo "<b>Request</b><br>";
echo $soapclient->request;
echo "<br><br><b>Response:</b></br>";
echo $soapclient->response; |
can someone help me?