Ver Mensaje Individual
  #1 (permalink)  
Antiguo 06/05/2010, 12:57
ruls
 
Fecha de Ingreso: mayo-2010
Mensajes: 1
Antigüedad: 14 años
Puntos: 0
Pregunta Web Service Client + Netbeans 6.8

Hola,

Espero alguien me pueda ayudar... estoy haciendo un cliente para un WSDL con Netbeans 6.8.

El problema es que los SOAP requests necesitan llevar en el header un usuario y contraseña.

Mi pregunta es, ¿como puedo agregar esos valores al SOAP header?

El request es algo parecido a esto:

Código HTML:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://requisition.api.newscale.com">
   <soapenv:Header>
      <req:AuthenticationToken>
         <req:Username></req:Username>
         <req:Password></req:Password>
      </req:AuthenticationToken>
   </soapenv:Header>
   <soapenv:Body>
      <req:getServiceDefinition>
          </req:getServiceDefinition></req:serviceName>
      </req:getServiceDefinition>
   </soapenv:Body>
</soapenv:Envelope> 
y asi es como lo estoy invocando:

Código:
out.println("New Requisition Service"+"<br />");
RequisitionService service = new RequisitionService(new URL("XXXX?wsdl"), new QName("WWWWW", "RequisitionService"));
RequisitionServicePortType port = service.getRequisitionServiceHttpPort();
AuthenticationToken authentication = new AuthenticationToken();
        
// TODO initialize WS operation arguments here
String username = "SSSS";
String password = "12345678";

// TODO process result here
authentication.setUsername(username);
authentication.setPassword(password);

ServiceDefinition result = port.getServiceDefinition();
out.println("Requesting Service Definition: " + result+"<br />");