FlightXML2 -> FlightInfoEx -> offset -> bug?


#1

I’m getting error trying to use FlightInfoEx’s offset parameter.
This code works and returns :next_offset=>“15”



  client.flight_info { |soap| 
    soap.body = { :ident => 'N89WC'} 
  }


and I get error as I add the offset parameter:



  client.flight_info { |soap|
     soap.body = {:offset => 15, :ident => 'N89WC'} 
  }


Data exchange log and SOAP error:



D, [2010-07-25T18:16:54.107196 #60705] DEBUG -- : SOAP request: http://flightxml.flightaware.com/soap/FlightXML2/op
D, [2010-07-25T18:16:54.107358 #60705] DEBUG -- : SOAPAction: FlightXML2:FlightInfo, Content-Type: text/xml;charset=UTF-8
D, [2010-07-25T18:16:54.108922 #60705] DEBUG -- : <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:wsdl="http://flightxml.flightaware.com/soap/FlightXML2" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><wsdl:FlightInfo><offset>15</offset><ident>N89WC</ident></wsdl:FlightInfo></env:Body></env:Envelope>
D, [2010-07-25T18:16:54.527792 #60705] DEBUG -- : SOAP response (status 500):
D, [2010-07-25T18:16:54.527954 #60705] DEBUG -- : <?xml version="1.0"  encoding="utf-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><SOAP-ENV:Fault><SOAP-ENV:faultcode>CLIENT</SOAP-ENV:faultcode><SOAP-ENV:faultstring>no data available</SOAP-ENV:faultstring><SOAP-ENV:detail><e:errorInfo xmlns:e="urn:TclErrorInfo"><errorCode>NONE</errorCode></e:errorInfo></SOAP-ENV:detail></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>


Any idea?

Thanks,
Dmitry


#2

Your debug output seems to show that you’re calling FlightInfo and not FlightInfoEx? You need to use the Ex version if you want to pass the offset argument.


#3

Thanks for pointing that out. I think I finally made it work. There were two more issues though:

  • There seem to by a typo in the name of the parameter, ‘offset’ doesn’t work, but ‘ofset’ does
  • Offset doesn’t work unless I call the SetMaximumResultSize

Thanks,
Dmitry


#4

I can’t find any instances of “ofset” on the server-side, so I think the fact that you changed it be anything other than the correct name is causing that argument to get ignored and is why you are seeing any difference in behavior. I would recommend re-checking your invocation parameters.


#5

Well, here are the logs (skipping authentication and SetMaximumResultSize call, how_many set to 1 to reduce the logs size).
First run with the following parameters (one ‘f’):



:ident => 'N89WC', :how_many => 1, :ofset => 10


It returns proper results with correct next_offset = 11



D, [2010-07-26T15:39:32.541782 #68949] DEBUG -- : SOAP request: http://flightxml.flightaware.com/soap/FlightXML2/op
D, [2010-07-26T15:39:32.541986 #68949] DEBUG -- : SOAPAction: FlightXML2:FlightInfoEx, Content-Type: text/xml;charset=UTF-8
D, [2010-07-26T15:39:32.544287 #68949] DEBUG -- : <?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:wsdl="http://flightxml.flightaware.com/soap/FlightXML2" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
  <env:Body>
    <wsdl:FlightInfoEx>
      <ident>N89WC</ident>
      <howMany>1</howMany>
      <ofset>10</ofset>
    </wsdl:FlightInfoEx>
  </env:Body>
</env:Envelope>

D, [2010-07-26T15:39:33.070238 #68949] DEBUG -- : SOAP response (status 200):
D, [2010-07-26T15:39:33.070550 #68949] DEBUG -- : <?xml version="1.0"  encoding="utf-8"?>
<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:FlightXML2="http://flightxml.flightaware.com/soap/FlightXML2">
  <SOAP-ENV:Body>
    <FlightXML2:FlightInfoExResults>
      <FlightXML2:FlightInfoExResult>
        <FlightXML2:next_offset>11</FlightXML2:next_offset>
        <FlightXML2:flights>
          <FlightXML2:faFlightID>N89WC-1279838081-159-0</FlightXML2:faFlightID>
          <FlightXML2:ident>N89WC</FlightXML2:ident>
          <FlightXML2:aircrafttype>BE30</FlightXML2:aircrafttype>
          <FlightXML2:filed_ete>01:09:00</FlightXML2:filed_ete>
          <FlightXML2:filed_time>1279841411</FlightXML2:filed_time>
          <FlightXML2:filed_departuretime>1279844400</FlightXML2:filed_departuretime>
          <FlightXML2:filed_airspeed_kts>278</FlightXML2:filed_airspeed_kts>
          <FlightXML2:filed_airspeed_mach/>
          <FlightXML2:filed_altitude>210</FlightXML2:filed_altitude>
          <FlightXML2:route>MUSEL6 DAG V587 BLD</FlightXML2:route>
          <FlightXML2:actualdeparturetime>1279845000</FlightXML2:actualdeparturetime>
          <FlightXML2:estimatedarrivaltime>1279848660</FlightXML2:estimatedarrivaltime>
          <FlightXML2:actualarrivaltime>1279848480</FlightXML2:actualarrivaltime>
          <FlightXML2:diverted/>
          <FlightXML2:origin>KSNA</FlightXML2:origin>
          <FlightXML2:destination>KHND</FlightXML2:destination>
          <FlightXML2:originName>John Wayne Arpt</FlightXML2:originName>
          <FlightXML2:originCity>Santa Ana, CA</FlightXML2:originCity>
          <FlightXML2:destinationName>Henderson Executive</FlightXML2:destinationName>
          <FlightXML2:destinationCity>Las Vegas, NV</FlightXML2:destinationCity>
        </FlightXML2:flights>
      </FlightXML2:FlightInfoExResult>
    </FlightXML2:FlightInfoExResults>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>


Second try is exactly the same but two 'f’s in offset:



D, [2010-07-26T15:44:29.458054 #69102] DEBUG -- : SOAP request: http://flightxml.flightaware.com/soap/FlightXML2/op
D, [2010-07-26T15:44:29.458203 #69102] DEBUG -- : SOAPAction: FlightXML2:FlightInfoEx, Content-Type: text/xml;charset=UTF-8
D, [2010-07-26T15:44:29.459934 #69102] DEBUG -- : <?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:wsdl="http://flightxml.flightaware.com/soap/FlightXML2" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
  <env:Body>
    <wsdl:FlightInfoEx>
      <offset>10</offset>
      <ident>N89WC</ident>
      <howMany>1</howMany>
    </wsdl:FlightInfoEx>
  </env:Body>
</env:Envelope>

D, [2010-07-26T15:44:29.895058 #69102] DEBUG -- : SOAP response (status 500):
D, [2010-07-26T15:44:29.895271 #69102] DEBUG -- : <?xml version="1.0"  encoding="utf-8"?>
<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
  <SOAP-ENV:Body>
    <SOAP-ENV:Fault>
      <SOAP-ENV:faultcode>CLIENT</SOAP-ENV:faultcode>
      <SOAP-ENV:faultstring>no data available</SOAP-ENV:faultstring>
      <SOAP-ENV:detail>
        <e:errorInfo xmlns:e="urn:TclErrorInfo">
          <errorCode>NONE</errorCode>
        </e:errorInfo>
      </SOAP-ENV:detail>
    </SOAP-ENV:Fault>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>



#6

The SOAP library you are using (I assume SoapPy?) is actually not generating a correct Document/Literal wrapped request. When our server sees such a malformed request, it falls back to parsing arguments based on order and ignores the XML tag names entirely.

It is just lucky that your first request generates a request with the arguments in the correct order (ident, how_many, offset). Your second request has the arguments out of sequence (offset, ident, how_many), so the request fails for that reason.

The Python suds library (http://fedorahosted.org/suds/) looks like it supports Document/Literal services a little better, if you think you are able to switch to that library instead. I’ve updated flightaware.com/commercial/fligh … ation2.rvt to have an example demonstrating use of Python suds.

I will also investigate changing the fall-back logic that relies on ordering for non-compliant requests, but I don’t have a time estimate on that.


#7

Ah, got it. I’m actually using Ruby and one of the Ruby SOAP libraries that take a hash of parameters. So the problem is that hashes are not sorted in Ruby 1.8 (don’t maintains the keys’ insertion order). I’m going to monkey-patch the lib to accept an Array instead of Hash.

Thanks,
Dmitry


#8

Have you tried the Ruby sample code that is now available on the documentation2 page listed above? An updated “flightxml2-client-ruby” project is also provided by us on github.


#9

No, as it wasn’t there last week. I’ve actually ended up with the following code:



require 'rubygems'
require 'savon'
require 'pp'
URL = 'http://flightxml.flightaware.com/soap/FlightXML2/wsdl'
USERNAME = 'blah-blah'
API_KEY = 'blah-blah'

Savon::Request.log = true
client = Savon::Client.new "http://flightxml.flightaware.com/soap/FlightXML2/wsdl"
client.request.basic_auth USERNAME, API_KEY

pp client.wsdl.soap_actions
pp client.set_maximum_result_size{ |soap| soap.body = { :max_size => 100} }

pp client.flight_info_ex { |soap| soap.body = { :ident => 'N89WC', :how_many => 15, :offset => 10, :order! => :ident, :how_many, :offset]} }



#10

I’ve made a change to our servers to try harder to honor the XML tag names for requests that are improperly formed. The “savon” gem does not appear to be correctly interpreting Document/Literal wrapped WSDL files, but my change should allow it to work regardless of argument ordering.

Your original code (with the mis-ordered arguments and correctly spelled names) should now work, if you’d like to re-test with that.


#11

I’ve updated flightaware.com/commercial/fligh … ation2.rvt to have an example demonstrating Ruby savon.

It didn’t seem necessary for me to use the :astonished:rder! attribute to control the argument sequence now.