Consume PHP Web Service

Asked

Viewed 634 times

1

I’m trying to consume a Web Service and I’m not getting the expected results.

Apparently the mistake I could understand is in the structure as I’m going through the Vector of arguments to call the method, I have tried to do several ways and still continue with the error.

The web service request structure I’m using is presented below.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://services.senior.com.br">
      <soapenv:Body>
        <ser:ColaboradoresAdmitidos>
          <user>String</user>
          <password>String</password>
          <encryption>Integer</encryption>
          <parameters>
            <NumEmp>Integer</NumEmp>
            <AbrTipCol>String</AbrTipCol>
            <IniPer>DateTime</IniPer>
            <FimPer>DateTime</FimPer>
          </parameters>
        </ser:ColaboradoresAdmitidos>
      </soapenv:Body>
    </soapenv:Envelope>

My PHP code is this:

$url = new SoapClient('http://10.50.3.3:8080/g5-senior-services/rubi_Synccom_senior_g5_rh_fp_colaboradoresAdmitidos?wsdl');

    $funcao     = 'ColaboradoresAdmitidos';
    $argumentos = array('ColaboradoresAdmitidos'=> 
                          array('user'        => 'USER',
                                'password'    => 'XXX',
                                'encryption'  =>  0,
                                'parameters'  => 
                                array('NumEmp'=> 1,

                                      'AbrTipCol' => 1,

                                      'IniPer'    => '01/01/2018',

                                      'FimPer'    => '01/01/2018')
                           ) 
                  );

$opcoes  = array('location' => 'http://10.50.3.3:8080/g5-senior-services/rubi_Synccom_senior_g5_rh_fp_colaboradoresAdmitidos');
$result  = $url->__soapCall($funcao,$argumentos,$opcoes);

The result I get is this: An error occurred when executing the service "AP - Employees admitted": Values of mandatory parameters were not informed.

Details: Mandatory parameters not informed:

  • Numemp
  • Abrtipcol
  • Iniper

Detail that I am passing the parameters that the message says I did not pass, if anyone can help me, maybe I am just missing in the assembly of array of arguments for the method call soap__call

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.