Search function


#1

I’m excited to get this system operational as I have a good application of the DirectFlight data. I’ve managed to configure SOAP and have run several successful queries against the DirectFlight database, including Enroute and METAR. I have not yet been able to get Search to work, however; It returns an error message in the query.

Here’s the code I’m using as an example:



// After SOAP initialization
$result = $soap->Search('-destination KCMH');


I get the following var dump from the query:


object(soap_fault)(8) { "error_message_prefix"]=>  string(0) "" "mode"]=>  int(1) "level"]=>  int(1024) "code"]=>  string(4) "NONE" "message"]=>  string(505) "wrong # args: type InFlightStruct contains " ident string prefix string type string suffix string origin string destination string timeout string timestamp int firstPositionTime int longitude float latitude float groundspeed int altitude int heading int altitudeStatus string updateType string altitudeChange string "" "userinfo"]=>  object(stdClass)(1) { "errorInfo"]=>  &object(stdClass)(2) { "errorCode"]=>  string(4) "NONE" "stackTrace"]=>  string(843) "wrong # args: type InFlightStruct contains " ident string prefix string type string suffix string origin string destination string timeout string timestamp int firstPositionTime int longitude float latitude float groundspeed int altitude int heading int altitudeStatus string updateType string altitudeChange string " while executing "insert_value $d_elt [rpcvar "$itemtype$final" $elt]" (procedure "SOAP::insert_value" line 116) invoked from within "SOAP::insert_value $retnode $result" (procedure "SOAP::reply" line 17) invoked from within "SOAP::reply [dom::DOMImplementation create] $methodNamespace "${methodName}Response" $msg"" } } "backtrace"]=>  array(7) { [0]=>  array(6) { "file"]=>  string(30) "/usr/share/pear/SOAP/Fault.php" "line"]=>  int(52) "function"]=>  string(10) "pear_error" "class"]=>  string(10) "pear_error" "type"]=>  string(2) "::" "args"]=>  array(5) { [0]=>  string(505) "wrong # args: type InFlightStruct contains " ident string prefix string type string suffix string origin string destination string timeout string timestamp int firstPositionTime int longitude float latitude float groundspeed int altitude int heading int altitudeStatus string updateType string altitudeChange string "" [1]=>  string(4) "NONE" [2]=>  NULL [3]=>  NULL [4]=>  &object(stdClass)(1) { "errorInfo"]=>  &object(stdClass)(2) { "errorCode"]=>  string(4) "NONE" "stackTrace"]=>  string(843) "wrong # args: type InFlightStruct contains " ident string prefix string type string suffix string origin string destination string timeout string timestamp int firstPositionTime int longitude float latitude float groundspeed int altitude int heading int altitudeStatus string updateType string altitudeChange string " while executing "insert_value $d_elt [rpcvar "$itemtype$final" $elt]" (procedure "SOAP::insert_value" line 116) invoked from within "SOAP::insert_value $retnode $result" (procedure "SOAP::reply" line 17) invoked from within "SOAP::reply [dom::DOMImplementation create] $methodNamespace "${methodName}Response" $msg"" } } } } [1]=>  array(6) { "file"]=>  string(29) "/usr/share/pear/SOAP/Base.php" "line"]=>  int(205) "function"]=>  string(10) "soap_fault" "class"]=>  string(10) "soap_fault" "type"]=>  string(2) "->" "args"]=>  array(6) { [0]=>  string(505) "wrong # args: type InFlightStruct contains " ident string prefix string type string suffix string origin string destination string timeout string timestamp int firstPositionTime int longitude float latitude float groundspeed int altitude int heading int altitudeStatus string updateType string altitudeChange string "" [1]=>  string(4) "NONE" [2]=>  string(0) "" [3]=>  &object(stdClass)(1) { "errorInfo"]=>  &object(stdClass)(2) { "errorCode"]=>  string(4) "NONE" "stackTrace"]=>  string(843) "wrong # args: type InFlightStruct contains " ident string prefix string type string suffix string origin string destination string timeout string timestamp int firstPositionTime int longitude float latitude float groundspeed int altitude int heading int altitudeStatus string updateType string altitudeChange string " while executing "insert_value $d_elt [rpcvar "$itemtype$final" $elt]" (procedure "SOAP::insert_value" line 116) invoked from within "SOAP::insert_value $retnode $result" (procedure "SOAP::reply" line 17) invoked from within "SOAP::reply [dom::DOMImplementation create] $methodNamespace "${methodName}Response" $msg"" } } [4]=>  NULL [5]=>  NULL } } [2]=>  array(6) { "file"]=>  string(31) "/usr/share/pear/SOAP/Client.php" "line"]=>  int(708) "function"]=>  string(15) "_raisesoapfault" "class"]=>  string(40) "webservice_directflight_directflightsoap" "type"]=>  string(2) "->" "args"]=>  array(4) { [0]=>  string(505) "wrong # args: type InFlightStruct contains " ident string prefix string type string suffix string origin string destination string timeout string timestamp int firstPositionTime int longitude float latitude float groundspeed int altitude int heading int altitudeStatus string updateType string altitudeChange string "" [1]=>  &object(stdClass)(1) { "errorInfo"]=>  &object(stdClass)(2) { "errorCode"]=>  string(4) "NONE" "stackTrace"]=>  string(843) "wrong # args: type InFlightStruct contains " ident string prefix string type string suffix string origin string destination string timeout string timestamp int firstPositionTime int longitude float latitude float groundspeed int altitude int heading int altitudeStatus string updateType string altitudeChange string " while executing "insert_value $d_elt [rpcvar "$itemtype$final" $elt]" (procedure "SOAP::insert_value" line 116) invoked from within "SOAP::insert_value $retnode $result" (procedure "SOAP::reply" line 17) invoked from within "SOAP::reply [dom::DOMImplementation create] $methodNamespace "${methodName}Response" $msg"" } } [2]=>  string(0) "" [3]=>  string(4) "NONE" } } [3]=>  array(6) { "file"]=>  string(31) "/usr/share/pear/SOAP/Client.php" "line"]=>  int(665) "function"]=>  string(16) "__decoderesponse" "class"]=>  string(40) "webservice_directflight_directflightsoap" "type"]=>  string(2) "->" "args"]=>  array(1) { [0]=>  &object(soap_value)(11) { "value"]=>  array(3) { [0]=>  &object(soap_value)(11) { "value"]=>  string(4) "NONE" "name"]=>  string(9) "faultcode" "type"]=>  string(6) "string" "namespace"]=>  string(41) "http://schemas.xmlsoap.org/soap/envelope/" "type_namespace"]=>  string(0) "" "attributes"]=>  array(0) { } "arrayType"]=>  string(0) "" "options"]=>  array(0) { } "nqn"]=>  &object(qname)(3) { "name"]=>  string(9) "faultcode" "ns"]=>  string(0) "" "namespace"]=>  string(41) "http://schemas.xmlsoap.org/soap/envelope/" } "tqn"]=>  &object(qname)(3) { "name"]=>  string(6) "string" "ns"]=>  string(0) "" "namespace"]=>  string(0) "" } "type_prefix"]=>  string(0) "" } [1]=>  &object(soap_value)(11) { "value"]=>  string(505) "wrong # args: type InFlightStruct contains " ident string prefix string type string suffix string origin string destination string timeout string timestamp int firstPositionTime int longitude float latitude float groundspeed int altitude int heading int altitudeStatus string updateType string altitudeChange string "" "name"]=>  string(11) "faultstring" "type"]=>  string(6) "string" "namespace"]=>  string(41) "http://schemas.xmlsoap.org/soap/envelope/" "type_namespace"]=>  string(0) "" "attributes"]=>  array(0) { } "arrayType"]=>  string(0) "" "options"]=>  array(0) { } "nqn"]=>  &object(qname)(3) { "name"]=>  string(11) "faultstring" "ns"]=>  string(0) "" "namespace"]=>  string(41) "http://schemas.xmlsoap.org/soap/envelope/" } "tqn"]=>  &object(qname)(3) { "name"]=>  string(6) "string" "ns"]=>  string(0) "" "namespace"]=>  string(0) "" } "type_prefix"]=>  string(0) "" } [2]=>  &object(soap_value)(11) { "value"]=>  array(1) { [0]=>  &object(soap_value)(11) { "value"]=>  array(2) { [0]=>  &object(soap_value)(11) { "value"]=>  string(4) "NONE" "name"]=>  string(9) "errorCode" "type"]=>  string(6) "string" "namespace"]=>  string(29) "urn:FlightAwareSOAP-ErrorInfo" "type_namespace"]=>  string(0) "" "attributes"]=>  array(0) { } "arrayType"]=>  string(0) "" "options"]=>  array(0) { } "nqn"]=>  &object(qname)(3) { "name"]=>  string(9) "errorCode" "ns"]=>  string(0) "" "namespace"]=>  string(29) "urn:FlightAwareSOAP-ErrorInfo" } "tqn"]=>  &object(qname)(3) { "name"]=>  string(6) "string" "ns"]=>  string(0) "" "namespace"]=>  string(0) "" } "type_prefix"]=>  string(0) "" } [1]=>  &object(soap_value)(11) { "value"]=>  string(843) "wrong # args: type InFlightStruct contains " ident string prefix string type string suffix string origin string destination string timeout string timestamp int firstPositionTime int longitude float latitude float groundspeed int altitude int heading int altitudeStatus string updateType string altitudeChange string " while executing "insert_value $d_elt [rpcvar "$itemtype$final" $elt]" (procedure "SOAP::insert_value" line 116) invoked from within "SOAP::insert_value $retnode $result" (procedure "SOAP::reply" line 17) invoked from within "SOAP::reply [dom::DOMImplementation create] $methodNamespace "${methodName}Response" $msg"" "name"]=>  string(10) "stackTrace" "type"]=>  string(6) "string" "namespace"]=>  string(29) "urn:FlightAwareSOAP-ErrorInfo" "type_namespace"]=>  string(0) "" "attributes"]=>  array(0) { } "arrayType"]=>  string(0) "" "options"]=>  array(0) { } "nqn"]=>  &object(qname)(3) { "name"]=>  string(10) "stackTrace" "ns"]=>  string(0) "" "namespace"]=>  string(29) "urn:FlightAwareSOAP-ErrorInfo" } "tqn"]=>  &object(qname)(3) { "name"]=>  string(6) "string" "ns"]=>  string(0) "" "namespace"]=>  string(0) "" } "type_prefix"]=>  string(0) "" } } "name"]=>  string(9) "errorInfo" "type"]=>  string(6) "Struct" "namespace"]=>  string(29) "urn:FlightAwareSOAP-ErrorInfo" "type_namespace"]=>  string(0) "" "attributes"]=>  array(0) { } "arrayType"]=>  string(0) "" "options"]=>  array(0) { } "nqn"]=>  &object(qname)(3) { "name"]=>  string(9) "errorInfo" "ns"]=>  string(0) "" "namespace"]=>  string(29) "urn:FlightAwareSOAP-ErrorInfo" } "tqn"]=>  &object(qname)(3) { "name"]=>  string(6) "Struct" "ns"]=>  string(0) "" "namespace"]=>  string(0) "" } "type_prefix"]=>  string(0) "" } } "name"]=>  string(6) "detail" "type"]=>  string(6) "Struct" "namespace"]=>  string(41) "http://schemas.xmlsoap.org/soap/envelope/" "type_namespace"]=>  string(0) "" "attributes"]=>  array(0) { } "arrayType"]=>  string(0) "" "options"]=>  array(0) { } "nqn"]=>  &object(qname)(3) { "name"]=>  string(6) "detail" "ns"]=>  string(0) "" "namespace"]=>  string(41) "http://schemas.xmlsoap.org/soap/envelope/" } "tqn"]=>  &object(qname)(3) { "name"]=>  string(6) "Struct" "ns"]=>  string(0) "" "namespace"]=>  string(0) "" } "type_prefix"]=>  string(0) "" } } "name"]=>  string(5) "Fault" "type"]=>  string(6) "Struct" "namespace"]=>  string(41) "http://schemas.xmlsoap.org/soap/envelope/" "type_namespace"]=>  string(0) "" "attributes"]=>  array(0) { } "arrayType"]=>  string(0) "" "options"]=>  array(0) { } "nqn"]=>  &object(qname)(3) { "name"]=>  string(5) "Fault" "ns"]=>  string(0) "" "namespace"]=>  string(41) "http://schemas.xmlsoap.org/soap/envelope/" } "tqn"]=>  &object(qname)(3) { "name"]=>  string(6) "Struct" "ns"]=>  string(0) "" "namespace"]=>  string(0) "" } "type_prefix"]=>  string(0) "" } } } [4]=>  array(6) { "file"]=>  string(31) "/usr/share/pear/SOAP/Client.php" "line"]=>  int(345) "function"]=>  string(7) "__parse" "class"]=>  string(40) "webservice_directflight_directflightsoap" "type"]=>  string(2) "->" "args"]=>  array(3) { [0]=>  &string(1966) " NONEwrong # args: type InFlightStruct contains " ident string prefix string type string suffix string origin string destination string timeout string timestamp int firstPositionTime int longitude float latitude float groundspeed int altitude int heading int altitudeStatus string updateType string altitudeChange string "NONEwrong # args: type InFlightStruct contains " ident string prefix string type string suffix string origin string destination string timeout string timestamp int firstPositionTime int longitude float latitude float groundspeed int altitude int heading int altitudeStatus string updateType string altitudeChange string " while executing "insert_value $d_elt [rpcvar "$itemtype$final" $elt]" (procedure "SOAP::insert_value" line 116) invoked from within "SOAP::insert_value $retnode $result" (procedure "SOAP::reply" line 17) invoked from within "SOAP::reply [dom::DOMImplementation create] $methodNamespace "${methodName}Response" $msg"" [1]=>  string(5) "UTF-8" [2]=>  &NULL } } [5]=>  array(6) { "file"]=>  string(50) "/usr/share/pear/SOAP/WSDL.php(727) : eval()'d code" "line"]=>  int(45) "function"]=>  string(4) "call" "class"]=>  string(40) "webservice_directflight_directflightsoap" "type"]=>  string(2) "->" "args"]=>  array(3) { [0]=>  string(6) "Search" [1]=>  array(1) { "query"]=>  string(17) "-destination KCMH" } [2]=>  array(4) { "namespace"]=>  string(23) "FlightAwareDirectFlight" "soapaction"]=>  string(23) "FlightAwareDirectFlight" "style"]=>  string(3) "rpc" "use"]=>  string(7) "encoded" } } } [6]=>  array(6) { "file"]=>  string(76) "/var/www/vhosts/mysite.org/subdomains/sandbox/httpdocs/test_soap.php" "line"]=>  int(18) "function"]=>  string(6) "search" "class"]=>  string(40) "webservice_directflight_directflightsoap" "type"]=>  string(2) "->" "args"]=>  array(1) { [0]=>  string(17) "-destination KCMH" } } } "callback"]=>  NULL }

As I’ve gotten other queries to work just fine, I’m trying to find out if this is a problem with the DirectFlight API or something on my end (I know it’s been out for less than a day, so I completely understand if I’ve found a bug). I also have tried:


$result = $soap->Search("-idents COA* -type B73*");

…which is straight from the documentation, and got similar errors. I know there are other ways to get airport specific data, but my ultimate goal is to be able to pull a subset of flights from a specific carrier, and this seems to be the command to do it with.


#2

Good catch, although I don’t know how that slipped by us. Give it a shot now. I ran our example as well as yours and it looks OK in PHP (which appears to be what you’re using).



Array
(
    [0] => stdClass Object
        (
            [altitudeStatus] => 
            [origin] => KATL
            [groundspeed] => 546
            [altitudeChange] => 
            [type] => B735
            [destination] => KEWR
            [altitude] => 350
            [ident] => COA84
            [firstPositionTime] => 1161625082
            [suffix] => Q
            [heading] => 42
            [longitude] => -76.4666671753
            [timestamp] => 1161628752
            [latitude] => 38.9166679382
            [updateType] => TZ
            [prefix] => 
            [timeout] => ok
        )

    [1] => stdClass Object
        (
            [altitudeStatus] => C
            [origin] => KMIA
            [groundspeed] => 490
            [altitudeChange] => D
            [type] => B733
            [destination] => KEWR
            [altitude] => 180
            [ident] => COA44
            [firstPositionTime] => 1161621881
            [suffix] => J
            [heading] => 43
            [longitude] => -75.3833312988
            [timestamp] => 1161628739
            [latitude] => 39.8666648865
            [updateType] => TZ
            [prefix] => 
            [timeout] => ok
        )
(snip)



#3

Yeah, that looks like it’s working now. This is exactly what I was hoping for, so I’ll get out the development team whip and start those guys on the project… :smiley:

Thanks for the help!


#4

One more question:

Is there a way to do multiple values for a single key with Search?

For instance, can I ask for all the B737 and Airbus 321 aircraft going into KJFK with Search? Or can I only ask for one aircraft type (in this case) at a time?


#5

At this point, I believe every argument is an AND. I think that’s a good feature request, though, and there are going to be a few other small changes to “search” coming soon, I think, that make them a bit more like the other multi-flight queries such as Arrived/Departed/Enroute/etc.