0
Good afternoon, everyone,
Setting:
"The company where I work has a proxy. But time and again there is the need to disable it and set Ipv4 settings manually."
Therefore, I can consume Soapclient for the first situation with the following parameters:
$comProxy = array(
'soap_version' => SOAP_1_2,
'login' => $user,
'password' => $pass,
'proxy_host' => \Config::$hostProxy,
'proxy_port' => \Config::$portProxy,
'proxy_login' => \Config::$userProxy,
'proxy_password' => \Config::$passProxy
);
In the second situation, the following parameters are sufficient:
$semProxy = array(
'soap_version' => SOAP_1_2,
'login' => $user,
'password' => $pass
);
Problem:
Every time there is a need to set IP settings manually, I have to change the parameters manually to make the request successful.
The following error is caused when setting the IP settings manually using the array parameters $comProxy:
Post: SOAP-ERROR: Parsing WSDL: Couldn’t load from 'http://crago.cra21.com.br/crago/xml/protestos.php?wsdl' : failed to load External Entity "http://crago.cra21.com.br/crago/xml/protestos.php?wsdl"
Trying:
Using a custom error handler, when Soapclient launches the cited exception (SOAP-ERROR), try to make a new request with the parameters of the $semProxy array. However unsuccessful, because I lose the context of the execution, besides the same force the interruption of the script.
Question:
What to do for Soapclient to recognize the proxy settings and use the correct parameters for each situation?
Have you checked if your hosting server accepts remote requests ?
– Risk
I can make requests both with and without proxy, but I have to change the configuration parameters of Soapclient manually whenever there is this change.
– lucasbento
So... the server accepts remote request. vc can edit your question by sending the rest of the code that makes this connection and request ? and the moment when you believe the error occurs? is using another language? , javascript for example to make this request? If yes, send me the event that does this.
– Risk
I’m using PHP and the code snippet is simply a
$this->wsdl = new SoapClient($url, $options);
that is inside a block Try catch. Whereas,$options
is the $comProxy or $semProxy array. I want, for example, even using $comProxy and setting the IP settings manually on the network card and/or browser, I can make the requests.– lucasbento