Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I can not get this working:

$soap_client = new SoapClient("ServiciosClientes.wsdl");

$user='userAP';
$pwd='passwordAP';
$ns = "http://www.example.com/ns/ServiciosClientes";


$headerbody = array('login' => $user,
                'password' => $pwd
                );


$header = new SOAPHeader($ns, 'AuthHeader', $headerbody);


$soap_client->__setSoapHeaders($header);
$param= array("login" => "[email protected]", "password" => "[email protected]");


try {
    $result=$soap_client->__SoapCall('validarAccesoClienteTarjeta', $param);
    print_r ($result);
    echo '<br/>';
    print_r ($result->validarAccesoClienteTarjetaResult);
} catch (Exception $e) {
    echo 'Error: ' . $e->getMessage();
}

it's generate: "Error: Unauthorized". I need basic HTTP authentication (userAP/passwordAP) and authentication for method "validarAccesoClienteTarjeta" ([email protected]/[email protected]).

I don't understand where is the error.

This is the desired request, but I can do it:

POST http://ip/ServiciosClientesPort?wsdl HTTP/1.1

Accept-Encoding: gzip,deflate

Content-Type: application/soap+xml;charset=UTF-8;action="urn:ServiciosClientes/validarAccesoClienteTarjeta"

User-Agent: Jakarta Commons-HttpClient/3.1

Content-Length: 389

Authorization: Basic XXXXXXXX2E6YmFXXXXXXXXX=

Host: ip


<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ser="http://www.barik.com/ns/ServiciosClientes">

   <soap:Header/>

   <soap:Body>

      <ser:ValidarAccesoClienteTarjetaRequest>

         <ser:login>[email protected]</ser:login>

         <ser:password>[email protected]</ser:password>

      </ser:ValidarAccesoClienteTarjetaRequest>

   </soap:Body>

</soap:Envelope> 
share|improve this question
    
Solved!, The problem was version of SOAP and Content-Type –  user3279626 May 27 at 7:40
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.