You are here:  » XML Format


XML Format

Submitted by baggagepin on Fri, 2011-07-29 11:42 in

Hi David,

Could you help me out with choosing the correct format for the following file.

I have tried and tried again but cannot get a result.

Many thanks in advince.

Dereck

- <!-- Return Code: 0
  -->
- <FIMSStatusResponse SendDateTime="2011-07-29T06:14:48" FeedStatus="ok" FeedSource="StatusSchedule">
- <FlightStatus LastUpdTran="0" LastUpdDateTime="" UTCLOCInd="LOC">
- <FlightInfo TransId="-1962635221">
- <CarrierInfo>
  <Carrier CarrierCd="AF">Air France</Carrier>
  </CarrierInfo>
  <FlightDesig>AF1381</FlightDesig>
- <Leg Datasource="OFS">
- <EquipInfo>
  <EquipType Schd="32S" Change="N" />
  </EquipInfo>
- <Depart>
  <City CityCd="LON">London</City>
  <Apt AptCd="LHR">London Heathrow Apt</Apt>
  <Trm Schd="4" Change="N" />
  <DateTime Schd="2011-07-29T06:40:00" Est="2011-07-29T06:40:00" Act="2011-07-29T07:41:00" Change="Y" />
  <OffBlock Act="2011-07-29T07:41:00" Change="Y" />
- <Delay>
  <Status StatusCd="DY">Delayed</Status>
  <Detail DetailCd="OUT">Departed out of the gate</Detail>
  <Category CatId="6">None</Category>
  </Delay>
  </Depart>
- <Arrive>
  <City CityCd="PAR">Paris</City>
  <Apt AptCd="CDG">Paris Charles de Gaulle Apt</Apt>
  <Trm Schd="2E" Change="N" />
  <DateTime Schd="2011-07-29T08:55:00" Est="2011-07-29T08:55:00" Act="2011-07-29T09:34:00" Change="Y" />
  <OnBlock Act="2011-07-29T09:34:00" Change="Y" />
- <Delay>
  <Status StatusCd="DY">Delayed</Status>
  <Detail DetailCd="IN">Arrived in the gate</Detail>
  <Category CatId="6">None</Category>
  </Delay>
  </Arrive>
  <ServiceType SvcTypeCd="J">Passenger - Normal Service</ServiceType>
  <CodeShare Type="3" Seq="1" Desig="AF" DesigName="Air France" />
  <CodeShare Type="4" Seq="2" Desig="AF" DesigName="Air France" />
  <CodeShare Type="5" Seq="3" Desig="AF" DesigName="Air France" />
  </Leg>
  </FlightInfo>
- <FlightInfo TransId="-1962635220">
- <CarrierInfo>
  <Carrier CarrierCd="AM">Aeromexico</Carrier>
  </CarrierInfo>
  <FlightDesig>AM6021</FlightDesig>
- <Leg Datasource="OFS">
- <EquipInfo>
  <EquipType Schd="320" Change="N" />
  </EquipInfo>
- <Depart>
  <City CityCd="LON">London</City>
  <Apt AptCd="LHR">London Heathrow Apt</Apt>
  <Trm Schd="4" Change="N" />
  <DateTime Schd="2011-07-29T06:40:00" Est="2011-07-29T06:40:00" Act="2011-07-29T07:41:00" Change="Y" />
  <OffBlock Act="2011-07-29T07:41:00" Change="Y" />
- <Delay>
  <Status StatusCd="DY">Delayed</Status>
  <Detail DetailCd="OUT">Departed out of the gate</Detail>
  <Category CatId="6">None</Category>
  </Delay>
  </Depart>
- <Arrive>
  <City CityCd="PAR">Paris</City>
  <Apt AptCd="CDG">Paris Charles de Gaulle Apt</Apt>
  <Trm Schd="2E" Change="N" />
  <DateTime Schd="2011-07-29T08:55:00" Est="2011-07-29T08:55:00" Act="2011-07-29T09:34:00" Change="Y" />
  <OnBlock Act="2011-07-29T09:34:00" Change="Y" />
