Consume web service (WSDL) in PHP

0

I do not have much practical experience with web services. I need to use some methods of this: link

Can anyone help me on how to connect to it in PHP and get the feedback?

For example: There is a method called GerarToken () that receives 3 parameters: DfUser (Type: string), DsShaha string), QueryType (Type: QueryType).

How could I use the web service to access this method and get its return (the token in that case) in a variable?

    
asked by anonymous 07.03.2018 / 19:11

1 answer

1

Try this code:

<?php
$client = new SoapClient('https://epfweb.safra.com.br/WCF/SvcContratos.svc?wsdl');
$function = 'GerarToken';
$arguments= array('GerarToken' => array(
    'DsUsuario'      => 'CSB18135',
    'DsSenha'        => 'Bb232736'
));


$result = $client->__soapCall($function, $arguments);
echo 'Response: ';
print_r($result);

?>

It may be necessary to install the SoapClient extension.

PHP: How do I install soap extension?

Do not miss:

Using SOAP with PHP

    
07.03.2018 / 20:09