I am pretty new with JAX-WS, I would like to get a value in the Response Data of my Soap Handler but I do not know how.
Below is the soap response in XML:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tsn="http://TestSession/BSCS_SessionManager" xmlns:ses="http://TestSession">
<soapenv:Header/>
<soapenv:Body>
<tsn:LogonResponse>
<ses:CS_ServiceHeader>
<SourceSystem>SRCSYS</SourceSystem>
<TargetSystem>TGTSYS</TargetSystem>
<ExternalID>20150525043213</ExternalID>
<AgentName>JOHNDOE</AgentName>
</ses:CS_ServiceHeader>
<ses:CS_LogonResponse>
<CS_LogonResponseData>
<Signature>b9n9+BWWvJ0=|Qe9HGWuQXKt8zb6oaIoseiyIMsdy+svIYASZJLEy6bhmICr4LkNkOHrvLeDWAItQ7YU17N0eRDq0X36Ls8GSXR75SDsovL6DjAgSpN0AuC/BEkTJcQjVft1buhqfiyMrHsoqMU9c2vM=</Signature>
</CS_LogonResponseData>
</ses:CS_LogonResponse>
<ses:Trailer>
<Version>0.0.1</Version>
</ses:Trailer>
</tsn:LogonResponse>
</soapenv:Body>
</soapenv:Envelope>
I would like to get the value of <Signature>
inside <CS_LogonResponseData>
. I used the following but it seems to work only in stand alone application.
Code:
SOAPMessage soapMsg = context.getMessage();
SOAPBody body = soapMsg.getSOAPBody();
body.getChildNodes().item(0).getChildNodes().item(3).getChildNodes().item(1).getChildNodes().item(1).getTextContent();
When I use the same code in my project... the result is always null.
Is there a way I can navigate from the response data and get value of <Signature>
... the childnodes items indexes seems to be changing when run as standalone application and when run via tomcat.
I will be needing the signature value in the resquest data of my other operation (like logout, etc).
Thanks in advance