You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by bimjoeipa <jo...@ipaustralia.gov.au> on 2014/06/24 09:33:00 UTC

CXF "String" transport?

Hi,

What's the easiest way to get the string content of a message without
actually sending it anywhere?

Essentially what I want to do is use CXF to apply WS-Policy to a message,
but I just want the string output from the transport.  The reason I want to
do this is that I want to give SoapUI some form of WS-Policy support,
because our testers like using it for load testing and easy testing of
endpoints, but SoapUI doesn't have good enough signature support, so I
wanted to leverage CXF if I can, because we are using it in our
applications.

I realise I could use WSS4J directly, but I like the idea of having CXF
automatically configure WSS4J.

So would I just create a custom transport?
http://cxf.apache.org/docs/custom-transport.html

I don't care about the response, only about the request, so would I need
configure the transport to be one-way? 

Thanks




--
View this message in context: http://cxf.547215.n5.nabble.com/CXF-String-transport-tp5745506.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: CXF "String" transport?

Posted by Willem Jiang <wi...@gmail.com>.
You may consider to take a look at the log interceptor[1][2], you can intercept the request message do want to you want there.

[1]https://cxf.apache.org/javadoc/latest/org/apache/cxf/interceptor/LoggingInInterceptor.html
[2]https://cxf.apache.org/javadoc/latest/org/apache/cxf/interceptor/LoggingOutInterceptor.html

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On June 24, 2014 at 3:33:30 PM, bimjoeipa (joel.pearson@ipaustralia.gov.au) wrote:
> Hi,
>  
> What's the easiest way to get the string content of a message without
> actually sending it anywhere?
>  
> Essentially what I want to do is use CXF to apply WS-Policy to a message,
> but I just want the string output from the transport. The reason I want to
> do this is that I want to give SoapUI some form of WS-Policy support,
> because our testers like using it for load testing and easy testing of
> endpoints, but SoapUI doesn't have good enough signature support, so I
> wanted to leverage CXF if I can, because we are using it in our
> applications.
>  
> I realise I could use WSS4J directly, but I like the idea of having CXF
> automatically configure WSS4J.
>  
> So would I just create a custom transport?
> http://cxf.apache.org/docs/custom-transport.html
>  
> I don't care about the response, only about the request, so would I need
> configure the transport to be one-way?
>  
> Thanks
>  
>  
>  
>  
> --
> View this message in context: http://cxf.547215.n5.nabble.com/CXF-String-transport-tp5745506.html  
> Sent from the cxf-user mailing list archive at Nabble.com.
>  


Re: CXF "String" transport?

Posted by Daniel Kulp <dk...@apache.org>.
On Jun 24, 2014, at 3:33 AM, bimjoeipa <jo...@ipaustralia.gov.au> wrote:

> What's the easiest way to get the string content of a message without
> actually sending it anywhere?
> 
> Essentially what I want to do is use CXF to apply WS-Policy to a message,
> but I just want the string output from the transport.  The reason I want to
> do this is that I want to give SoapUI some form of WS-Policy support,
> because our testers like using it for load testing and easy testing of
> endpoints, but SoapUI doesn't have good enough signature support, so I
> wanted to leverage CXF if I can, because we are using it in our
> applications.
> 
> I realise I could use WSS4J directly, but I like the idea of having CXF
> automatically configure WSS4J.
> 
> So would I just create a custom transport?
> http://cxf.apache.org/docs/custom-transport.html
> 
> I don't care about the response, only about the request, so would I need
> configure the transport to be one-way? 

Hmm….. A custom transport is certainly one way to do it.   Another option COULD be to create a MessageImpl object and an ExchangeImpl object, add in stub Endpoint, BindingOperationInfo, etc… and a StringWriter content (as Writer.class type), and build up a manual PhaseInterceptorChain with the interceptors you need and just call it.   At the end of the chain, the StringWriter should have the contents you need.   That said, I’d likely go with an OutputStream class of some sort (CachedOutputStream likely) instead of a writer so things like MTOM could be put in affect.

For a starter, I’d put a custom interceptor on a client the just does System.out.println(message.getInterceptorChain().toString()) to see what interceptors are on there and use those as a starting point.   

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com