我一直在研究这个问题很长时间,但我没有找到如何实现它的参考资料。目前我在服务器上使用了三个或四个操作,但最后一个操作无法给出无意义错误(“”)。
在某些测试工具中进行逆向工程我注意到HTTP版本不一样......如果有以下内容,如何将HTTP协议设置为1.1版本?
PHP
require_once('lib/nusoap.php');
$proxyhost = isset($_POST['proxyhost']) ? $_POST['proxyhost'] : '';
$proxyport = isset($_POST['proxyport']) ? $_POST['proxyport'] : '';
$proxyusername = isset($_POST['proxyusername']) ? $_POST['proxyusername'] : '';
$proxypassword = isset($_POST['proxypassword']) ? $_POST['proxypassword'] : '';
$client = new nusoap_client(
'http://www.quadranet.co.uk/qslwebservice/qslwebbooking.asmx?wsdl',
'wsdl',
$proxyhost,
$proxyport,
$proxyusername,
$proxypassword
);
$err = $client->getError();
if ($err) {
echo '<h2>Constructor error</h2><pre>'.$err.'</pre>';
}
$result = $client->call(
'BookTable',
'<request recordversion="5.0.0"><parameters locationprefix="'.$_POST['tb_w_locationprefix'].'" atdate="'.$_POST['tb_w_atdate'].'" attime="'.$_POST['tb_w_attime'].'" session="'.$_POST['tb_w_session'].'" covers="'.$_POST['tb_w_covers'].'" surname="'.$_POST['tb_w_surname'].'" title="'.$_POST['tb_w_title'].'" telephone="'.$_POST['tb_w_telephone'].'" productid="'.$_POST['tb_w_productid'].'" sourcesite="'.$_POST['tb_w_sourcesite'].'" authcode="'.$_POST['tb_w_authcode'].'" email="'.$_POST['tb_w_email'].'" forename="'.$_POST['tb_w_forename'].'" message="'.$_POST['tb_w_message'].'" /></request>'
);
SOAP REQUEST(注意它是HTTP / 1.0)
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>
答案 0 :(得分:1)
快速查看源代码,有两个函数可以将HTTP协议版本设置为1.1。
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();
答案 1 :(得分:0)
很好,usePersistentConnection()
不是nusoap_client类的方法,但我发现useHTTPPersistentConnection()
将HTTP设置为1.1。
但这并没有解决我的问题,我仍然得到错误消息的响应,其参数永远不会被发送:S
我想是另一个问题的东西。谢谢!