PHP:WSDL、Web服务客户端、ComplexType
我能够将本地WSDL使用到PHP中,并成功地传递/返回基本数据,但当我尝试传递与WSDL中的complextype相对应的对象时,会出现以下错误: SoapFault异常:[soapenv:服务器] javax.xml.ws.WebServiceException: com.ibm.websphere.sca.ServiceRuntimeException: 分析本机时出错 数据:错误消息为: java.lang.IllegalArgumentException: 参数计数不匹配:应为 1个项目,但得到更多。。原因: java.lang.IllegalArgumentException: 参数计数不匹配:应为 1个项目,但获得更多。原因:An 分析本机时出错 数据:错误消息为: java.lang.IllegalArgumentException: 参数计数不匹配:应为 1个项目,但得到更多。。原因: java.lang.IllegalArgumentException: 参数计数不匹配:应为 1个项目,但得到更多。在里面 C:\wamp\www\SugarCE\testSOAPShawn.php:65 堆栈跟踪:#0[内部函数]: SoapClient->_调用('EstablishIdentiti…', 数组)#1 C:\wamp\www\SugarCE\testSOAPShawn.php(65): SoapClient->establishIdentity(对象(stdClass), 对象(stdClass))#2{main} 以下是WSDL中的代码片段:PHP:WSDL、Web服务客户端、ComplexType,php,wsdl,complextype,Php,Wsdl,Complextype,我能够将本地WSDL使用到PHP中,并成功地传递/返回基本数据,但当我尝试传递与WSDL中的complextype相对应的对象时,会出现以下错误: SoapFault异常:[soapenv:服务器] javax.xml.ws.WebServiceException: com.ibm.websphere.sca.ServiceRuntimeException: 分析本机时出错 数据:错误消息为: java.lang.IllegalArgumentException: 参数计数不匹配:应为 1个项目
<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>
−
−
−
−
−
确定对话过程的具体实例。从start()操作返回。
−
−
−
项目参与者的关键标识属性。
以下是我的代码和出现错误的注释:
<?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'));
?>
非常感谢您的帮助!谢谢。建立标识功能只需要一个参数,您需要传递两个参数。在过去使用SOAP和PHP时,我发现complexTypes通常需要作为数组传递 我建议试着将调用establishIdentity的行更改为以下行
$identity = $client->establishIdentity(
array(
"processId"=>$processID,
"identityAttributes"=>$identityAttributes
)
);
EstablishIdentity只需要一个参数,即复杂类型。这个复杂类型是一个包含两个项的序列,processId是string类型,identityAttributes是其他类型,从wsdl中省略。您正在创建一个StdClass$identityAttributes,它有一个单一的属性identityAttributes,然后它有各种属性,这是正确的吗?尝试下面的方法,但是我仍然没有完整的WSDL。省略
$identityAttributes->identityAttributes=new StdClass()代码>行,并将其他内容放入$identityAttributes->ssn=41441414代码>等。