Jump to content

How to get object variable value


joymis
 Share

Recommended Posts

Hello!

 

I have a object array like this

  [3]=>  string(289) "struct Order4Vendor { string jit_batch; string line_id; string part_no; string order_no; string order_seq; decimal jit_qty; decimal no_ship_qty; decimal vend_qty; dateTime vend_updated; string part_name; string jit_no; dateTime pl_ship_dt; string modl_name; string vend_no;}"  [6]=>  string(97) "struct GetSingleOrder { string vend_no; string vend_pwd; string order_no; string order_seq;}"  [7]=>  string(69) "struct GetSingleOrderResponse { Order4Vendor GetSingleOrderResult;}"

this is my code

<?php$soap = new SoapClient("xxxxx");$params= array( 		'vend_no' => 'v1220',		'end_pwd' => 'ly3e90',		'order_no' => 'D153906',		'order_seq' => '001'	);$result = $soap->GetSingleOrder($params)->GetSingleOrderResult;echo $result->jit_batch;?>

How can I get $result->jit_batch value?

 

when I executed the program, my apache log display this message

[Wed Apr 15 17:13:57 2015] [error] [client 10.0.0.56] PHP Fatal error:  Uncaught SoapFault exception: [soap:Server] System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.NullReferenceException: Object reference not set to an instance of an object.n   at Asine.Gck.Services.WebServices.VMI2ec.VerifyVendor(String vend_no, String vend_pwd)n   at Asine.Gck.Services.WebServices.VMI2ec.GetSingleOrder(String vend_no, String vend_pwd, String order_no, String order_seq)n   --- End of inner exception stack trace --- in /JOY/www_beta/soap/client.php:27nStack trace:n#0 /JOY/www_beta/soap/client.php(27): SoapClient->__call('GetSingleOrder', Array)n#1 /JOY/www_beta/soap/client.php(27): SoapClient->GetSingleOrder(Array)n#2 {main}n  thrown in /JOY/www_beta/soap/client.php on line 27

Hope anyone can help

 

Thanks!

Link to comment
Share on other sites

Those aren't objects, those are just strings of text. Even the strings are not valid PHP objects though, PHP does not have structs or data types like decimal and dateTime. The error message describes a different problem though, the error message makes it sounds like you're not passing the correct parameters to GetSingleOrder, maybe vend_no is incorrect. That's what this sounds like:

System.NullReferenceException: Object reference not set to an instance of an object.at Asine.Gck.Services.WebServices.VMI2ec.VerifyVendor(String vend_no, String vend_pwd)at Asine.Gck.Services.WebServices.VMI2ec.GetSingleOrder(String vend_no, String vend_pwd, String order_no, String order_seq)

That error message and stack trace is coming from the web service code, not your code. The web service has a fatal error which is causing a fatal eror for your SOAP client.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...