Nusoap and symfony3

3

Problem to connect with web service. My code is as follows:

$client = new \nusoap_client('clientesoap', true);
$param= array('parametro1'=> value1, 'parámetro2'=>'value2');
$result = $client->call('metodo', array('parameters' => $param), '', '', false, true);

the two parameters that happened to those requested by the webservice method but not entered.

    
asked by Nicoo1991 18.05.2017 в 12:15
source

1 answer

1

In the definition of the parameters of the call to Synchro (in the WSDL ) appears:

<element name="SynchroRequest">
  <complexType>
    <sequence>
      <element name="kind" type="int"/>
      <element name="campaignId" type="long"/>
    </sequence>
  </complexType>
</element>

As you can see there is no parameter called parameters , but there is a <sequence> (a matrix), so we must send you a matrix in which, for example, the first element has the parameters kind and campaignId desired.

It is likely to be designed like this to allow synchronizing several campaigns in a single call by adding as many elements to the matrix as we need.

Using the PHP native SOAP client:

<?php
$client = new \SoapClient('http://v3lademo.fidely.net/fnet3web/proxy/wsdl_ca.php?v=01.02');
$result = $client->__soapCall(
    'Synchro',
    [
        [
            'kind'=> 3,
            'campaignId'=>'803'
        ]
    ]
);
// $result->answerCode / $result->session
var_export($result);

Using nusoap :

<?php
require 'lib/nusoap.php';
$client = new \nusoap_client('http://v3lademo.fidely.net/fnet3web/proxy/wsdl_ca.php?v=01.02', true);
$param = array('kind' => 3, 'campaignId' => '803');
$result = $client->call('Synchro', [ $param ], '', '', false, true);
// $result['answerCode'] / $result['session']
var_export($result);
    
answered by 18.05.2017 / 12:21
source