我对整个 SOAP 概念完全没有经验,所以我不知道在看到错误时要查找什么。所以基本上我试图从另一家公司提取一些数据。那家公司给了我一个数字证书和一些 xsd 和 wsdl 文件,并要求我提供我的服务器的 IP,以便他们可以将其列入白名单。正如我所提到的,我不知道如何处理他们给我的文件,所以我将它们上传到我的服务器,然后我开始用谷歌搜索,我把下面的代码粘贴在一起(虽然我什至不知道它是否使感觉):
$protected_url = "http://www.myurl.com/WSDLFILE.wsdl";
$my_cert_file = "http://www.myurl.com/CERTFILE.pem";
$client = new SoapClient($protected_url, array('local_cert'=> $my_cert_file,'trace'=>1));
$params->Affiliate->AffiliateID = 555;
$params->Address->AddressLine = "123 Main Street";
$params->Contact = 'No';
$result = $client->QueryAddress($params);
我收到以下错误
[10-Apr-2013 18:59:46 America/New_York] PHP Fatal error: Uncaught SoapFault exception: [HTTP] Forbidden in /home/mysite/index.php:15
Stack trace:
#0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'https://secure....', 'http://www....', 1, 0)
#1 /home/mysite/index.php(15): SoapClient->__call('QueryAddress', Array)
#2 /home/mysite/index.php(15): SoapClient->QueryAddress(Object(stdClass))
#3 {main}
thrown in /home/mysite/index.php on line 15
寻找帮助有点困难,因为我什至不知道我在寻找什么,所以任何指导都值得赞赏
编辑:我还应该补充一点,我实际上已经能够通过使用 cURL 并设置“CURLOPT_SSLCERT”选项来获得成功的响应,但我需要使用 SOAP