SoapClient running in wsdl mode does not honor OS proxy exclusions, and doesn’t seem to have a flag to add them directly.
This poses a difficulty when the schema definition references both internal and externally defined schemas.
For the test I have pulled the initial wsdl document local. I have enabled the proxy as the schema references w3.org and some other internet based schema definitions. Problem is the local document still references resources both internal and external to proxy and once I enable the proxy, it wants to send every request over it.
I have the following code:
$client = new SoapClient('SomeResource.wsdl',array(
'proxy_host'=>'10.0.0.1',
'proxy_port'=>8080,
'soap_version'=>SOAP_1_1,
'exceptions'=>true,
'trace'=>1,
'cache_wsdl'=>WSDL_CACHE_NONE,
'login'=>'username',
'password'=>'password'
));
Running strace:
stat("http://localresource.localdomain.com:1080/some/version/Common.xsd", 0x7fffd94a36d0) = -1 ENOENT (No such file or directory)
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 7
fcntl(7, F_GETFL) = 0x2 (flags O_RDWR)
fcntl(7, F_SETFL, O_RDWR|O_NONBLOCK) = 0
connect(7, {sa_family=AF_INET, sin_port=htons(8080), sin_addr=inet_addr("10.0.0.1")}, 16) = -1 EINPROGRESS (Operation now in progress)
... timeout here cause it's a local resource ...
I have of course changed the names to protect my client, but I do have localdomain.com in my no_proxy list:
somehost:someuser> env |grep proxy
http_proxy=http://10.0.0.1:8080
ftp_proxy=http://10.0.0.1:8080
https_proxy=http://10.0.0.1:8080
no_proxy=localdomain.com,localhost,127.0.0.1
Adding no_proxy to the SoapClient input has no effect.
Short of pulling all the schemas internal and modifying all those references to also point to locally defined resources, is there any way to get SoapClient to honor the no_proxy rules?
I ended up pulling all the schemas internal and modifying all those schemas to also point to locally defined schemas.