how to remove namespace prefix soap handler handleMessage

568 Views Asked by At

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("");
    }
}
0

There are 0 best solutions below