Flight Info "bad request" error on response

I’m getting a bad request response trying to test the service.

I’m using SoapClient for mac from ditchnet.org/soapclient/

The request I’m sending is:



Soapaction: FlightAwareDirectFlight
User-Agent: Mac OS X; WebServicesCore (352)
Authorization: Basic *********
Host: directflight.flightaware.com
Content-Type: text/xml


<?xml version="1.0" encoding="utf-8"?>
  <SOAP-ENV: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:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
      <SOAP-ENV:Body>
        <m:FlightInfo xmlns:m="http://directflight.flightaware.com/soap/DirectFlight">
          <ident xsi:type="xsd:string">ACA101</ident>
          <howMany xsi:type="xsd:int">1</howMany>
        </m:FlightInfo>
      </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>


And the response is



HTTP/1.1 400 Bad Request
Date: Tue, 26 Jan 2010 02:01:38 GMT
Content-Type: text/html
Content-Length: 147
Server: Tcl-Webserver/3.5.1 May 27, 2004
Connection: Close




    <title>Httpd_Error: 400</title>

    Got the error <b>Bad Request</b><br>

    while trying to obtain <b>/soap/DirectFlight/go</b>.

<br> :  


Any ideas whats going on here?

I added content-type: text/xml and got a different response:



HTTP/1.1 200 Data follows
Date: Tue, 26 Jan 2010 03:06:01 GMT
Content-Type: text/html
Content-Length: 3775
Server: Tcl-Webserver/3.5.1 May 27, 2004
Connection: Close


<!Doctype HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<Html>
<Head>
<Title>Server Error</Title>
<!-- Author: bwelch -->
<META HTTP-Equiv=Editor Content="SunLabs WebTk 1.0demo 3/10/97">
</Head>
<Body>



<h1>Server Error</h1>
<h4>Mon Jan 25 22:06:01 EST 2010</h4>
<p>
The server encountered an internal error when handling your page.
<p>
Tcl-Webserver/3.5.1 May 27, 2004<br>Tcl version 8.4.18
<p>
<form action=/mail/bugreport method=post>
<input type=hidden name=errorInfo value="can't read "accounttype": no such variable
    while executing
"list $auth $id $user_id $accounttype $is_sua_customer"
    (procedure "flightaware_billing_directFlight_authenticate" line 29)
    invoked from within
"flightaware_billing_directFlight_authenticate $username $key"
    (procedure "DirectFlight_Authenticate" line 50)
    invoked from within
"DirectFlight_Authenticate sock17 /soap/DirectFlight/go"
    ("eval" body line 1)
    invoked from within
"eval $hook [list $sock $url]"">
<input type=hidden name=env value="STY 950.ttyp0.juliet HOME /usr/home/karl LOGNAME root PWD /usr/local/tclhttpd/custom MAIL /var/mail/karl SSH_CLIENT {216.52.171.95 63997 22} SUDO_UID 1001 SUDO_GID 1001 BLOCKSIZE K SSH_AUTH_SOCK /tmp/ssh-3vqK5JsPzP/agent.762 HTTP_CHANNEL sock17 CVS_RSH ssh WINDOW 0 FTP_PASSIVE_MODE YES TERM screen SHELL /usr/local/bin/bash CVSROOT cvs.flightaware.com:/usr/home/cvs SHLVL 4 SUDO_COMMAND {/usr/local/bin/tclsh8.4 /usr/local/bin/httpd.tcl -debug 1} SUDO_USER karl OLDPWD /usr/local/tclhttpd/custom PGCLIENTENCODING UNICODE SSH_CONNECTION {216.52.171.95 63997 216.52.171.102 22} PATH /sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin:/usr/home/karl/bin TZ EST5EDT SSH_TTY /dev/ttyp0 _ /usr/local/bin/sudo EDITOR vi LC_ALL C USER root PAGER less">
<input type=hidden name=email value=webmaster@juliet.flightaware.com>
<input type=submit value="Submit auto bug report to webmaster@juliet.flightaware.com">
</form>
<p>
<p>
<form action=/debug/errorInfo method=post>
<input type=hidden name=errorInfo value="can't read "accounttype": no such variable
    while executing
"list $auth $id $user_id $accounttype $is_sua_customer"
    (procedure "flightaware_billing_directFlight_authenticate" line 29)
    invoked from within
"flightaware_billing_directFlight_authenticate $username $key"
    (procedure "DirectFlight_Authenticate" line 50)
    invoked from within
"DirectFlight_Authenticate sock17 /soap/DirectFlight/go"
    ("eval" body line 1)
    invoked from within
