How to get OMElement by name in mediate?
Question
I have a response message like this:
<message>
<header>
<TransactionID>1</TransactionID>
<Timestamp>2012-05-22 10:10:36</Timestamp>
<OpCode>BOSS_DELETE_USER_SME.CD</OpCode>
<MsgType>RESP</MsgType>
<ReturnCode>1016</ReturnCode>
<ErrorMessage>uif return error message!</ErrorMessage>
</header>
</message>
I need convert RetuenCode "1016" to "0" in extension class. How to get OMElement "ReturnCode" in mediate? My code is failed.
SOAPEnvelope envelope = context.getEnvelope();
SOAPBody soapBody = envelope.getBody();
QName ReturnCode = new QName(null, "ReturnCode");
OMElement response = soapBody.getFirstChildWithName(ReturnCode);
Solution
The section
<header>
Is it inside the SOAP body ? if that is the case first you need to get the Header element from SOAP body and then get the first child with name ReturnCode from that element.
cheers, Charith
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow