Hi Dan thanks for your response,
As of your instructions i added the follwing code in my class.
myMessage(Message msgContext)
{
String xml = "<s12:Envelope> ";
byte[] theByteArray = xml.getBytes();
MessageImpl messageImpl = new MessageImpl();
Exchange exchange = msgContext.getExchange();
exchange.setInMessage(messageImpl);
exchange.put("exchange.finished", Boolean.TRUE);
messageImpl.setExchange(exchange);
messageImpl.setContent(InputStream.class , new
ByteArrayInputStream(theByteArray));
messageImpl.put(PhaseInterceptorChain.STARTING_AT_INTERCEPTOR_ID,BaseCXFLiteInterceptor.class.getName());
}
it should display the string value in response side like <s12:Envelope>. but
response is not as expected.
what is wrong in the above code is there any thing else need to do. please
help me out.
can you send me an example code if avaliable. Hope your help is required..
dkulp wrote:
>
>
> Well, stopping the current "out" chain is easy. You pretty much just
> need to
> grab the chain from the message and "pause" it.
>
> The custom response part is the tricky part and depends on how you want to
> go
> about it.
>
> Easy way, kind of "hacky", but fast as no additional processing will/can
> occur:
> Create a new MessageImpl and set the exchange.setInMessage() to it.
> do exchange.put("exchange.finished", Boolean.TRUE);
> set inMsg.setContent(List.class, .....) to a List which would represent
> the
> return valued. It should just be a list of length 1.
>
>
> Harder, but more "complete/correct" as it will call the incoming chain so
> things like Holders and wrappers and stuff can be used:
> You basically need to get the Conduit out of the out message:
>
> Exchange exchange = message.getExchange();
> Conduit conduit = exchange.getConduit(message);
>
> The conduit MOST LIKELY (all of ours except the CorbaConduit do) extend
> from
> AbstractConduit (not sure why the Corba one doesn't) which extends
> AbstractObservable which has a method: MessageObserver
> getMessageObserver()
>
> Basically, you would create a new Message, fill in the details such as the
> List as above, maybe an InputStream if your response is a stream, fake
> headers, etc.... and call the handleMessage call on that MessageObserver.
>
> That will setup a complete interceptor chain and such for the "incoming"
> message. If you need it to skip things (like not do the stream things),
> you
> can set
> message.put(PhaseInterceptorChain.STARTING_AT_INTERCEPTOR_ID, ...)
> or
> message.put(PhaseInterceptorChain.STARTING_AFTER_INTERCEPTOR_ID, ...)
>
> to have it start at a specific point.
>
>
> Hope that helps a bit!
> Dan
>
>
>
>
> On Wed September 30 2009 2:15:57 am inalasuresh wrote:
>> Hi One & All
>>
>> While we are working on Delegate (for cxfbc:provider) for FUSE, we have
>> some technical issues and need some assistance.
>>
>> Problem Description
>>
>> In OUT interceptor of a CXF provider, how can we stop the provider
>> invoking
>> its endpoint and send a response back?
>>
>> Example:
>> I have a cxfbc:provider with some interceptors configured for both IN and
>> OUT flows. When the cxf provider is making a request, the OUT interceptor
>> gets invoked and in this interceptor I would like to stop invoking actual
>> endpoint and send back my own response. That means I should be able to
>> tell
>> the interceptor chain to stop further processing of this flow, set a
>> response message into message exchange and invoke the IN flow. How do I
>> do
>> that?
>>
>> This kind of mediation/interception is possible in standard
>> specifications
>> like JAX-RPC, JAX-WS, Servlets etc… wondering if CXF provides any sort of
>> this kind.
>>
>> Also we would like to know who is invoking a provider endpoint in CXF
>> stack
>> in FUSE? Is it an OUT interceptor at the end of interceptor chain or some
>> other transport component after the interceptor chain?
>>
>> Thanks in Advance
>> Suresh
>>
>
> --
> Daniel Kulp
> [email protected]
> http://www.dankulp.com/blog
>
>
--
View this message in context:
http://www.nabble.com/In-OUT-interceptor-of-a-CXF-provider%2C-how-can-we-stop-the-provider-invoking-its-endpoint-and-send-a-response-back--tp25675554p25786647.html
Sent from the cxf-user mailing list archive at Nabble.com.