"eval $hook [list $sock $url]"">
<input type=hidden name=env value="STY 950.ttyp0.juliet HOME /usr/home/karl LOGNAME root PWD /usr/local/tclhttpd/custom MAIL /var/mail/karl SSH_CLIENT {216.52.171.95 63997 22} SUDO_UID 1001 SUDO_GID 1001 BLOCKSIZE K SSH_AUTH_SOCK /tmp/ssh-3vqK5JsPzP/agent.762 HTTP_CHANNEL sock17 CVS_RSH ssh WINDOW 0 FTP_PASSIVE_MODE YES TERM screen SHELL /usr/local/bin/bash CVSROOT cvs.flightaware.com:/usr/home/cvs SHLVL 4 SUDO_COMMAND {/usr/local/bin/tclsh8.4 /usr/local/bin/httpd.tcl -debug 1} SUDO_USER karl OLDPWD /usr/local/tclhttpd/custom PGCLIENTENCODING UNICODE SSH_CONNECTION {216.52.171.95 63997 216.52.171.102 22} PATH /sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin:/usr/home/karl/bin TZ EST5EDT SSH_TTY /dev/ttyp0 _ /usr/local/bin/sudo EDITOR vi LC_ALL C USER root PAGER less">
<input type=hidden name=title value="Error Info">
<input type=submit value="See the error info">
</form>
<p>
<a HREF=mailto:webmaster@juliet.flightaware.com>Send email to webmaster@juliet.flightaware.com</a>.
<p>
<a HREF="/index.html">Home</a>

</Body>
</Html>



POST /soap/DirectFlight/go HTTP/1.1
Host: directflight.flightaware.com
Connection: Keep-Alive
User-Agent: PHP-SOAP/5.3.1
Content-Type: text/xml; charset=utf-8
SOAPAction: “FlightAwareDirectFlight”
Content-Length: 545
Authorization: Basic *******


<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="FlightAwareDirectFlight" 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:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:FlightInfo><ident xsi:type="xsd:string">ACA101</ident><howMany xsi:type="xsd:int">1</howMany></ns1:FlightInfo></SOAP-ENV:Body></SOAP-ENV:Envelope>

HTTP/1.1 200 Data follows
Date: Tue, 02 Feb 2010 03:35:34 GMT
Server: Tcl-Webserver/3.5.1 May 27, 2004
Content-Type: text/xml
Content-Length: 2134


<?xml version='1.0'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/' xmlns:FlightAwareDirectFlight='http://directflight.flightaware.com/soap/DirectFlight'><SOAP-ENV:Body><ns:FlightInfoResponse xmlns:ns='FlightAwareDirectFlight' SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'><return xsi:type='FlightAwareDirectFlight:FlightInfoStruct'><next_offset xsi:type='xsd:int'>1</next_offset><flights xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/' xsi:type='SOAP-ENC:Array' SOAP-ENC:offset='[0]' SOAP-ENC:arrayType='FlightAwareDirectFlight:FlightStruct[1]'><item xsi:type='FlightAwareDirectFlight:FlightStruct'><ident xsi:type='xsd:string'>ACA101</ident><aircrafttype xsi:type='xsd:string'>B763</aircrafttype><filed_ete xsi:type='xsd:string'>04:32:00</filed_ete><filed_time xsi:type='xsd:int'>1265043604</filed_time><filed_departuretime xsi:type='xsd:int'>1265130960</filed_departuretime><filed_airspeed_kts xsi:nil='true' xsi:type='xsd:int'></filed_airspeed_kts><filed_airspeed_mach xsi:nil='true' xsi:type='xsd:string'></filed_airspeed_mach><filed_altitude xsi:nil='true' xsi:type='xsd:int'></filed_altitude><route xsi:type='xsd:string'>CALON V36 BIGBE YVV J531 SSM J500 VBI YWG YDR YYN J500 YDC J504 BOOTH MDOWS1</route><actualdeparturetime xsi:type='xsd:int'>0</actualdeparturetime><estimatedarrivaltime xsi:type='xsd:int'>1265147280</estimatedarrivaltime><actualarrivaltime xsi:type='xsd:int'>0</actualarrivaltime><diverted xsi:nil='true' xsi:type='xsd:string'></diverted><origin xsi:type='xsd:string'>CYYZ</origin><destination xsi:type='xsd:string'>CYVR</destination><originName xsi:type='xsd:string'>Lester B. Pearson Intl</originName><originCity xsi:type='xsd:string'>Toronto, </originCity><destinationName xsi:type='xsd:string'>Vancouver Intl</destinationName><destinationCity xsi:type='xsd:string'>Vancouver, </destinationCity></item></flights></return></ns:FlightInfoResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

Is what I get…

Are you still having problems, or did bentomblin’s sample output help you?

That “can’t read “accounttype”: no such variable” error would previously occur if the username/apikey were incorrect. Note that you need to supply an “apikey” (not your FlightAware password)… though I’ve fixed that error message, so you won’t get that same message anymore. To get an API key, visit flightaware.com/commercial/flightxml/key