Preload SOAP in PHP

1

I am using a webservice in which I make the SOAP connection in PHP.

The problem comes when, on the first call, sometimes the data is not retrieved and you have to click again on the query button to view them.

Is there a way for this connection to be pre-loaded, or something similar, to work from the first connection?

The code I use is this:

$servicio="http://1.1.1.1/WS/Ws.asmx?WSDL";
$client = new SoapClient($servicio, $parametros);
$result = $client->getContratos($parametros);

I make the call when there is a check selected on the web.

In $ parameters there are different parameters, according to what has been filled in by the user.

As I say above, the first time it acts it always returns blank, but from the second it works perfectly.

If you test it directly on the webservice console, it's fine, always.

    
asked by Diego 03.10.2016 в 08:34
source

1 answer

3

hello at the time of initializing the client parameters should be the configuration of your client soap such as:

$client     = new SoapClient($url, array("trace" => 1, "exception" => 0)); 

in the case of consuming the service should be the parameters that you send to the webservice function that you will consume.

$result = $client->getContratos($parametros);

In the case that you need to see what you are sending, you can check the following link: link

In the case that you need to see what is being returned, I recommend this link.

link

I hope it helps you.

Greetings.

    
answered by 17.10.2016 в 06:09