CakeFest 2024: The Official CakePHP Conference

SoapClient::__setLocation

(PHP 5 >= 5.0.4, PHP 7, PHP 8)

SoapClient::__setLocationConfigure l'URL du service Web à utiliser

Description

public SoapClient::__setLocation(?string $location = null): ?string

Configure l'URL cible, à qui seront envoyés les requêtes SOAP. Ce revient à spécifier l'option location lors de la construction du client SoapClient.

Note:

Cette méthode est optionnelle. SoapClient utilise l'URL indiquée dans le fichier WDSL par défaut.

Liste de paramètres

location

La nouvelle URL.

Valeurs de retour

L'ancienne URL.

Historique

Version Description
8.0.3 location est désormais nullable.

Exemples

Exemple #1 Exemple avec 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;

?>

Résultat de l'exemple ci-dessus est similaire à :

http://www.somethirdparty.com

Voir aussi

add a note

User Contributed Notes 1 note

up
0
maoneid at gmail dot com
5 years ago
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.
To Top