2015-06-25 95 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根目录。如果你有硬编码路径,你也需要在代码中改变它们。