Je suis capable de consommer un WSDL local en PHP, et réussir/renvoyer des données de base avec succès, mais quand je tente de passer des objets qui correspondent à un type complexe dans le WSDL, je l'erreur suivante:PHP: WSDL, Web Service Client, ComplexType
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}
Voici les extraits du 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>
Voici mon code avec des commentaires où l'erreur se produit:
<?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'));
?>
Toute aide est grandement appréciée! Merci.
J'ai essayé ci-dessus et a obtenu l'erreur suivante: – user464180
EstablishIdentity attend un seul paramètre, un type complexe. Ce type complexe contient une séquence de deux éléments, processId qui est de type string, et identityAttributes, qui est un autre type, omis de votre fichier wsdl. Vous créez un $ identityAttributes StdClass, qui a une seule propriété identityAttributes, qui a alors les différentes propriétés, est-ce correct? Essayez ce qui suit, mais encore une fois, je suis dans le noir ici sans le WSDL complet. Omettez la ligne '$ identityAttributes-> IdentityAttributes = new StdClass();' et placez les autres dans $ $ identityAttributes-> ssn = 41441414; –