October 6th, 2008Invoking WSF/PHP Web Services Through Proxy
If you are behind a proxy server you need to configure your client to send the request through proxy. With WSF/PHP you can do it in two ways.
1. Setting proxy configuration in WSClient itself
You can use the ‘proxyHost’ and ‘proxyPort’ options to provide the proxy information through WSClient.
$client = new WSClient(array("to" => "http://my.external.host/service_url", "proxyHost" => PROXY_HOST, "proxyPort" => PROXY_PORT));
2. Use the axis2.xml
Change the axis2.xml to the following. (axis2.xml is in the wsf_c directory which is by default installed inside the php extension directory unless you specified it explicitly in your php.ini ‘wsf.home’ entry)
<transportSender name="http" class="axis2_http_sender"> <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter> <parameter name="xml-declaration" insert="false"/> <!--Here is where you set the proxy host and the port--> <parameter name="PROXY" proxy_host="MY_PROXY_HOST" proxy_port="MY_PROXY_IP" locked="true"/> </transportSender>
So if you want only to use the proxy for particular clients, you can use the former approach. But if you want to use the proxy for all the clients in your system just use the later approach so you don’t need to edit each client.
October 27th, 2009 at 3:57 pm
Just what I needed – Thanks!
October 28th, 2009 at 11:38 am
Thats really nice, may i post ur link into my blog ?
October 29th, 2009 at 2:11 am
Sure, No problem.
Dimuthu
February 26th, 2010 at 5:21 pm
Do both Options exist in WSDL mode. Ive tried these and only amending the axis2.xml file seems to work
February 26th, 2010 at 5:26 pm
Yes. both options should be working. What is the release you are working on?