jpa - Saving WS payload into database in Camel -


i'm absolutely newbie in apache camel. i'd create simple app in accept ws calls , save payload database using jpa. payload's structure quite simple. root marriage object. contain string , int , date fields, wife, husband , list of children (person objects).

my goal save these data 2 tables of database: marriage, person.

i've created jaxws:endpoint in listen , respond dummy response. i've created tables , jpa entities.

i don't know how "connect" ws implementation spring configured jpatemplate. should solve problem camel routing using somehow @converter class or @injet ws implementing class spring. i'm confused.

should use cxf endpoint instead of jaxws endpoint?

you need use camle-cxf endpoint if want use camel. expose endpoint camle-cxf endpoint. this:

<camel-cxf:cxfendpoint id="listenerendpoint"                        address="http://0.0.0.0:8022/dummy/services/dummy"                        wsdlurl="wsdl/dummyservice.wsdl"                        xmlns:tns="http://dummy.com/ws/dummy"                        servicename="tns:dummy"                        endpointname="tns:dummyservice">     <camel-cxf:properties>         <entry key="schema-validation-enabled" value="true"/>         <entry key="dataformat" value="payload"/>     </camel-cxf:properties> </camel-cxf:cxfendpoint> 

then have simple spring bean this:

<bean id="processor" class="com.dummy.dummyprocessor">      <property name="..." value="..."/> //there goes data source of jdbc template or whatever... </bean> 

if want use jpa configure configuration , inject entity manager bean.

the actual class this:

public class dummyprocessor {      @trancational //if need transaction @ level...     public void processrequest(exchange exchange) {         yourpayloadobject object = exchange.getin().getbody(yourpayloadobject.class);         //object - object soap request, can data , store in database.     } } 

the camel route this:

<camel:camelcontext trace="true" id="camelcontext" >      <camel:route id="listenerendpointroute">         <camel:from uri="cxf:bean:listenerendpoint?dataformat=pojo&amp;synchronous=true" />         <camel:log message="got message. expected operation :: ${headers.operationname}"/>         <camel:choice>             <camel:when>                 <camel:simple>${headers.operationname} == 'yourpayloadobject'</camel:simple>                 <camel:bean ref="processor" method="processrequest"/>             </camel:when>         </camel:choice>         <camel:log message="got message before sending target: ${headers.operationname}"/>         <camel:to uri="cxf:bean:sometargetendpointorsomethingelse"/>         <camel:log message="got message received target ${headers.operationname}"/>     </camel:route>  </camel:camelcontext> 

hope helps.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -