How to send headers from php to web service SOAP in java?

0

From my xampp server I consume a SOAP web service that is on a JBOSS server. When I use it I get the user and password parameters for authentication, but I send another parameter as a header and it does not arrive. If I consume the web service using SOAP UI and send the header if it arrives.

This is the code that is on my xampp server to consume the web service:

    <?php
$soap_client = new SoapClient("http://localhost:8081/miproyecto/WebServiceBean?wsdl",array('trace' => true));
$ns = "http://mins/";

$auth = new stdClass();
$auth = array('Authorization'=>'aGVucnEVTJOemc1');

$header = new SoapHeader($ns, 'Authorization', $auth);
$soap_client->__setSoapHeaders($header);

$usu="muusuario"; 
$passwd="mipass";
$entradasVal = array("usuario"=>$usu,"contrasenia"=>$passwd);
$param=array('arg0'=>$entradasVal);

try {
    $result=$soap_client->__soapCall('validar', $param);
    var_dump($result);
} catch (Exception $e) {
    echo 'Error: ' . $e;
}
?>
    
asked by Marck Vit 05.12.2016 в 17:07
source

1 answer

1

If you need to send two or more headers, __setSoapHeaders as well You can receive an arrangement. That is:

$headers = array();

$headers[] = new SoapHeader($ns, 'name1', $value1);
$headers[] = new SoapHeader($ns, 'name2', $value2);
$headers[] = new SoapHeader($ns, 'name3', $value3);

$client->__setSoapHeaders($headers);
    
answered by 05.12.2016 в 20:16