Question

I'm able to consume a local WSDL into PHP, and pass/return basic data successfully, but when I attempt to pass in objects that correspond to a complextype in the WSDL, I get the following error:

SoapFault exception: [soapenv:Server] javax.xml.ws.WebServiceException: com.ibm.websphere.sca.ServiceRuntimeException: An error occurred while parsing native data: The error message is: java.lang.IllegalArgumentException: Mismatched parameter count: expecting 1 items, but got more.. Caused By: java.lang.IllegalArgumentException: Mismatched parameter count: expecting 1 items, but got more.: caused by: An error occurred while parsing native data: The error message is: java.lang.IllegalArgumentException: Mismatched parameter count: expecting 1 items, but got more.. Caused By: java.lang.IllegalArgumentException: Mismatched parameter count: expecting 1 items, but got more. in C:\wamp\www\SugarCE\testSOAPShawn.php:65 Stack trace: #0 [internal function]: SoapClient->__call('establishIdenti...', Array) #1 C:\wamp\www\SugarCE\testSOAPShawn.php(65): SoapClient->establishIdentity(Object(stdClass), Object(stdClass)) #2 {main}

Here is the snippets from the WSDL:

<xsd:element name="establishIdentity">
−
<xsd:complexType>
−
<xsd:sequence>
−
<xsd:element name="processId" nillable="true" type="xsd:string">
−
<xsd:annotation>
−
<xsd:documentation>
Identifies a specific instance of the dialogue process.  Returned from the start() operation.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
−
<xsd:element name="identityAttributes" nillable="true" type="bons1:IdentityAttributes">
−
<xsd:annotation>
−
<xsd:documentation>
Key identifying attributes of a program participant.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>

Here is my code with comments where the error occurs:

<?php
set_time_limit(0);
require_once('nusoap.php');

$client = new SoapClient('C:\wsdl\BenefitDeterminationProcess_BenefitDialogueServiceSOAP.wsdl', array('trace' => 1));

$start = $client->__soapCall('start', array(new SoapParam((string)'GenesisID', 'prefix')),
        array('soapaction' => 'C:\wsdl\BenefitDeterminationProcess_BenefitDialogueServiceSOAP\start'));

$processID = $start;

$exchange = $client->__soapCall('exchangeOptions', array(new SoapParam($processID, 'processId')),
        array('soapaction' => 'C:\wsdl\BenefitDeterminationProcess_BenefitDialogueServiceSOAP\exchangeOptions'));

$identityAttributes = new StdClass();
$identityAttributes->IdentityAttributes = new StdClass();
$identityAttributes->IdentityAttributes->ssn = 41441414;
$identityAttributes->IdentityAttributes->firstName = 'John2';
$identityAttributes->IdentityAttributes->lastName = 'Doe2';
$identityAttributes->IdentityAttributes->gender = 'MALE';
$identityAttributes->IdentityAttributes->birthDate = null;

try{
    $identity = $client->establishIdentity($processID, $identityAttributes); //ERROR


   } catch (SoapFault $f){
       echo "ERROR!";
   }

$end = $client->__soapCall('stop', array(new SoapParam($processID, 'processId')),
       array('soapaction' => 'C:\wsdl\BenefitDeterminationProcess_BenefitDialogueServiceSOAP\stop'));

?>

Any assistance is greatly appreciated! Thanks.

Was it helpful?

Solution

The establishIdentity function requires only one parameter, you are passing two. From working with SOAP and PHP in the past I've found complexTypes usually need to passed as arrays.

I'd suggest try changing the line which calls establishIdentity to the following

$identity = $client->establishIdentity(
    array(
        "processId"=>$processID, 
        "identityAttributes"=>$identityAttributes
    )
);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top