2015-06-25 94 views
1

我的網站在windows azure web-app上。我正在使用SOAP消息。SOAP:HTTP Bad Request

$soap_client = new SoapClient("http://ip_address/service.asmx?WSDL", array("trace" => true)); 

$params = new \SoapVar('<?xml version="1.0" encoding="utf-8"?> 
       <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
       <soap:Body> 
        <Beneficiary_Address1 xmlns="" /> 
        <Beneficiary_Address2 xmlns="" /> 
        <Beneficiary_Address3 xmlns="" /> 
        <Beneficiary_ZIP_Code xsi:nil="true" xmlns="" /> 
        <Beneficiary_EmailID xsi:nil="true" xmlns="" /> 
        <Beneficiary_Contact_No xmlns="" /> 
       </soap:Body> 
       </soap:Envelope>', XSD_ANYXML); 

try{ 
    $response = $soap_client->__soapCall('RemittanceService', array($params)); 
    highlight_string($soap_client->__getLastRequest()); 
} 
catch(SoapFault $fault){ 
    die("SOAP Fault: fault code: {$fault->faultcode}, fault string: {$fault->faultstring}"); 
} 

而且它給我這個fault message

故障代碼:HTTP,錯誤字符串:錯誤的請求

我不知道這是什麼意思?如果您需要更多信息,請與我們聯繫。 謝謝。

堆棧跟蹤

SoapFault exception: [HTTP] Bad Request in /var/www/mtes/public_html/application/controllers/bank_api_pnb.php:146 
Stack trace: 
#0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'http://124.124....', 'http://tempuri....', 1, 0) 
#1 /var/www/mtes/public_html/application/controllers/bank_api_pnb.php(146): SoapClient->__soapCall('RemittanceServi...', Array) 
#2 [internal function]: Bank_api_pnb->test() 
#3 /var/www/mtes/public_html/system/core/CodeIgniter.php(359): call_user_func_array(Array, Array) 
#4 /var/www/mtes/public_html/index.php(220): require_once('/var/www/mtes/p...') 
#5 {main} 
+0

您是否嘗試過使用user4962020提到的方式來查找更詳細的信息?爲了找到異常的原因,它需要比faulttring'壞請求'更多的信息。 –

+0

@ MingXu-MSFT:我用整個故障變量更新了我的問題。 –

+0

感謝您的更新。我同意user4962020,請檢查最新的答案,看看它是否有幫助。 –

回答

-1

的SOAPFault是一個PHP類,http://php.net/manual/en/soapfault.soapfault.php,目標$故障必須有$的faultcode和$創建時faultstring, $ faultactor,$細節,$的faultName和$ headerfault中是可選的,默認爲空。

你從例外中看到了什麼, $ faultcode是「soap:Server」, $ faultstring是「Orchestration schedule引發的異常」。

對於調試,您可以添加在c​​atch語句中的var_dump($故障),它可以爲你提供更多的信息,如$ faultactor,$細節,$的faultName,和$ headerfault中。

0

Linux上的路徑 '的/ var/WWW/MTES/......' 是無效的,它是Web根目錄。當您遷移到Azure應用程序時,Azure應用程序上的Web根目錄是wwwroot,您可能需要更改配置和應用程序設置以指向正確的Web根目錄。如果你有硬編碼路徑,你也需要在代碼中改變它們。