|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-07-27 09:34 UTC] 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 } } }
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 30 21:00:01 2025 UTC |
Here is a copy/paste of my answer from stack overflow, just in case that goes away someday: "Here we go nearly a year and a half later... In my recent semi-similar experience this was not a php bug. It is an issue related to the way your webservice is written and how PHP reads the output. I was experiencing a similar problem (even down to getLastResponse returning the correct XML) and came to find that it wasn't so much PHP or my SOAP function that had an issue but that the result of the "broken" function was not an explicitly defined cursor. Example of bad cursor definition: PROCEDURE GetBlahByBlahID(IN IN_BLAH_ID VARCHAR, IN IN_BLAHPKG VARCHAR, OUT result CURSOR ) BEGIN ... Example of good cursor definition: PROCEDURE GetBlahByBlahID(IN IN_BLAH_ID VARCHAR, IN IN_BLAHPKG VARCHAR, OUT result CURSOR ( BLAH VARCHAR(250), BLAH2 VARCHAR(250), BLAH_DATE DATE, BLAH3 VARCHAR(250))) BEGIN ... Apparently Java can handle the "bad"/non explicit output just fine, but PHP returns an array of null objects. Not sure if this will help you, but defining the web service function output as the "good" way above fixed my problem."