axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Rosemann <alexander.rosem...@gmail.com>
Subject Re: remove element from soap body
Date Mon, 09 Nov 2009 11:54:37 GMT
Hi Isuru,

Thanks for your help. It works!
In case someone else encounters a similar issue, that's how I did it 
(removes the very first element of the SOAP body):

SOAPBody body = oMessageContext.getEnvelope().getBody();

OMElement first = body.getFirstElement();
OMElement second = first.getFirstElement();

// remove the first element from the body
first.detach();

// add the request element to the body
body.addChild(second);

Regards,
-Alex

Isuru Suriarachchi wrote:
> Hi Alex,
> 
> Use omElement.detach() method..
> 
> Thanks,
> ~Isuru
> 
> On Mon, Nov 9, 2009 at 2:33 PM, Alexander Rosemann 
> <alexander.rosemann@gmail.com <mailto:alexander.rosemann@gmail.com>> wrote:
> 
>     Hi,
> 
>     I was wondering what's the best way to alter a soap body within a
>     handler. I have the soap body (SOAPBody body =
>     msgCtx.getEnvelope().getBody();) and can navigate though it's
>     elements but don't know how to alter (i.e. remove) a certain element.
> 
>     Since I haven't found anything on the web, I was wondering whether
>     somebody tried to achieve the same and could point me into the right
>     direction.
> 
>     I'm using Axis2 1.4.1.
> 
>     Thanks in advance,
>     Alex
> 
> 
> 
> 
> -- 
> Senior Software Engineer,
> WSO2 Inc. http://wso2.org/
> Blog : http://isurues.wordpress.com/


-- 
DI(FH) Alexander Rosemann
open source based software solutions
Naunspitzweg 3 | 6341 Ebbs | Austria
mobile: +43-681-10337082 | email: alexander.rosemann@gmail.com

Mime
View raw message