开发者

using nusoap returns fault code

开发者 https://www.devze.com 2023-02-08 06:35 出处:网络
making a call to a web service method with nusoap returns an error array(3) { [\"faultcode\"]=> string(11) \"soap:Client\" [\"faultstring\"]=> string(516) \"System.Web.Services.Protocols.SoapEx

making a call to a web service method with nusoap returns an error

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) "" } 

is the fault in my calling or with the soap server?

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

    var_dump($response);

Above is the call to the function, which accepts 1 parameter ($url) which I have checked as valid.

-------FULL CODE-----

<?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','lit开发者_运维技巧eral');

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>';

//*/

The request SHOULD look like this (according to the company providing the service)

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>
    ?>

Actual Full Request made by 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>

Full response:

    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>


From the error that's being returned, I'd guess (but I can't be certain without knowing which API you're trying to use) that the problem is the method name. Perhaps it's cased incorrectly? Either way, this means that the server can't direct your SOAP request to the correct module.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号