You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Marc Giger <gi...@gmx.ch> on 2008/02/20 20:10:19 UTC

Response processor / transformer

Hi,

I have the following spring configuration:

<camelContext id="camel"
xmlns="http://activemq.apache.org/camel/schema/spring"> <route>
            <from uri="cxf:bean:routerEndpoint?dataFormat=MESSAGE"/>
            <process ref="decryptProcessor">
                <onException>
                    <redeliveryPolicy>
                        <maximumRedeliveries>0</maximumRedeliveries>                    
                    </redeliveryPolicy>                
                </onException>
                </process>
                <choice>
                    <when>
                        <methodCall bean="endpointSelector"
method="matches"/> <to
uri="cxf:bean:serviceEndpoint?dataFormat=MESSAGE"/> </when>
                    <otherwise>
                        <to uri="file://out?dataFormat=MESSAGE"/>
</otherwise> </choice>
        </route>
    </camelContext>

1. How can I add a response processor/transformer?

2. How do I apply a redeliveryPolicy on the above configuration so that
it works? The above configuration doesn't work.

3. If something goes wrong (e.g in my decryptProcessor) how can I throw
a customized SOAP-Fault with the error msg from the decryptProcessor?


4. Local Endpoints:

I have defined a local ServiceEndpoint:

<jaxws:endpoint id="sDService"
implementor="#sDServiceImpl" address="/SDServiceJAXWS">
            <jaxws:inInterceptors>
                <bean
class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor"/>
                <bean
class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor"/>
            </jaxws:inInterceptors>
</jaxws:endpoint>

And the following camel-cxf endpoint:

<cxf:cxfEndpoint id="localEndpoint"
address="/SDServiceJAXWS"
                     wsdlURL="wsdl/SDService.wsdl"
                     serviceClass="service.SDServiceImpl"
                     endpointName="s:SD"
                     serviceName="s:SDService"
                     xmlns:s="http://SDService"/>

What I would like to do is to invoke the /SDServiceJAXWS in-vm
ATM I'm a little bit confused and don't see the solution right now.
With the above config I get the following error:
java.net.MalformedURLException: no
protocol: /SalaryDeclarationServiceJAXWS

Last question for today:-):

Is there another repo with newer snapshots than 
http://people.apache.org/repo/m2-snapshot-repository/org/apache/camel/camel-cxf/1.3-SNAPSHOT/camel-cxf-1.3-20080216.034155-72.jar ?

Thanks a lot!

Cheers,

Marc

Re: Response processor / transformer

Posted by "Lukasz L." <Lu...@sabre.com>.
As for transforming the reply, what about something like this:

from( INBOUND_ENDPOINT_URI ).process( myTransformationProcessor ).pipeline(
OUTBOUND_ENDPOINT_URI, "direct:outProcessor").

from("direct:outProcessor").process( outTransformationProcessor );


in outTransformationProcessor you probably need to get and modify out
message (not in)


mario_horny wrote:
> 
> Hi all,
> 
> I'm currently facing the same questions 1 and 3 that Marc had. 
> 
> First, I want to transform a response message within the router using a
> custom processor. For processing an incoming request an implementation of
> a route in the configure() method of a RouteBuilder might look like
> 
> from( INBOUND_ENDPOINT_URI ).process( myTransformationProcessor ).to(
> OUTBOUND_ENDPOINT_URI).
> 
> This transforms the request before it is routed to the target endpoint.
> But how can I transform the reply (via a seperate route?) ?
> 
> Finally, how can I throw a custom fault in case of an error within the
> process() method of my custom processor ?
> 
> Many thanks in advance,
> Mario
> 
> 

-- 
View this message in context: http://www.nabble.com/Response-processor---transformer-tp15596535s22882p20480855.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Response processor / transformer

Posted by mario_horny <ma...@dzbank.de>.
Hi all,

I'm currently facing the same questions 1 and 3 that Marc had. 

First, I want to transform a response message within the router using a
custom processor. For processing an incoming request an implementation of a
route in the configure() method of a RouteBuilder might look like

from( INBOUND_ENDPOINT_URI ).process( myTransformationProcessor ).to(
OUTBOUND_ENDPOINT_URI).

This transforms the request before it is routed to the target endpoint. But
how can I transform the reply (via a seperate route?) ?

Finally, how can I throw a custom fault in case of an error within the
process() method of my custom processor ?

Many thanks in advance,
Mario



