Hi I have hard time extracting the following information from request XML. How do get hold of <soap:AuthHeader> piece and access ClientApplicationId and Password into Interceptor java program? <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://soap.ws.xxx.com/"> <soapenv:Header> <soap:AuthHeader> <ClientApplicationId>abcd</ClientApplicationId> <Password>xxxx</Password> </soap:AuthHeader> </soapenv:Header> <soapenv:Body> <soap:patientMatchesByMRNRqst> <MRN>1234</MRN> </soap:patientMatchesByMRNRqst> </soapenv:Body> </soapenv:Envelope> I tried to write something like this. I am able to create DepthXMLStreamReader from SoapMessage. Then, I am struck. I am fine if I am able to get hold of XML Document in the form of org.w3c.dom.Document. I can navigate through that Document. Any clues or help is appreciated. My Interceptor class: ================ public class SoapHeaderInInterceptor extends AbstractSoapInterceptor { private static Logger LOG = Logger.getLogger(PosidexServiceImpl.class); public SoapHeaderInInterceptor() { super(Phase.PRE_PROTOCOL); //getAfter().add(ReadHeadersInterceptor.class.getName()); } public void handleMessage(SoapMessage message) throws Fault { DepthXMLStreamReader xmlReader = getXMLStreamReader(message); try{ StaxUtils.toNextElement(xmlReader); System.out.println("Here's the xml:\n\n" + xmlReader.getName()); } catch (Exception e) { throw new Fault(e); } } protected DepthXMLStreamReader getXMLStreamReader(Message message) { XMLStreamReader xr = message.getContent(XMLStreamReader.class); if (xr instanceof DepthXMLStreamReader) { return (DepthXMLStreamReader) xr; } DepthXMLStreamReader dr = new DepthXMLStreamReader(xr); message.setContent(XMLStreamReader.class, dr); return dr; } }
Regards Karuna Pydipati StubHub/eBay - Platform & Services Phone: (415)222-8752 Email: [email protected] <mailto:[email protected]>