- <Delay>
  <Status StatusCd="DY">Delayed</Status>
  <Detail DetailCd="IN">Arrived in the gate</Detail>
  <Category CatId="6">None</Category>
  </Delay>
  </Arrive>
  <ServiceType SvcTypeCd="J">Passenger - Normal Service</ServiceType>
  <CodeShare Type="1" Seq="1" Desig="AF" FltNo="1381" DesigName="Air France" />
  <CodeShare Type="3" Seq="2" Desig="AF" DesigName="Air France" />
  <CodeShare Type="6" Seq="3" Desig="AF" DesigName="Air France" />
  </Leg>
  </FlightInfo>
- <FlightInfo TransId="-1962635219">
- <CarrierInfo>
  <Carrier CarrierCd="CZ">China Southern Airlines</Carrier>
  </CarrierInfo>
  <FlightDesig>CZ7010</FlightDesig>
- <Leg Datasource="FAA">
- <EquipInfo>
  <EquipType Schd="321" Change="N" />
  </EquipInfo>
- <Depart>
  <City CityCd="LON">London</City>
  <Apt AptCd="LHR">London Heathrow Apt</Apt>
  <Trm Schd="4" Change="N" />
  <DateTime Schd="2011-07-29T06:40:00" Est="2011-07-29T06:40:00" Act="2011-07-29T07:41:00" Change="Y" />
  <OffBlock Act="2011-07-29T07:41:00" Change="Y" />
- <Delay>
  <Status StatusCd="DY">Delayed</Status>
  <Detail DetailCd="OUT">Departed out of the gate</Detail>
  <Category CatId="6">None</Category>
  </Delay>
  </Depart>
- <Arrive>
  <City CityCd="PAR">Paris</City>
  <Apt AptCd="CDG">Paris Charles de Gaulle Apt</Apt>
  <Trm Schd="2E" Change="N" />
  <DateTime Schd="2011-07-29T08:55:00" Est="2011-07-29T08:55:00" Act="2011-07-29T09:34:00" Change="Y" />
  <OnBlock Act="2011-07-29T09:34:00" Change="Y" />
- <Delay>
  <Status StatusCd="DY">Delayed</Status>
  <Detail DetailCd="IN">Arrived in the gate</Detail>
  <Category CatId="6">None</Category>
  </Delay>
  </Arrive>
  <ServiceType SvcTypeCd="J">Passenger - Normal Service</ServiceType>
  <CodeShare Type="1" Seq="1" Desig="AF" FltNo="1381" DesigName="Air France" />
  <CodeShare Type="3" Seq="2" Desig="AF" DesigName="Air France" />
  <CodeShare Type="6" Seq="3" Desig="AF" DesigName="Air France" />
  </Leg>
  </FlightInfo>
- <FlightInfo TransId="-1962635218">
- <CarrierInfo>
  <Carrier CarrierCd="DL">Delta Air Lines</Carrier>
  </CarrierInfo>
  <FlightDesig>DL8720</FlightDesig>
- <Leg Datasource="OFS">
- <EquipInfo>
  <EquipType Schd="321" Change="N" />
  </EquipInfo>
- <Depart>
  <City CityCd="LON">London</City>
  <Apt AptCd="LHR">London Heathrow Apt</Apt>
  <Trm Schd="4" Change="N" />
  <DateTime Schd="2011-07-29T06:40:00" Est="2011-07-29T06:40:00" Act="2011-07-29T07:41:00" Change="Y" />
  <OffBlock Act="2011-07-29T07:41:00" Change="Y" />
- <Delay>
  <Status StatusCd="DY">Delayed</Status>
  <Detail DetailCd="OUT">Departed out of the gate</Detail>
  <Category CatId="6">None</Category>
  </Delay>
  </Depart>
- <Arrive>
  <City CityCd="PAR">Paris</City>
  <Apt AptCd="CDG">Paris Charles de Gaulle Apt</Apt>
  <Trm Schd="2E" Change="N" />
  <DateTime Schd="2011-07-29T08:55:00" Est="2011-07-29T08:55:00" Act="2011-07-29T09:34:00" Change="Y" />
  <OnBlock Act="2011-07-29T09:34:00" Change="Y" />
- <Delay>
  <Status StatusCd="DY">Delayed</Status>
  <Detail DetailCd="IN">Arrived in the gate</Detail>
  <Category CatId="6">None</Category>
  </Delay>
  </Arrive>
  <ServiceType SvcTypeCd="J">Passenger - Normal Service</ServiceType>
  <CodeShare Type="1" Seq="1" Desig="AF" FltNo="1381" DesigName="Air France" />
  <CodeShare Type="3" Seq="2" Desig="AF" DesigName="Air France" />
  <CodeShare Type="6" Seq="3" Desig="AF" DesigName="Air France" />
  </Leg>
  </FlightInfo>
  </FlightStatus>
  </FIMSStatusResponse>

Submitted by support on Fri, 2011-07-29 12:00

Hi Derek,

Based on the closing tags, have a go with:

xml|FIMSSTATUSRESPONSE/FLIGHTSTATUS/FLIGHTINFO/

Cheers,
David.

Submitted by baggagepin on Mon, 2011-08-01 11:34

Hi David,

Many thanks for your response, and as per usual it worked.

May I be a little bold and ask for your help. I have been given the task of
constructing a SOAP call to retrieve data from an external web source but I
knowledge of SOAP and for that matter XML falls short of what it should be.

I have the code below which should send a request to the server and bring
back a result in XML format. The problem I have, I am not to sure how to
send the request. After reading page after page (Google) I am still in the
dark. Is there any chance you could assist and point me in the right
direction, Should this the code below be embedded in a HTML file or a PHP file.

Many thanks in advance.

Dereck

POST /oagflightstatusinformation.asmx HTTP/1.1
Host: ws.oag.com
Content-Type: text/xml; charset=utf-8
Content-Length: 200
SOAPAction: ""
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    {code saved}
  </soap:Body>
</soap:Envelope>

Submitted by support on Tue, 2011-08-02 09:43

Hi Derek,

The most straight forward way to submit a POST operation is using CURL

http://php.net/manual/en/book.curl.php

Consider the following example, based on the example complete POST data from your comment;

<?php
  
// construct XML body to post in $xml variable
  
$xml "<"."?xml version=\"1.0\" encoding=\"utf-8\"?".">
<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">
  <soap:Body>
    {code saved}
  </soap:Body>
</soap:Envelope>
"
;
  
$headers = array();
  
$headers[] = "SOAPAction: \"\"";
  
$headers[] = "Content-Type: text/xml; charset=utf-8";
  
$headers[] = "Content-Length: ".strlen($xml);
  
$ch curl_init();
  
curl_setopt($ch,CURLOPT_URL,"http://example.com/oagflightstatusinformation.asmx" );
  
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
  
curl_setopt($ch,CURLOPT_POST,1);
  
curl_setopt($ch,CURLOPT_POSTFIELDS,$xml);
  
curl_setopt($ch,CURLOPT_HTTPHEADER,$headers);
  
$response curl_exec($ch);
  
// process $response as required
?>

(note i've removed the actual content from the soap:Body, replace where {code saved} appears above
as required, and don't forget to replace example.com with your actual web service URL)

Hope this helps!
Cheers,
David.

Submitted by baggagepin on Tue, 2011-08-02 12:09

Hi David,

Many many thanks for your help.

I have use the script you kindly provided but I am getting an error:

Parse error: syntax error, unexpected '?' in /home/vhosts/navexorg.com/httpdocs/lhr/test_oag.php on line 3

Any ideas as to what is causing this.

Again, many thanks.

Dereck

Submitted by support on Tue, 2011-08-02 12:19

ooops - corrected above....

The reasons for the strange looking string construction is that the XML declaration actually contains the PHP delimiters, so they need to be broken up!

Cheers,
David.

Submitted by baggagepin on Tue, 2011-08-02 21:20

Hi David,

Many thanks for your help and as always you spot on.

To enable the <SecurityToken> to work I needed to enclose the content into <CDATA></CDATA>.

The end results looks like:

<SecurityToken>
<![CDATA[ {content}]]>
</SecurityToken>

This treated the securitytoken as characters without attempting to interpret them.

Works a treat.

Again, many thanks for your support.

Dereck