You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by gcsaba2ms <cs...@morganstanley.com> on 2013/02/27 12:24:21 UTC

How to remove node from web result?

Hello,

I have a method that looks like this:

@WebMethod(operationName = "MyRequest")
public Element doStuff(@WebParam(name="MyRequest") Element body) {
   return process(body);
}

The response from this method looks like this:

<MyRequestResponse>
   // result from process()
</MyRequestResponse>

Is there a way to get rid of the "MyRequestResponse" node? I only want to
output the element received from process()

Thanks in advance!



--
View this message in context: http://cxf.547215.n5.nabble.com/How-to-remove-name-Response-node-from-web-result-tp5723799.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: How to remove node from web result?

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 27/02/13 11:24, gcsaba2ms wrote:
> Hello,
>
> I have a method that looks like this:
>
> @WebMethod(operationName = "MyRequest")
> public Element doStuff(@WebParam(name="MyRequest") Element body) {
>     return process(body);
> }
>
> The response from this method looks like this:
>
> <MyRequestResponse>
>     // result from process()
> </MyRequestResponse>
>
> Is there a way to get rid of the "MyRequestResponse" node? I only want to
> output the element received from process()
>
Sure, have a look at

http://cxf.apache.org/docs/transformationfeature.html#TransformationFeature-Droppingoutputandinputelements

HTH, Sergey

> Thanks in advance!
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/How-to-remove-name-Response-node-from-web-result-tp5723799.html
> Sent from the cxf-user mailing list archive at Nabble.com.



Re: How to remove node from web result?

Posted by Sergey Beryozkin <sb...@gmail.com>.
On 27/02/13 12:13, gcsaba2ms wrote:
> Hi Sergey,
>
> Thanks for your reply. Looks like I can't use that because we're using
> Apache CXF 2.2.10 while the StaxTransformFeature appeared in 2.5.
>
> Maybe I could reproduce the functionality? I've looked at the source code of
> 2.5 and looks like it's the TransformOutInterceptor and OutTransformWriter
> that does the actual work. However, in 2.2.10 the whole
> org.apache.cxf.staxutils.transform package is missing, so I don't know where
> to begin.
>
> Is there some other solution?
>
I guess you can try to do something similar with a custom interceptor, 
or consider migrating to CXF 2.5.x. May be using JAXWS Provider<Source> 
can help too ?

Cheers, Sergey
>
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/How-to-remove-name-Response-node-from-web-result-tp5723799p5723806.html
> Sent from the cxf-user mailing list archive at Nabble.com.


Re: How to remove node from web result?

Posted by gcsaba2ms <cs...@morganstanley.com>.
I managed to solve the problem with an out interceptor. I take the message
content and remove the top element from there. Then I take the message info
part and set the name of the part to the previously deleted element (thus
renaming the head element to the deleted element). It works but it's not
pretty... :(



--
View this message in context: http://cxf.547215.n5.nabble.com/How-to-remove-name-Response-node-from-web-result-tp5723799p5723807.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: How to remove node from web result?

Posted by gcsaba2ms <cs...@morganstanley.com>.
Hi Sergey,

Thanks for your reply. Looks like I can't use that because we're using
Apache CXF 2.2.10 while the StaxTransformFeature appeared in 2.5. 

Maybe I could reproduce the functionality? I've looked at the source code of
2.5 and looks like it's the TransformOutInterceptor and OutTransformWriter
that does the actual work. However, in 2.2.10 the whole
org.apache.cxf.staxutils.transform package is missing, so I don't know where
to begin.

Is there some other solution?





--
View this message in context: http://cxf.547215.n5.nabble.com/How-to-remove-name-Response-node-from-web-result-tp5723799p5723806.html
Sent from the cxf-user mailing list archive at Nabble.com.