Skip to content

Instantly share code, notes, and snippets.

@lucasferreira
Last active November 20, 2017 18:49
Show Gist options
  • Save lucasferreira/cea21205b0554895d14d755a33379fd4 to your computer and use it in GitHub Desktop.
Save lucasferreira/cea21205b0554895d14d755a33379fd4 to your computer and use it in GitHub Desktop.
<?php
try {
$wsUrl = "HTTP://URL_COMPLETA_DO_WEBSERVICE?WSDL"; // normalmente as URLs de WS contém esse `?WSDL` no final...
$clientSoap = new SoapClient($wsUrl, array(
'features' => SOAP_SINGLE_ELEMENT_ARRAYS,
"trace" => true,
"encoding" => "utf-8",
"exceptions" => true,
"connection_timeout" => 120,
"cache_wsdl" => WSDL_CACHE_NONE,
));
$result = $clientSoap->NOME_DO_METODO_DISPONIBILIZADO(array("PARAMETRO" => "VALOR"));
print_r($result);
} catch(SoapFault $ex) {
print_r($ex); // erro na tentativa de consumo
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment