Reputation: 1789
When initializing the SoapClient class with proxy-options, the WSDL and its methods are accessed over proxy correctly:
$client = new SoapClient(
WSDL_URL,
array(
'proxy_host' => PROXY_HOST,
'proxy_port' => PROXY_PORT
)
);
Schemas (schemaLocation) however are not getting accessed over the specified proxy:
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified">
<xs:import namespace="http://example.com/webservice/cisbase" schemaLocation="http://example.com/ws/cis_base.xsd"/>
<xs:import namespace="http://de.ws.example" schemaLocation="http://example.com/ws/is_base_de.xsd"/>
</xs:schema>
This leads to:
SOAP-ERROR: Parsing Schema: can't import schema from ...
So basically the SoapClient is trying to access the cis_base.xsd and is_base_de.xsd without proxy which is failing.
Is there a reason why the PHP SoapClient behaves like this and is there a workaround?
Upvotes: 1
Views: 15764
Reputation: 5565
Try:
$client = new SoapClient(
WSDL_URL,
array(
'proxy_host' => PROXY_HOST,
'proxy_port' => PROXY_PORT,
'stream_context' => stream_context_create(
array(
'proxy' => "tcp://$PROXY_HOST:$PROXY_PORT",
'request_fulluri' => true,
)
),
)
);
You might want to check other possible parameters in PHP documentation.
Upvotes: 0
Reputation: 566
In my code i use those options and that works great with our proxy and https protocol. I hope that will work for you to :)
'proxy_host' => PROXY_HOST,
'proxy_port' => PROXY_PORT,
'stream_context' => stream_context_create(
array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
)
)
)
Regards.
Upvotes: 4