# FlightXML2 -\> FlightInfoEx -\> offset -\> bug?

**URL:** <https://discussions.flightaware.com/t/flightxml2-flightinfoex-offset-bug/10405>\
**Category:** AeroAPI\
**Created:** [July 26, 2010, 12:25am UTC](https://discussions.flightaware.com/t/flightxml2-flightinfoex-offset-bug/10405 "2010-07-26T00:25:39Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmitryv](https://avatars.discourse-cdn.com/v4/letter/d/4491bb/32.png) [@dmitryv](https://discussions.flightaware.com/u/dmitryv)\
**Post date:** [July 26, 2010, 12:25am UTC](https://discussions.flightaware.com/t/flightxml2-flightinfoex-offset-bug/10405/1 "2010-07-26T00:25:39Z")

</div>

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

```auto

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

```

and I get error as I add the offset parameter:

```auto

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

```

Data exchange log and SOAP error:

```auto

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

---

<div class="post-metadata">

**Author:** ![bovineone](https://sea1.discourse-cdn.com/flex019/user_avatar/discussions.flightaware.com/bovineone/32/117631_2.png) [@bovineone](https://discussions.flightaware.com/u/bovineone)\
**Post date:** [July 26, 2010, 4:33pm UTC](https://discussions.flightaware.com/t/flightxml2-flightinfoex-offset-bug/10405/2 "2010-07-26T16:33:24Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dmitryv](https://avatars.discourse-cdn.com/v4/letter/d/4491bb/32.png) [@dmitryv](https://discussions.flightaware.com/u/dmitryv)\
**Post date:** [July 26, 2010, 9:25pm UTC](https://discussions.flightaware.com/t/flightxml2-flightinfoex-offset-bug/10405/3 "2010-07-26T21:25:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bovineone](https://sea1.discourse-cdn.com/flex019/user_avatar/discussions.flightaware.com/bovineone/32/117631_2.png) [@bovineone](https://discussions.flightaware.com/u/bovineone)\
**Post date:** [July 26, 2010, 9:36pm UTC](https://discussions.flightaware.com/t/flightxml2-flightinfoex-offset-bug/10405/4 "2010-07-26T21:36:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dmitryv](https://avatars.discourse-cdn.com/v4/letter/d/4491bb/32.png) [@dmitryv](https://discussions.flightaware.com/u/dmitryv)\
**Post date:** [July 26, 2010, 9:48pm UTC](https://discussions.flightaware.com/t/flightxml2-flightinfoex-offset-bug/10405/5 "2010-07-26T21:48:31Z")

</div>

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’):

```auto

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

```

It returns proper results with correct next\_offset = 11

```auto

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:

```auto

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>

```

---

<div class="post-metadata">

**Author:** ![bovineone](https://sea1.discourse-cdn.com/flex019/user_avatar/discussions.flightaware.com/bovineone/32/117631_2.png) [@bovineone](https://discussions.flightaware.com/u/bovineone)\
**Post date:** [July 26, 2010, 11:12pm UTC](https://discussions.flightaware.com/t/flightxml2-flightinfoex-offset-bug/10405/6 "2010-07-26T23:12:58Z")

</div>

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/](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](http://flightaware.com/commercial/flightxml/documentation2.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.

---

<div class="post-metadata">

**Author:** ![dmitryv](https://avatars.discourse-cdn.com/v4/letter/d/4491bb/32.png) [@dmitryv](https://discussions.flightaware.com/u/dmitryv)\
**Post date:** [July 26, 2010, 11:44pm UTC](https://discussions.flightaware.com/t/flightxml2-flightinfoex-offset-bug/10405/7 "2010-07-26T23:44:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bovineone](https://sea1.discourse-cdn.com/flex019/user_avatar/discussions.flightaware.com/bovineone/32/117631_2.png) [@bovineone](https://discussions.flightaware.com/u/bovineone)\
**Post date:** [July 27, 2010, 5:03am UTC](https://discussions.flightaware.com/t/flightxml2-flightinfoex-offset-bug/10405/8 "2010-07-27T05:03:33Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dmitryv](https://avatars.discourse-cdn.com/v4/letter/d/4491bb/32.png) [@dmitryv](https://discussions.flightaware.com/u/dmitryv)\
**Post date:** [July 27, 2010, 5:41am UTC](https://discussions.flightaware.com/t/flightxml2-flightinfoex-offset-bug/10405/9 "2010-07-27T05:41:12Z")

</div>

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

```auto

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

```

---

<div class="post-metadata">

**Author:** ![bovineone](https://sea1.discourse-cdn.com/flex019/user_avatar/discussions.flightaware.com/bovineone/32/117631_2.png) [@bovineone](https://discussions.flightaware.com/u/bovineone)\
**Post date:** [July 27, 2010, 8:49pm UTC](https://discussions.flightaware.com/t/flightxml2-flightinfoex-offset-bug/10405/10 "2010-07-27T20:49:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![bovineone](https://sea1.discourse-cdn.com/flex019/user_avatar/discussions.flightaware.com/bovineone/32/117631_2.png) [@bovineone](https://discussions.flightaware.com/u/bovineone)\
**Post date:** [August 3, 2010, 10:27pm UTC](https://discussions.flightaware.com/t/flightxml2-flightinfoex-offset-bug/10405/11 "2010-08-03T22:27:33Z")

</div>

I’ve updated [flightaware.com/commercial/fligh … ation2.rvt](http://flightaware.com/commercial/flightxml/documentation2.rvt) to have an example demonstrating Ruby savon.

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