Bug #49070 [Com]: return object array in a webservice
| From: | lherrington100 at gmail dot com | Date: | Wed, 23 Mar 2011 18:37:21 +0000 |
| Subject: | Bug #49070 [Com]: return object array in a webservice | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-159731@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=49070&edit=1
ID: 49070
Comment by: lherrington100 at gmail dot com
Reported by: jordibsala at gmail dot com
Summary: return object array in a webservice
Status: No Feedback
Type: Bug
Package: SOAP related
Operating System: windows xp
PHP Version: 5.3.0
Block user comment: N
Private report: N
New Comment:
I found this bug from a stack overflow and posted my solution there:
http://stackoverflow.com/questions/1830801/php-soapclient-call-response-missing-parts-of-answer/5409920#5409920
It may or may not be what you need, but in my experience this is not a
PHP bug. It is an issue with how your web service is written.
Previous Comments:
------------------------------------------------------------------------
[2010-06-08 15:01:29] moshe dot elisha at gmail dot com
I have the same problem with a SOAP request to a Java Axis WS.
(I replaced all http:// with hdoubletp://)
My Request is ($soapClient->__getLastRequest()):
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="hdoubletp://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="hdoubletp://pm.xms.xeround.com"><SOAP-ENV:Body><ns1:getInstanceGraphsInitialData><ns1:in0>34</ns1:in0><ns1:in1>0</ns1:in1><ns1:in2>10800</ns1:in2><ns1:in3>3600</ns1:in3></ns1:getInstanceGraphsInitialData></SOAP-ENV:Body></SOAP-ENV:Envelope>
My response is ($soapClient->__getLastResponse()):
<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope
xmlns:soapenv="hdoubletp://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="hdoubletp://www.w3.org/2001/XMLSchema"
xmlns:xsi="hdoubletp://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><getInstanceGraphsInitialDataResponse
xmlns="http://pm.xms.xeround.com"><getInstanceGraphsInitialDataReturn><time>1275998951000</time><values><values>0</values><values>0</values><values>13</values><values>6</values></values></getInstanceGraphsInitialDataReturn><getInstanceGraphsInitialDataReturn><time>1275995351000</time><values><values>0</values><values>0</values><values>11</values><values>5</values></values></getInstanceGraphsInitialDataReturn></getInstanceGraphsInitialDataResponse></soapenv:Body></soapenv:Envelope>
print_r of the result
($soapClient->__soapCall(...)->getInstanceGraphsInitialDataReturn):
Array
(
[0] => stdClass Object
(
[time] => 1275998951000
[values] => stdClass Object
(
)
)
[1] => stdClass Object
(
[time] => 1275995351000
[values] => stdClass Object
(
)
)
)
------------------------------------------------------------------------
[2009-10-16 01:00:01] 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".
------------------------------------------------------------------------
[2009-10-08 20:00:05] Sjoerd@php.net
Thank you for your bug report.
To properly diagnose and reproduce the problem, we need the SOAP
response from the server when it returns the array. You can obtain this
by calling __getLastRequest() or using a sniffer like Wireshark.
------------------------------------------------------------------------
[2009-07-27 09:34:04] jordibsala at gmail dot com
Description:
------------
I have a problem when I call a function of a JAVA webservice which
returns a array of objects, but this array's objects are empty.
Reproduce code:
---------------
$wsdl =
"http://localhost:8180/ContentManager/services/ContentManagerWS?wsdl";
$contentId = "hola";
$metadataSet = 2;
$client = new SoapClient($wsdl);
$params = array('contentId' => $contentId,'metadataSet' =>
$metadataSet);
try
{
$result = $client->__soapCall('getMetadata', array('parameters' =>
$params));
} catch (SoapFault $exception) {
echo $exception;
}
?>
<?php var_dump($result)?>
Expected result:
----------------
object(stdClass)#2 (1) { ["getMetadataReturn"]=> object(stdClass)#3 (6)
{ ["contentID"]=> string(36) "6b9f1157-78c2-4e2d-b371-888839431088"
["raudolares"]=> int(100) ["thumbnail"]=> string(45)
"http://www.thumbnailsraudos.es/thumbnail1.jpg"
["RecommendationValue"]=> int(12) ["semanticData"]=> object(stdClass)#4
(5) { ["emitDate"]=> string(10) "21/07/2009" ["filmDate"]=>
string(10)
"21/05/2009" ["editDate"]=> string(10) "21/06/2009"
["edited"]=>
bool(true) ["labeled"]=> bool(false) } ["technicalData"]=> array(5) {
[0]=> object(stdClass)#9 (2) {["bitrate"]=> int(1024000) ["filesize"]=>
int(51236254) } [1]=> object(stdClass)#10 (2) { ["bitrate"]=>int(512000)
["filesize"]=> int(21365245) } [2]=> NULL [3]=> NULL [4]=> NULL } } }
Actual result:
--------------
object(stdClass)#2 (1) { ["getMetadataReturn"]=> object(stdClass)#3 (6)
{ ["contentID"]=> string(36) "6b9f1157-78c2-4e2d-b371-888839431088"
["raudolares"]=> int(100) ["thumbnail"]=> string(45)
"http://www.thumbnailsraudos.es/thumbnail1.jpg"
["RecommendationValue"]=> int(12) ["semanticData"]=> object(stdClass)#4
(5) { ["emitDate"]=> string(10) "21/07/2009" ["filmDate"]=>
string(10)
"21/05/2009" ["editDate"]=> string(10) "21/06/2009"
["edited"]=>
bool(true) ["labeled"]=> bool(false) } ["technicalData"]=> array(5) {
[0]=> object(stdClass)#9 (0) { } [1]=> object(stdClass)#10 (0) { } [2]=>
NULL [3]=> NULL [4]=> NULL } } }
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=49070&edit=1