2013-04-10 25 views
0

我對這個整體SOAP概念完全沒有經驗,所以我不知道當我看到錯誤時要查找什麼。 所以基本上我試圖從其他公司提取一些數據。該公司給了我一個數字證書和一些xsd文件,並要求我提供我的服務器的IP,以便他們可以將其列入白名單。正如我提到的,我不知道如何處理他們給我的文件,所以我將它們上傳到我的服務器,然後我開始使用Google搜索,並將以下代碼粘貼在一起(儘管我甚至不知道它是否會使義):SoapClient在PHP中拋出SoapFault異常:[HTTP]禁止

$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

+0

[\ [HTTP \] Forbidden也被稱爲403.](http://www.checkupdown.com/status/E403。 html) – 2013-04-11 00:46:12

+0

已解決:我的問題是我使用.wsdl文件的方式。我想我必須上傳他們提供的那個,然後在創建SoapCleint時使用它,但事實並非如此。我需要引用他們的wsdl url,它以「https:// ... asmx?WSDL」 – jagers757 2013-04-11 23:12:32

回答

0

(在評論中回答。轉換爲社區wiki答案。見Question with no answers, but issue solved in the comments (or extended in chat)

的OP寫道:

解決:我的問題是我用的是.wsdl文件的方式。我想我必須上傳他們提供的那個,然後在創建SoapClient時使用它,但事實並非如此。我需要的是參考他們的wsdl網址,其結束於類似https:......asmx?WSDL