Search code examples
phpsoapnusoap

NuSOAP - How to set HTTP protocol to 1.1?


I have been researching about this quite a long time and I found no references of how to accomplish it. At the moment I used three or fours operations on the server, but the last one fails giving a non-sense error ("").

Reverse engineering in some testing tools I noticed that HTTP version is not the same... Having the following, how do I set the HTTP protocol to its 1.1 version?

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 (Note it's 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>

Solution

  • Nice, usePersistentConnection() isn't a method of nusoap_client class, but I found useHTTPPersistentConnection() which sets the HTTP to 1.1.

    But this didn't fix my issue, I'm still getting responses with errors messages whose parameters are never sent :S

    Stuff for another Question I guess. Thanks!