HTTP proxy with SOAP request to non-80 port
| From: | Brodie Thiesfield | Date: | Sat, 12 Nov 2005 06:17:32 +0000 |
| Subject: | HTTP proxy with SOAP request to non-80 port | ||
| Groups: | php.soap | ||
| Request: | Send a blank email to php-soap+get-2055@lists.php.net to get a copy of this message | ||
I am trying to make a SOAP HTTP call via a proxy. However the endpoint is
not using the standard port 80 and it appears that the proxy request is not
correct. Either I am doing something wrong, or the request from PEAR SOAP or
HTTP Request is not passing on to the proxy the port that the request is
supposed to be made for. It seems that the "Host:" header of the HTTP
request is missing the desired port number. Is this a known problem or am I
doing something wrong?
Sample code for testing follows....
My versions...
HTTP_Request 1.3.0 stable
SOAP 0.9.1 betaIf the following standalone test program is run, e.g. c:\php\cli\php.exe -q test.php <?php require_once( "SOAP/Client.php" ); $soapParams = array(
'namespace' => 'http://foobar.com/my/namespace', 'soapaction' => '', 'style' => 'document', 'use' => 'literal','attachments' => 'DIME',
'parameters' => true); $proxy = array ( 'proxy_host' => 'localhost', 'proxy_port' => '8888' ); $soap = new SOAP_Client( 'http://localhost:20000/endpoint.cgi', false, null, $proxy ); $soap->setEncoding( 'UTF-8' ); $soap->setOpt( 'timeout', 5 ); $params = array( 'inString' => 'foobar' ); $result = $soap->call( 'TestEcho', $params, $soapParams ); var_dump($result); ?> The following headers are sent to the proxy server... POST /endpoint.cgi HTTP/1.0 User-Agent: PEAR-SOAP 0.8.0RC4-devel Host: localhost Content-Type: text/xml; charset=UTF-8 Content-Length: 542 SOAPAction: "" I think that the Host: header should actually read as... Host: localhost:20000 Brodie