Marc Giger wrote:
> 
> Hi,
> 
> I have the following spring configuration:
> 
> <camelContext id="camel"
> xmlns="http://activemq.apache.org/camel/schema/spring"> <route>
>             <from uri="cxf:bean:routerEndpoint?dataFormat=MESSAGE"/>
>             <process ref="decryptProcessor">
>                 <onException>
>                     <redeliveryPolicy>
>                         <maximumRedeliveries>0</maximumRedeliveries>                    
>                     </redeliveryPolicy>                
>                 </onException>
>                 </process>
>                 <choice>
>                     <when>
>                         <methodCall bean="endpointSelector"
> method="matches"/> <to
> uri="cxf:bean:serviceEndpoint?dataFormat=MESSAGE"/> </when>
>                     <otherwise>
>                         <to uri="file://out?dataFormat=MESSAGE"/>
> </otherwise> </choice>
>         </route>
>     </camelContext>
> 
> 1. How can I add a response processor/transformer?
> 
> 2. How do I apply a redeliveryPolicy on the above configuration so that
> it works? The above configuration doesn't work.
> 
> 3. If something goes wrong (e.g in my decryptProcessor) how can I throw
> a customized SOAP-Fault with the error msg from the decryptProcessor?
> 
> 
> 4. Local Endpoints:
> 
> I have defined a local ServiceEndpoint:
> 
> <jaxws:endpoint id="sDService"
> implementor="#sDServiceImpl" address="/SDServiceJAXWS">
>             <jaxws:inInterceptors>
>                 <bean
> class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor"/>
>                 <bean
> class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor"/>
>             </jaxws:inInterceptors>
> </jaxws:endpoint>
> 
> And the following camel-cxf endpoint:
> 
> <cxf:cxfEndpoint id="localEndpoint"
> address="/SDServiceJAXWS"
>                      wsdlURL="wsdl/SDService.wsdl"
>                      serviceClass="service.SDServiceImpl"
>                      endpointName="s:SD"
>                      serviceName="s:SDService"
>                      xmlns:s="http://SDService"/>
> 
> What I would like to do is to invoke the /SDServiceJAXWS in-vm
> ATM I'm a little bit confused and don't see the solution right now.
> With the above config I get the following error:
> java.net.MalformedURLException: no
> protocol: /SalaryDeclarationServiceJAXWS
> 
> Last question for today:-):
> 
> Is there another repo with newer snapshots than 
> http://people.apache.org/repo/m2-snapshot-repository/org/apache/camel/camel-cxf/1.3-SNAPSHOT/camel-cxf-1.3-20080216.034155-72.jar
> ?
> 
> Thanks a lot!
> 
> Cheers,
> 
> Marc
> 
> 

-- 
View this message in context: http://www.nabble.com/Response-processor---transformer-tp15596535s22882p20457136.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Response processor / transformer

Posted by Willem Jiang <wi...@gmail.com>.
Hi  Marc,

I think I can give you a quick answer for the question 4 and also 
wanting to know how to resolve the 1,2,3 question ;)

If you want to use the local transport in CXF, you have to set up the 
local transport factory for the bus.
Here is an example of spring configuration in the CXF localTransport wiki[1]

[1] http://cwiki.apache.org/CXF20DOC/local-transport.html

Willem.

Marc Giger wrote:
> Hi,
>
> I have the following spring configuration:
>
> <camelContext id="camel"
> xmlns="http://activemq.apache.org/camel/schema/spring"> <route>
>             <from uri="cxf:bean:routerEndpoint?dataFormat=MESSAGE"/>
>             <process ref="decryptProcessor">
>                 <onException>
>                     <redeliveryPolicy>
>                         <maximumRedeliveries>0</maximumRedeliveries>                    
>                     </redeliveryPolicy>                
>                 </onException>
>                 </process>
>                 <choice>
>                     <when>
>                         <methodCall bean="endpointSelector"
> method="matches"/> <to
> uri="cxf:bean:serviceEndpoint?dataFormat=MESSAGE"/> </when>
>                     <otherwise>
>                         <to uri="file://out?dataFormat=MESSAGE"/>
> </otherwise> </choice>
>         </route>
>     </camelContext>
>
> 1. How can I add a response processor/transformer?
>
> 2. How do I apply a redeliveryPolicy on the above configuration so that
> it works? The above configuration doesn't work.
>
> 3. If something goes wrong (e.g in my decryptProcessor) how can I throw
> a customized SOAP-Fault with the error msg from the decryptProcessor?
>
>
> 4. Local Endpoints:
>
> I have defined a local ServiceEndpoint:
>
> <jaxws:endpoint id="sDService"
> implementor="#sDServiceImpl" address="/SDServiceJAXWS">
>             <jaxws:inInterceptors>
>                 <bean
> class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor"/>
>                 <bean
> class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor"/>
>             </jaxws:inInterceptors>
> </jaxws:endpoint>
>
> And the following camel-cxf endpoint:
>
> <cxf:cxfEndpoint id="localEndpoint"
> address="/SDServiceJAXWS"
>                      wsdlURL="wsdl/SDService.wsdl"
>                      serviceClass="service.SDServiceImpl"
>                      endpointName="s:SD"
>                      serviceName="s:SDService"
>                      xmlns:s="http://SDService"/>
>
> What I would like to do is to invoke the /SDServiceJAXWS in-vm
> ATM I'm a little bit confused and don't see the solution right now.
> With the above config I get the following error:
> java.net.MalformedURLException: no
> protocol: /SalaryDeclarationServiceJAXWS
>
> Last question for today:-):
>
> Is there another repo with newer snapshots than 
> http://people.apache.org/repo/m2-snapshot-repository/org/apache/camel/camel-cxf/1.3-SNAPSHOT/camel-cxf-1.3-20080216.034155-72.jar ?
>
> Thanks a lot!
>
> Cheers,
>
> Marc
>
>