php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30352 Soap array deserializer problem
Submitted: 2004-10-07 16:20 UTC Modified: 2005-02-05 01:00 UTC
Votes:12
Avg. Score:4.7 ± 0.6
Reproduced:9 of 9 (100.0%)
Same Version:2 (22.2%)
Same OS:1 (11.1%)
From: jiro at email dot it Assigned: dmitry (profile)
Status: No Feedback Package: SOAP related
PHP Version: 5.0.3 OS: Windows XP SP2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jiro at email dot it
New email:
PHP Version: OS:

 

 [2004-10-07 16:20 UTC] jiro at email dot it
Description:
------------
I'm using PHP 5.0.2 with SOAP extension.
I need to call a function with a array as input, and it doesn't serialize -.-


Reproduce code:
---------------
$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(HOST_XIWA. 'QueryService?wsdl');
                      $response=$soap_client->queryCollection(XINDICE_COL, $queryst, true, $namespaces);

Expected result:
----------------
$response is the result of the query. It goes with NUSOAP^^

Actual result:
--------------
Fatal error: Uncaught SoapFault exception: [soapenv:Server.userException] org.xml.sax.SAXException: No deserializer defined for array type {http://www.w3.org/2001/XMLSchema}string in D:\Tesi2004\tbl\search.php:115 Stack trace: #0 D:\Tesi2004\tbl\search.php(115): SoapClient->queryCollection('queryCollection', Array) #1 D:\Tesi2004\tbl\search.php(97): stampa_commenti('tbl_comment', '/rdf:RDF/rdf:De...', false, Array) #2 D:\Tesi2004\tbl\search.php(256): stampa_un_libro('D:\Tesi2004\tbl\search.php on line 115

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-10-07 16:22 UTC] jiro at email dot it
I wrong to write the OS name
 [2004-11-27 17:32 UTC] 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.


 [2004-12-05 01:00 UTC] 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-03 12:27 UTC] 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
 [2005-01-28 12:03 UTC] 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-02-05 01:00 UTC] 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".
 [2006-10-09 06:11 UTC] schow at macnexus dot org
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
?>
 [2006-10-09 06:18 UTC] schow at macnexus dot org
And here is the error in its entirety:

Fatal error: Uncaught SoapFault exception: [SOAP-ENV:Client] No Deserializer found to deserialize a ':q' using encoding style 'http://schemas.xmlsoap.org/soap/encoding/'. in /Library/WebServer/Documents/test.php:41 Stack trace: #0 [internal function]: SoapClient->__call('doGoogleSearch', Array) #1 /Library/WebServer/Documents/test.php(41): SoapClient->doGoogleSearch(Array) #2 {main} thrown in /Library/WebServer/Documents/test.php on line 41

Currently using PHP 5.1.6 on Mac OS X.  However, I've tested and gotten used to wirtesome of the same results on Linux and Windows.
 [2006-10-09 13:47 UTC] schow at macnexus dot org
Sorry about writing that at 2:00 am US Eastern Time.  Hope most of it was coherent...

There might be a possible cause of it here on this Google API Group message:

http://groups.google.com/group/google.public.web-apis/browse_frm/thread/6beb385344ec509e/a1fbfa5f713be131?lnk=st&q=No+Deserializer+found+to+deserialize+a+%27%3Aq%27&rnum=10#a1fbfa5f713be131

And I've experienced this on 5.1.6 on Linux, and 5.1.4 on XP and Mac OS X.
 [2009-01-22 23:06 UTC] l at ele dot com
no comments at this moment
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 11:01:28 2024 UTC