php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34950 Unable to get WSDL through proxy
Submitted: 2005-10-21 20:30 UTC Modified: 2005-10-24 16:04 UTC
From: mag at alcormizar dot com Assigned: dmitry (profile)
Status: Closed Package: SOAP related
PHP Version: 5.0.5 OS: Windows 2000, 2003, Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mag at alcormizar dot com
New email:
PHP Version: OS:

 

 [2005-10-21 20:30 UTC] mag at alcormizar dot com
Description:
------------
Hi,

    I've been trying to use the SOAP extension to get a WSDL through a proxy, but it seems that the http header sent to the proxy server are invalid. I tried with Squid 2.5.STABLE11 and Privoxy 3.0.3 without success. This is not a duplicate of the bug 29211.

    From what I see, the request sent to the proxy server is pure HTTP/1.1, with the server specified in the "Host:" header and the command being "GET /dir/xxx.wsdl HTTP/1.0".

    From the HTTP RFC, in HTTP/1.0 you can only use :

GET http://www.example.com/dir/xxx.wsdl HTTP/1.0

    With HTTP 1.1 you can use the method above or :

GET /dir/xxx.wsdl HTTP/1.1
Host: www.example.com

    Since very few (if any) proxy server fully support the HTTP/1.1 method, I suggest we stick with the good old HTTP/1.0 GET.

Reproduce code:
---------------
<?php
	$client = new SoapClient("http://service.mappoint.net/standard-30/mappoint.wsdl", array("proxy_host" => "192.168.0.18", "proxy_port" => 8118, "trace" => 1));

print_r($client->__getFunctions());
?>

Expected result:
----------------
To get the WSDL.

Actual result:
--------------
Here's a dump of the packets sent to the proxy :

0000   00 04 00 01 00 06 00 07 e9 ad 37 45 00 00 08 00  ..........7E....
0010   45 00 00 5d 39 83 40 00 40 06 7f 6a c0 a8 00 4b  E..]9.@.@..j...K
0020   c0 a8 00 12 e5 26 1f b6 af cc d9 0a f9 a0 05 e6  .....&..........
0030   80 18 05 b4 63 0d 00 00 01 01 08 0a 01 1f e0 77  ....c..........w
0040   f9 f3 92 17 47 45 54 20 2f 73 74 61 6e 64 61 72  ....GET /standar
0050   64 2d 33 30 2f 6d 61 70 70 6f 69 6e 74 2e 77 73  d-30/mappoint.ws
0060   64 6c 20 48 54 54 50 2f 31 2e 30 0d 0a           dl HTTP/1.0..

There's also this part that follow in another packet (the "Host:" header :

0000   00 04 00 01 00 06 00 07 e9 ad 37 45 00 00 08 00  ..........7E....
0010   45 00 00 52 39 85 40 00 40 06 7f 73 c0 a8 00 4b  E..R9.@.@..s...K
0020   c0 a8 00 12 e5 26 1f b6 af cc d9 33 f9 a0 05 e6  .....&.....3....
0030   80 18 05 b4 e0 16 00 00 01 01 08 0a 01 1f e0 77  ...............w
0040   f9 f3 92 17 48 6f 73 74 3a 20 73 65 72 76 69 63  ....Host: servic
0050   65 2e 6d 61 70 70 6f 69 6e 74 2e 6e 65 74 0d 0a  e.mappoint.net..
0060   0d 0a                                            ..

Then the answer from the proxy (privoxy 3 in this case) :

0000   00 00 00 01 00 06 00 10 5a 9e 16 6c 00 00 08 00  ........Z..l....
0010   45 00 00 69 97 f5 40 00 40 06 20 ec c0 a8 00 12  E..i..@.@. .....
0020   c0 a8 00 4b 1f b6 e5 26 f9 a0 05 e6 af cc d9 51  ...K...&.......Q
0030   80 18 05 a8 83 b5 00 00 01 01 08 0a f9 f3 92 18  ................
0040   01 1f e0 77 48 54 54 50 2f 31 2e 30 20 34 30 30  ...wHTTP/1.0 400
0050   20 49 6e 76 61 6c 69 64 20 68 65 61 64 65 72 20   Invalid header 
0060   72 65 63 65 69 76 65 64 20 66 72 6f 6d 20 62 72  received from br
0070   6f 77 73 65 72 0d 0a 0d 0a                       owser....

Warning: SoapClient::__construct(http://service.mappoint.net/standard-30/mappoint.wsdl) [function.--construct]: failed to open stream: HTTP request failed! HTTP/1.0 400 Invalid header received from browser in /home/http/wsdl.php on line 4

Warning: Operation in progressI/O warning : failed to load external entity "http://service.mappoint.net/standard-30/mappoint.wsdl" in /home/http/wsdl.php on line 4

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://service.mappoint.net/standard-30/mappoint.wsdl' in /home/http/wsdl.php:4 Stack trace: #0 /home/http/wsdl.php(4): SoapClient->__construct('http://service....', Array) #1 {main} thrown in /home/http/wsdl.php on line 4





Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-10-21 20:40 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [2005-10-21 21:50 UTC] mag at alcormizar dot com
I tried the latest snapshot with the same result. There was no change, the packet sent are the same, with the same result.

Regards
 [2005-10-21 22:48 UTC] tony2001@php.net
Dmitry, could you take a look at it please?
 [2005-10-24 09:46 UTC] dmitry@php.net
Fixed in CVS HEAD, PHP_5_1 and PHP_5_0.
 [2005-10-24 16:04 UTC] mag at alcormizar dot com
Thanks a lot guys
 [2017-03-21 13:45 UTC] fred at sellermania dot com
Thanks for the trick.
I have added proxy_host and proxy_port in the code and the problem is solved.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 05:01:29 2024 UTC