1

I need to remove all namespace prefix "bim" in the following soap request . How do i do that inside soap handler handleMessage?

<bim:AuthorizationInfo>
    <!--Optional:-->
    <bim:ApplicationId>123</bim:ApplicationId>
    <!--Optional:-->
    <bim:UserId>123</bim:UserId>
    <!--Optional:-->
    <bim:Userid>123</bim:Userid>
    <bim:Password>123</bim:Password>
</bim:AuthorizationInfo>

This code is not working:

SOAPMessage soapMsg = context.getMessage();
SOAPEnvelope envelope = soapMsg.getSOAPPart().getEnvelope();
javax.xml.soap.SOAPBody body = envelope.getBody();
@SuppressWarnings("rawtypes")
Iterator iter = body.getChildElements();
while (iter.hasNext()) {
    Object object = iter.next();

    if (object instanceof SOAPElement) {
        SOAPElement element = (SOAPElement) object;
        element.removeNamespaceDeclaration(element.getPrefix());
        element.setPrefix("");
    }
}
piyushj
  • 1,546
  • 5
  • 21
  • 29
Ajay
  • 23
  • 2
  • 9

0 Answers0