PHP/WSDL/SOAP: Error passing parameters -
i'm using local wsdl make service calls. i'm fine passing/retrieving data when 1 parameter expected service method(s), when method expects 2 or more parameters errors out. ironically, when attempt pass 2 or more parameters says expects 1. method establishidentity expects 2 parameters (processid=string & identityattributes = object made of properties found in code below.) i've include errors passing 1 , 2 parameters.
<?php set_time_limit(0); require_once('nusoap.php'); require_once('benefitsoap.php'); $client = new soapclient('c:\wsdl\benefitdeterminationprocess_benefitdialogueservicesoap.wsdl', array('trace' => 1)); $procid = (array)$client->start(array("prefix"=>"")); $newstringid = implode(null, $procid); // $exchange = $client->exchangeoptions($procid); $identityattributes = new identityattributes(); $identityattributes->ssn = 41441414; $identityattributes->firstname = 'john2'; $identityattributes->lastname = 'doe2'; $identityattributes->gender = 'male'; $identityattributes->birthdate = null; echo "type: ".gettype($newstringid); echo "ns: ".$newstringid; $identity = $client->establishidentity($newstringid); //line 33 //$identity = $client->establishidentity($newstringid, $identityattributes); or line 33//establishidentity expects 2 parameters (processid = string, identityattributes = object) $end = $client->stop($procid); ?>
error when passing 1 parameter:
type: stringns: 223205
fatal error: uncaught soapfault exception: [http] error fetching http headers in c:\wamp\www\sugarce\testsoapshawn.php:33 stack trace: #0 [internal function]: soapclient->_dorequest('_call('establishidenti...', array) #2 c:\wamp\www\sugarce\testsoapshawn.php(33): soapclient->establishidentity('223205')> > #3 {main} thrown in c:\wamp\www\sugarce\testsoapshawn.php on line 33
error when passing 2 parameters:
type: stringns: 237506
fatal error: uncaught soapfault exception: [soapenv:server] javax.xml.ws.webserviceexception: com.ibm.websphere.sca.serviceruntimeexception: error occurred while parsing native data: error message is: java.lang.illegalargumentexception: mismatched parameter count: expecting 1 items, got more.. caused by: java.lang.illegalargumentexception: mismatched parameter count: expecting 1 items, got more.: caused by: error occurred while parsing native data: error message is: java.lang.illegalargumentexception: mismatched parameter count: expecting 1 items, got more.. caused by: java.lang.illegalargumentexception: mismatched parameter count: expecting 1 items, got more. in c:\wamp\www\sugarce\testsoapshawn.php:33 stack trace: #0 [internal function]: soapclient->__call('establishidenti...', array) #1 c:\wamp\www\sugarce\testsoapshawn.php(33): soapclient->establishidentity('237506', object(identityattributes)) #2 {main} thrown in c:\wamp\www\sugarce\testsoapshawn.php on line 33
any , assistance appreciated!
answered: since wsdl contained complextype, needed pass 1 parameter contained both processid , identityattributes. here php code:
$identityattributes = new identityattributes(); $identityattributes->ssn = 41441414; $identityattributes->firstname = 'john2'; $identityattributes->lastname = 'doe2'; $identityattributes->gender = 'male'; $identityattributes->birthdate = null; $temp = new stdclass(); $temp->processid = $newstringid; $temp->identityattributes = $identityattributes; echo "type: ".gettype($newstringid); echo "ns: ".$newstringid; $identity = $client->establishidentity($temp); var_dump($identity); $end = $client->stop($procid);
Comments
Post a Comment