PEAR::SOAP client from WSDL messing up sometimes

From: Date: Wed, 13 Nov 2002 01:28:43 +0000
Subject: PEAR::SOAP client from WSDL messing up sometimes
Groups: php.pear.dev php.pear.general php.soap 
Request: Send a blank email to pear-dev+get-10747@lists.php.net to get a copy of this message
Tried using the Google API by generating a PEAR::SOAP_Client from the WSDL description using the code: <?php include_once 'SOAP/Client.php'; $key = 'xxxxx' // put here your Google key $query = array( 'key' => "$key", 'q' => 'link:metallo.scripps.edu', 'start' => 0, 'maxresults' => 10, // note the mispelling of maxResults 'filter' => true, 'restrict' => '', 'safeSearch' => false, 'lr' => '', 'ie' => '', 'oe' => '' ); $client = new SOAP_Client('GoogleSearch.wsdl', true); $client->__trace(1); $result = $client->call('doGoogleSearch',$query,'urn:GoogleSearch'); print_r($result); print_r($client->xml); print_r($client->wire); ?> And what I got was an error, below is the output which includes the XML outgoing packet and the incoming. The problem seems to be that somehow when a parameter is non-existent the WSDL-generated client just fubars and repeats another value (in this case the 'key' which I have replaced with 'xxxxx' in the output below and the code above), which causes an error on the Google end. Here is the output of the code above: soap_fault Object ( [error_message_prefix] => /search/beta2 [mode] => 1 [level] => 1024 [code] => SOAP-ENV:Client [message] => xxxxx [userinfo] => [callback] => ) <?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"> <SOAP-ENV:Body> <SOAP-ENV:Fault> <faultcode>SOAP-ENV:Client</faultcode> <faultstring>xxxxx</faultstring> <faultactor>/search/beta2</faultactor> </SOAP-ENV:Fault> </SOAP-ENV:Body> </SOAP-ENV:Envelope> OUTGOING: POST /search/beta2 HTTP/1.0 User-Agent: PEAR-SOAP 0.7.0 Host: api.google.com Content-Type: text/xml; charset=UTF-8 Content-Length: 971 SOAPAction: "urn:GoogleSearchAction" <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/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/" xmlns:ns4="urn:GoogleSearch" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <ns4:doGoogleSearch> <key xsi:type="xsd:string">xxxxx</key> <q xsi:type="xsd:string">link:metallo.scripps.edu</q> <start xsi:type="xsd:int">0</start> <maxResults xsi:type="xsd:int">xxxxx/YEhCAYGHAgWsQAn</maxResults> <filter xsi:type="xsd:boolean">true</filter> <restrict xsi:type="xsd:string"></restrict> <safeSearch xsi:type="xsd:boolean">false</safeSearch> <lr xsi:type="xsd:string"></lr> <ie xsi:type="xsd:string"></ie> <oe xsi:type="xsd:string"></oe></ns4:doGoogleSearch> </SOAP-ENV:Body> </SOAP-ENV:Envelope> INCOMING HTTP/1.1 500 Internal Server Error Date: Wed, 13 Nov 2002 01:10:09 GMT Server: e h c a p a Content-Length: 446 Connection: close Content-Type: text/xml; charset=utf-8 <?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"> <SOAP-ENV:Body> <SOAP-ENV:Fault> <faultcode>SOAP-ENV:Client</faultcode> <faultstring>xxxxx</faultstring> <faultactor>/search/beta2</faultactor> </SOAP-ENV:Fault> </SOAP-ENV:Body> </SOAP-ENV:Envelope> ===== --- Jesus M. Castagnetto (jcastagnetto@yahoo.com) Research: http://metallo.scripps.edu/ Personal: http://www.castagnetto.org/ __________________________________________________ Do you Yahoo!? U2 on LAUNCH - Exclusive greatest hits videos http://launch.yahoo.com/u2

« previous php.pear.dev (#10747) next »