Wednesday 15 August 2012

java - Error: Notice: Trying to get property of non-object -



java - Error: Notice: Trying to get property of non-object -

i working on project requires technologies in both java , php. utilize java implement business logic , info source management while php helps consume web service provided using java. problem: when consume response web service , result contains more 1 homecoming collection, programme runs fine. (http://driesmeers.mamca.be/images/successpage.png) 1 time result homecoming 1 collective response, error shown below. (http://driesmeers.mamca.be/images/errorpage.png)

here code.php

<?php seek { $wsdl_url = 'http://localhost:8080/mamca/mamcaws?wsdl'; $client = new soapclient($wsdl_url); $params = array( 'projectid' => $_session['projectid'], ); $return = $client->getalternativelistbyprojectid($params); if (isset($return->return)) { foreach ($return->return $eachitem) { echo "<tr align='center'>"; echo "<td align='left' class='rowdisplay'> <a href = '#' class = 'rownumber2'>" . $eachitem->alternativedescription . "</a></td>"; echo "<td align='left' class='rowdisplay'>" . $eachitem->alternativegroup . "</td>"; echo "<td align='left' class='rowdisplay'>"; echo ($eachitem->status === 1 ? 'active' : 'inactive'); echo "</td>"; echo "<td align='center' class='rowdisplay'><img src = '../images/icons/delete.png' longdesc = 'http://.delete' /><img src = '../images/icons/table_edit.png' width = '16' height = '16' /></td>"; echo "</tr>"; } } } grab (exception $e) { echo "exception occured: " . $e; } ?> <tr id="ajax_response"> </tr>

response ws error output:

<?xml version="1.0" encoding="utf-8"?><s:envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"> <soap-env:header/> <s:body> <ns2:getalternativelistbyprojectidresponse xmlns:ns2="http://services.mamca.be.vub/"> <return> <alternativegroup>testt</alternativegroup> <alternativedescription>testtt</alternativedescription> <alternativeid>10670</alternativeid> <id>19</id> <projectid>12313</projectid> <status>1</status> </return> </ns2:getalternativelistbyprojectidresponse> </s:body> </s:envelope>

how resolve error? give thanks you.

when result 1 single element, soapclient doesn't homecoming array default, object.

you can set soapclient homecoming array, when result 1 element, adding parameter on instantiation:

$client = new soapclient($wsdl_url ,array( "features" => soap_single_element_arrays ));

java php web-services

No comments:

Post a Comment