0

I am trying to call a function on a web service defined on a Tomcat server, but I can not make the call due to a credentials failure.

The structure of this web service asks for a Basic Authorization embedded on the envelope (not the header itself). Using the SOAPui tool I have no problem to make this call entering the username and password. But using the PHP client is not possible to access the web service.

I have already tried to use nusoal library which actually works, but it doesn't help with the parameters because I can not filter the query. I mean is like this call doesn't use the parameters at all returning all the results.

I would like to give it a try with the default soapClient.

<?php
        $username = "user";
        $password = "pass";
        
        $wsdl = 'http://192.168.1.185:8080/msw/gestionSolicitudes?wsdl';
        
        $options = array(
             'Username' => $username,
             'Password' => $password,
        );

        $client = new SoapClient($wsdl, $options);
        
        $parametros = array("statusId"=>2, "startDate"=>'2019-01-01', "endDate"=>'2019-09-01', "name"=>'Maria');
        
        $result = $client->__soapCall('getSolicitudesLista', $parametros);

        foreach ($result as &$valor) {
            foreach ($valor as &$solicitud) {
                if (is_object($solicitud)) {
                    echo nl2br (">>>Solicitud init ============================================\r\n");
                    ....
                } else {
                    echo nl2br (">>>Result ============================================\r\n\r\n");
                    var_dump($solicitud);
                    echo nl2br (">>>Result ============================================\r\n\r\n");
                }
                
            }
        }

    ?>
Jason Aller
  • 3,541
  • 28
  • 38
  • 38
  • Possible duplicate of [WSDL to PHP with Basic Auth](https://stackoverflow.com/questions/10219463/wsdl-to-php-with-basic-auth) – Gürkan Sevinc Aug 13 '19 at 13:46
  • Have a look to https://stackoverflow.com/questions/10219463/wsdl-to-php-with-basic-auth – Gürkan Sevinc Aug 13 '19 at 13:46
  • Thank you _@Gürkan Sevinc_ for your post. I have already tried this solution and it didn´t worked for me. Actually that was the issue where I founded the alternative way for calling the web service with nusoap library – Sergio Campos Aug 14 '19 at 07:33

0 Answers0