#30352 [Com]: Soap array deserializer problem
| From: | schow at macnexus dot org | Date: | Mon, 09 Oct 2006 06:11:21 +0000 |
| Subject: | #30352 [Com]: Soap array deserializer problem | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-103277@lists.php.net to get a copy of this message | ||
ID: 30352
Comment by: schow at macnexus dot org
Reported By: jiro at email dot it
Status: No Feedback
Bug Type: SOAP related
Operating System: Windows XP SP2
PHP Version: 5.0.3
Assigned To: dmitry
New Comment:
This might be the extra feedback you're looking for. I ran across
these symptoms when working with the Google Search SOAP API.
Basically, in WSDL Mode, the Soap Client needs the parameters to the
operations passed to it as individual functions. Passing an array of
parameters causes a SoapFault Exception. Naturally, in Non-WSDL mode,
an array of parameters works just fine.
In other words, in WSDL Mode, this works:
$results = $client->doGoogleSearch('[Google Key]', 'Cornbread', 0, 10,
true, '', false, 'english', 'utf-8', 'utf-8');
While this one causes the SOAP Exception:
$params = array('key' => '[Google Key]',
'q' => 'Cornbread',
'start' => 0,
...)
$result = $clientWSDL->doGoogleSearch($params);
Here is the script in its entirety:
<?php
//BEGIN PARAMS ARRAY
$params = array('key' => '[A Google Key]',
'q' => 'Cornbread',
'start' => 0,
'maxResults' => 10,
'filter' => true,
'restrict' => 'countryUS',
'safeSearch' => false,
'lr' => 'english',
'ie' => 'utf-8',
'oe' => 'utf-8');
//END PARAMS ARRAY
//BEGIN NONWSDL MODE
$clientNonWSDL = new SoapClient(null,
array('location' => "http://api.google.com/search/beta2",
'uri' => "urn:GoogleSearch"
)
);
//WITH PARAMS AS ARRAY
$resultNonWSDL = $clientNonWSDL->__soapCall('doGoogleSearch',
$params);
echo "<h1>NonWSDL Client Request With Array:</h1>";
echo "<h4>REQUEST:\n" . $clientNonWSDL->__getLastRequest() .
"</h4>";
var_dump($resultNonWSDL);
//END NONWSDL MODE
//BEGIN WSDL MODE
$clientWSDL = new SoapClient('http://api.google.com/GoogleSearch.wsdl',
array('trace' => true));
//WITH PARAMS AS INDIVIDUAL ITEMS
$resultWSDLNonArray = $clientWSDL->doGoogleSearch('[A Google Key]',
'Cornbread', 0, 10, true, '', false, 'english', 'utf-8',
'utf-8');
echo "<h1>WSDL Client Request With String:</h1>";
echo "<h4>REQUEST:\n" . $clientWSDL->__getLastRequest() .
"</h4>";
var_dump($resultWSDLNonArray);
//WITH PARAMS AS ARRAY
$resultWSDLArray = $clientWSDL->doGoogleSearch($params);
echo "<h1>WSDL Client Request With Array:</h1>";
echo "<h4>REQUEST:\n" . $clientWSDL->__getLastRequest() .
"</h4>";
var_dump($resultWSDLArray);
//END WSDL MODE
?>
Previous Comments:
------------------------------------------------------------------------
[2005-02-05 01:00:06] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2005-01-28 12:03:42] dmitry@php.net
The error occurs on server side.
Seems server cannot decode the soap request.
To understand (and fix) the problem I need to know the expected soap
request and the actual one.
You can use the following script to catch SOAP request with ext/soap.
<?php
$queryst="/rdf:RDF/rdf:Description[ns1:subject='$cat']" ;
$namespaces=array("rdf",
"http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"rdfs",
"http://www.w3.org/2000/01/rdf-schema#",
"ns1",
"http://purl.org/dc/elements/1.0/",
"ns2",
"http://purl.org/dc/terms/");
$soap_client=new
SoapClient('http://jiroland.dyndns.org/QueryService.wsdl',
array('trace'=>1,
'exceptions'=>0));
$response=$soap_client->queryCollection('tbl', $queryst,
true,$namespaces);
echo $soap_client->__getLastRequest()."\n";
echo $soap_client->__getLastResponse()."\n";
var_dump($response);
?>
------------------------------------------------------------------------
[2005-01-03 12:27:07] jiro at email dot it
Sorry, this is the script
http://jiroland.dyndns.org/soap.txt
I tested with PHP 5.0.3 but it's the same
------------------------------------------------------------------------
[2004-12-05 01:00:08] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2004-11-27 17:32:43] tony2001@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc.
If possible, make the script source available online and provide
an URL to it here. Try avoid embedding huge scripts into the report.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/30352
--
Edit this bug report at http://bugs.php.net/?id=30352&edit=1