PHP SoapClient Proxy Settings for WSDL and Service Calls
Configure PHP SoapClient proxy options for WSDL loading and service calls without injecting credentials into User-Agent.
Remote WSDL loading can happen inside the SoapClient constructor. Supply the proxy before that first retrieval:
$client = new SoapClient('https://service.example.com/api?wsdl', [
'proxy_host' => '203.0.113.10',
'proxy_port' => 8080,
'proxy_login' => getenv('PROXY_USER'),
'proxy_password' => getenv('PROXY_PASSWORD'),
'connection_timeout' => 5,
'exceptions' => true,
]);Use the real WSDL, proxy host/port and intended credential source. The host field is an address, with its port separate.
| When it fails | Request or operation to inspect |
|---|---|
| Client construction | WSDL retrieval or document processing. |
| Imported document/schema processing | The actual additional retrieval URL. |
| A SOAP method call | The service endpoint declared in the WSDL, possibly on another host. |
A worker using cached WSDL may skip the request that fails on another machine. Keep cache configuration and the actual failed URL with the comparison rather than change the proxy based only on construction success.
proxy_login/proxy_password authenticate the intermediary. Destination login/password and SOAP-level service authentication serve other layers. Use the dedicated options rather than put account-like headers into User-Agent; required application headers belong in a supported header interface.
Record the operation, target and party issuing a challenge with secrets removed. connection_timeout bounds connection establishment, not the complete duration of a long SOAP operation.