for some cases , ignoring location from initialization throw exception
PHP Fatal error: Uncaught SoapFault exception: [HTTP] Could not connect to host
Better call and define the end point location manually.
(PHP 5 >= 5.0.4, PHP 7, PHP 8)
SoapClient::__setLocation — Configura la URL del servicio web a utilizar
Configura la URL destino a la cual serán enviadas las peticiones SOAP.
Esto equivale a especificar la opción location
durante
la construcción del cliente SoapClient.
Nota:
Este método es opcional. SoapClient utiliza la URL indicada en el archivo WDSL por defecto.
location
La nueva URL.
La URL anterior.
Versión | Descripción |
---|---|
8.0.3 |
location ahora es nullable.
|
Ejemplo #1 Ejemplo con SoapClient::__setLocation()
<?php
$client = new SoapClient('http://example.com/webservice.php?wsdl');
$client->__setLocation('http://www.somethirdparty.com');
$old_location = $client->__setLocation(); // unsets the location option
echo $old_location;
?>
El resultado del ejemplo sería algo similar a:
http://www.somethirdparty.com
for some cases , ignoring location from initialization throw exception
PHP Fatal error: Uncaught SoapFault exception: [HTTP] Could not connect to host
Better call and define the end point location manually.