我尝试连接到soap api,但每次尝试调用函数时都会出现500内部错误。
我能够在没有任何问题的情况下调用$ client-> __ getFunctions(),所以我猜测代码能够连接到soap服务器吗?我可以看到我试图在数组中调用的函数:
GetCatalogFullResponse GetCatalogFull(GetCatalogFull $parameters)
继承我的代码:
$GUID = '000-000-000-000';
$user = 'user';
$pass = 'pass';
$url = 'https://example.net/webservices.asmx?WSDL';
$localCert = "cert.pem";
$options = array(
'local_cert' => $localCert,
'user' => $user,
'passphrase' =>$pass,
'soap_version' => SOAP_1_2,
);
try {
$client = new SoapClient($url, $options);
$result = $client->GetCatalogFull(['AccountGUID'=>$GUID,'UserLogin'=>$user]);
echo '<pre>';
print_r($client->__getFunctions());
} catch (SoapFault $fault) {
trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR);
}
这是我尝试使用soap客户端类创建的请求:
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<GetCatalogFull xmlns="http://www.example.com">
<AccountGUID>string</AccountGUID>
<UserLogin>string</UserLogin>
</GetCatalogFull>
</soap12:Body>
</soap12:Envelope>