Net_URL problem with SOAP_WSDL
| From: | Alok K. Dhir | Date: | Wed, 08 Jan 2003 04:23:16 +0000 |
| Subject: | Net_URL problem with SOAP_WSDL | ||
| Groups: | php.pear.dev php.soap | ||
| Request: | Send a blank email to pear-dev+get-12186@lists.php.net to get a copy of this message | ||
When attempting to set up a client to consume web services in my
development environment, I ran in to problems with the
SOAP_WSDL_Cache->get method -- after a pause of several seconds, it
always returned a fault because of inability to retrieve the WSDL file.
After some tracing, I found the culprit in the constructor of the
Net_URL class (which is called by HTTP_Request - for no real apparent
reason other than to perhaps justify the existence of Net_URL near as I
can tell, but I digress). My dev environment happens to be running on
port 8080, so the Net_URL class was setting the port of the WSDL file's
URI to 8080 as well.
The constructor tries to be overly smart (IMNSHO) and pulls the port
number from $HTTP_SERVER_VARS['HTTP_HOST'] irrespective of the url
provided to the method. This is clearly not the right thing to do, as
the host/port of the calling host should have zero bearing on the
desired URI being created through Net_URL.
If anything, the attempt to determine the port should use the incoming
URL (if specified), or simply default to 80 (or, for the pedantic,
default to nothing).
Seems the offending code (which "figures out the port") should be
removed from Net_URL.
Finally, would it not be faster to use php's native ability to fopen a
URL, or perhaps use curl? Why go through HTTP_Request at all?
Al