php - Zend_Soap_Client error calling ASP.net web service: '...not set to an instance of an object' -


i'm trying use zend_soap_client communicate asp.net web service. here's client call:

$client = new zend_soap_client(null, array(     'location' => 'http://example.com/service.asmx',     'uri' => 'http://example.com/' ));  $user = new userdetail(); $result = $client->userdetails($user); 

however gives me error:

system.nullreferenceexception: object reference not set instance of object. @ service.userdetails(userdetail userdetail)

some googling revealed quite common problem. common solution seemed to pass parameters array, tried:

$result = $client->userdetails(array('userdetail' => $user)); 

but gave same error. tried passing params stdclass object, nesting array in 'params' key, , few other things error same.

i have asp code web service itself, relevant method is:

public result userdetails(userdetail userdetail) {      [some stuff]      hashtable ht = new hashtable();     ht = userdetail.generatedata(); } 

the error caused generatedata() call.

i assume userdetails method getting null instead of object parameter, i'm not sure how should calling method, or how can debug further. majority of zend_soap_client examples i've found seem using wsdl, service not; not sure if relevant. appreciated!

i solved with:

$userdetails = new userdetails(); $userdetails->userdetail = $user;  $client->userdetails($userdetails); 

it seems asp.net expects (and returns) params nested in object/array same name method being called.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -