2011-02-02 157 views
0

在我的呼喚或與SOAP服務器進行調用Web服務方法用的NuSOAP返回錯誤使用的NuSOAP返回錯誤代碼

array(3) { ["faultcode"]=> string(11) "soap:Client" ["faultstring"]=> string(516) "System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: . at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest() at System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message) at System.Web.Services.Protocols.SoapServerProtocol.Initialize() at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)" ["detail"]=> string(0) "" } 

是錯?

$response = $qes->call('GetXhtml',$url); 

    var_dump($response); 

上面是對函數的調用,它接受1個參數($ url),我已經檢查了它的有效性。

-------全碼-----

<?php 
//include nusoap class 
require 'extensions/nusoap/lib/nusoap.php'; 

//connect to QES 
$qes = new nusoap_client("https://www.qes24.com/swindon/ppa/uat/contentserver/contentserver/contentserver.asmx"); 
$qes->useHTTPPersistentConnection(); 
$qes->soap_defencoding = 'utf-8'; 

//check connection 
$error = $qes->getError(); 

//get current page 
$curl = curPageURL();//function derives current URL 
$furl = $curl."?Type=8AFCCCB9-93DC-421E-A617-92A990EC99A7"; 
$param = array('url' => $furl); 



$response = $qes->call('getXhtml', $param, '','http://tempuri.org/GetXhtml', array('content-type' => 'UTF-8'), true,null,'rpc','literal'); 

fb::log($response); 

// Display the request and response 
echo '<h2>Request</h2>'; 
echo '<pre>' . htmlspecialchars($qes->request, ENT_QUOTES) . '</pre>'; 
echo '<h2>Response</h2>'; 
echo '<pre>' . htmlspecialchars($qes->response, ENT_QUOTES) . '</pre>'; 

//*/ 

請求應該是這樣的(根據該公司提供的服務)

POST /swindon/ppa/uat/ContentServer/ContentServer/ContentServer.asmx HTTP/1.1 
Host: www.qes24.com 
Content-Type: text/xml; charset=utf-8 
Content-Length: length 
SOAPAction: "http://tempuri.org/GetXhtml" 

<?xml version="1.0" encoding="utf-8"?> 
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 
    <soap:Body> 
    <GetXhtml xmlns="http://tempuri.org/"> 
     <url> http://localhost/waggleb/?Type=8AFCCCB9-93DC-421E-A617-92A990EC99A7</url> 
    </GetXhtml> 
    </soap:Body> 
</soap:Envelope> 
    ?> 

實際完全請求由作出的NuSOAP:

POST /swindon/ppa/uat/contentserver/contentserver/contentserver.asmx HTTP/1.1 
Host: www.qes24.com 
User-Agent: NuSOAP/0.9.5 (1.123) 
Connection: close 
Content-Type: text/xml; charset=utf-8 
SOAPAction: "http://tempuri.org/GetXhtml" 
Content-Length: 516 

<?xml version="1.0" encoding="utf-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Header><content-type xsi:type="xsd:string">UTF-8</content-type></SOAP-ENV:Header><SOAP-ENV:Body><url xsi:type="xsd:string">http://localhost/waggleb/?Type=8AFCCCB9-93DC-421E-A617-92A990EC99A7</url></SOAP-ENV:Body></SOAP-ENV:Envelope> 

完全響應:

HTTP/1.1 200 OK 
Date: Mon, 07 Feb 2011 10:50:25 GMT 
Server: Microsoft-IIS/6.0 
X-Powered-By: ASP.NET 
X-AspNet-Version: 2.0.50727 
Cache-Control: private, max-age=0 
Content-Type: text/xml; charset=utf-8 
Content-Length: 329 

<?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><GetXhtmlResponse xmlns="http://tempuri.org/"><GetXhtmlResult /></GetXhtmlResponse></soap:Body></soap:Envelope> 

回答

1

從返回的錯誤,我猜(但我不能確定不知道你正在嘗試使用哪個API)問題是方法名稱。也許它是不正確的嗎?無論哪種方式,這意味着服務器無法將SOAP請求定向到正確的模塊。

+0

https://www.qes24.com/swindon/ppa/uat/contentserver/contentserver/contentserver.asmx - >這裏是服務 – 2011-02-02 12:36:15