Web アプリから SOAP サービスを呼び出そうとしています。SOAP クライアントは問題なく作成できますが、SOAP メソッド GetCustomer の呼び出しに問題があります。次の SOAP エラーが発生します
SOAP-ERROR: Encoding: object hasn't 'any' property.
問題は指定されたパラメーターにあると思います。パラメータは型ComplexType
であり、PHP から直接渡すかどうかはわかりません。GetCustomer メソッドからの WSDL は次のとおりです。
<s:element name="GetCustomer">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="user" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="password" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="xmlParams">
<s:complexType mixed="true">
<s:sequence>
<s:any/>
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
この問題に対処するこの記事を見つけました。これをコードに適用すると、上記のエラーが発生します。ここに私のPHPコードがあります:
$params = new StdClass();
$params->user = '****';
$params->password = '****';
$params->xmlParams = new StdClass();
$soap_options = array('trace' => 1, 'exceptions' => 1 );
$wsdl = "https://web-icdev.saop.si/iCenter_WS/SAOPWS_Customer.asmx?WSDL";
$client = new SoapClient($wsdl, $soap_options);
try {
$result = $client->GetCustomer($params);
var_dump($result);
}
catch (SOAPFault $f) {
echo $f->getMessage();
}