我正在尝试从php客户端调用wcf ws
WSDL https://ws-web.test.nhn.no/v1/AR?wsdl
$url = 'https://ws-web.test.nhn.no/v1/AR?wsdl';
$params = array('login' => '*****',
'password' => '######',
'soap_version' => SOAP_1_2,
'trace' => TRUE);
$client = new SoapClient($url, $params);
var_dump($client->__soapCall("Ping"));
使用上面的代码,我总是得到null
响应,并且无法从wsdl
调用其他函数
如果我尝试使用其他语法执行此操作,有时我会得到action mismatch error
,并且在 Soap UI 中也会得到null
响应。
基于 WSDL,Ping 函数有一个输入消息。
<wsdl:operation name="Ping">
<wsdl:input wsam:Action="http://register.nhn.no/CommunicationParty/ICommunicationPartyService/Ping" message="tns:ICommunicationPartyService_Ping_InputMessage"/>
<wsdl:output wsam:Action="http://register.nhn.no/CommunicationParty/ICommunicationPartyService/PingResponse" message="tns:ICommunicationPartyService_Ping_OutputMessage"/>
</wsdl:operation>
输入消息由此处定义的参数组成...
<wsdl:message name="ICommunicationPartyService_Ping_InputMessage">
<wsdl:part name="parameters" element="tns:Ping"/>
</wsdl:message>
最后,Ping 对象看起来没有任何属性。奇怪。
<xs:element name="Ping">
<xs:complexType>
<xs:sequence/>
</xs:complexType>
</xs:element>
所以试一试。
$pingObj = new stdClass();
$client->__soapCall("Ping", [$pingObj]);