0

I'm developing an aplication and when I imported the wsdl webservices with jaxws wsimport, this abstracted the complex types for Java classes. But it abstracted as classes just the body response and I need to get some data in the webservice response header, How can I get access to the webservice response header using jaxws on the client side?

Code:

    //Instance of Service   
    SessionCreateRQService sessionCreateService = new SessionCreateRQService();
    SessionCreatePortType requestSessionCreate = sessionCreateService.getSessionCreatePortType();

    //Get datas to request header 
    MessageHeader messageHeader = getMessageHeader(MESSAGE_ID, timestamp, URI_PartyId, Services.SessionCreateRQ ,Actions.SessionCreateRQ);
    Holder<MessageHeader> holderMessage = new Holder<MessageHeader>(messageHeader);

    //Get another datas to request header 
    Security security = getSecuritySessionCreateRQ();
    Holder<Security> holderSecurity = new Holder<>(security);

    //Get datas to quest body
    SessionCreateRQ body = new SessionCreateRQ();
    body.setPOS(getPOS());

    //Call the websevice and receiving the response.
    // ---->>>I need access the response webservice header here.<<-----
    SessionCreateRS sessionCreateRS = requestSessionCreate.sessionCreateRQ(holderMessage, holderSecurity, body);

Thank you.

1 Answers1

0

You need to add a handler in the client to do so

you can find more details here

diedu
  • 19,277
  • 4
  • 32
  • 49
  • Thanks for your help diedu, I had a problem to implement soaphandler, I had only the request nodes, but I found the solution to get the response nodes: https://stackoverflow.com/questions/2808544/java-jax-ws-web-service-client-how-log-request-response-xml/2808663#2808663 – Eder Rodrigues Aug 06 '18 at 19:37