Php NuSOAP-如何将HTTP协议设置为1.1?

Php NuSOAP-如何将HTTP协议设置为1.1?,php,soap,nusoap,Php,Soap,Nusoap,我已经对此进行了相当长的时间的研究,但我没有找到关于如何实现它的参考资料。目前,我在服务器上使用了三个或四个操作,但最后一个操作失败,并给出了一个无意义错误(“”) 逆向工程在一些测试工具中我注意到HTTP版本不一样。。。有了以下内容,我如何将HTTP协议设置为其1.1版本 PHP require_once('lib/nusoap.php'); $proxyhost=isset($\u POST['proxyhost'])$_POST['proxyhost']:''; $proxyport=is

我已经对此进行了相当长的时间的研究,但我没有找到关于如何实现它的参考资料。目前,我在服务器上使用了三个或四个操作,但最后一个操作失败,并给出了一个无意义错误(“”)

逆向工程在一些测试工具中我注意到HTTP版本不一样。。。有了以下内容,我如何将HTTP协议设置为其1.1版本

PHP

require_once('lib/nusoap.php');
$proxyhost=isset($\u POST['proxyhost'])$_POST['proxyhost']:'';
$proxyport=isset($\u POST['proxyport'])$_POST['proxyport']:'';
$proxyusername=isset($\u POST['proxyusername'])$_POST['proxyusername']:'';
$proxypassword=isset($\u POST['proxypassword'])$_POST['proxypassword']:'';
$client=新nusoap\U客户端(
'http://www.quadranet.co.uk/qslwebservice/qslwebbooking.asmx?wsdl',
“wsdl”,
$proxyhost,
$proxyport,
$proxyusername,
$proxypassword
);
$err=$client->getError();
如果($err){
回显“构造函数错误”。$err.';
}
$result=$client->call(
“书桌”,
''
);
SOAP请求(注意它是HTTP/1.0)

POST/qslwebservice/qslwebbooking.asmx HTTP/1.0
主持人:www.quadranet.co.uk
用户代理:NuSOAP/0.9.5(1.123)
内容类型:text/xml;字符集=UTF-8
SOAPAction:“http://www.resv5.com/webservices/BookTable"
内容长度:674

快速查看源代码有两个函数可将HTTP协议版本设置为1.1

function setEncoding($enc='gzip, deflate') {
    if (function_exists('gzdeflate')) {
        $this->protocol_version = '1.1';
        $this->setHeader('Accept-Encoding', $enc);
        if (!isset($this->outgoing_headers['Connection'])) {
            $this->setHeader('Connection', 'close');
            $this->persistentConnection = false;
        }
        // deprecated as of PHP 5.3.0
        //set_magic_quotes_runtime(0);
        $this->encoding = $enc;
    }
}

因此,您必须执行以下操作


很好,
usePersistentConnection()
不是nusoap_客户端类的方法,但是我发现
useHTTPPersistentConnection()
将HTTP设置为1.1

但这并没有解决我的问题,我仍然收到带有错误消息的响应,这些消息的参数从未发送过:S


我想还有一个问题。谢谢

听起来不错。目前它正在生成一个奇怪的500错误:
PHP致命错误:调用blahblah中未定义的方法nusoap_client::usePersistentConnection()。但是看起来我走的路是对的。谢谢。@jdev谢谢你。我已经编辑了我的答案。我已经很多年没有使用nusoap了,所以我忽略了验证我发布的内容。很高兴我让你走上了正确的道路:)
POST /qslwebservice/qslwebbooking.asmx HTTP/1.0
Host: www.quadranet.co.uk
User-Agent: NuSOAP/0.9.5 (1.123)
Content-Type: text/xml; charset=UTF-8
SOAPAction: "http://www.resv5.com/webservices/BookTable"
Content-Length: 674
<?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/"
xmlns:ns5636="http://tempuri.org">
<SOAP-ENV:Body>
<request recordversion="5.0.0">
<parameters locationprefix="BIS" atdate="2015-07-25" attime="20:30" session="2" covers="3" surname="Tester" title="Dr." telephone="+440123456789" productid="1" sourcesite="Test" authcode="3FD1B17E" email="name@email.com" forename="Manu" message="comments" />
</request>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
function usePersistentConnection(){
    if (isset($this->outgoing_headers['Accept-Encoding'])) {
        return false;
    }
    $this->protocol_version = '1.1';
    $this->persistentConnection = true;
    $this->setHeader('Connection', 'Keep-Alive');
    return true;
}
function setEncoding($enc='gzip, deflate') {
    if (function_exists('gzdeflate')) {
        $this->protocol_version = '1.1';
        $this->setHeader('Accept-Encoding', $enc);
        if (!isset($this->outgoing_headers['Connection'])) {
            $this->setHeader('Connection', 'close');
            $this->persistentConnection = false;
        }
        // deprecated as of PHP 5.3.0
        //set_magic_quotes_runtime(0);
        $this->encoding = $enc;
    }
}
$client = new nusoap_client('http://www.quadranet.co.uk/qslwebservice/qslwebbooking.asmx?wsdl', 'wsdl', $proxyhost, $proxyport, $proxyusername, $proxypassword);
$client->useHTTPPersistentConnection();