简体   繁体   中英

How to invoke Database connector using CXF SOAP service in Mule without Java Component

I was wondering if there is anyway to invoke Mule Database connector in CXF SOAP webservices without using Java Component .. I want to create and expose a SOAP web service that will perform a CRUD operation. Now, for doing this the general way is to create a WSDL and then convert it into Java interface and then implement the interface where I need to call the DAO layer from Service layer to perform DB operations .. But here in this case, I don't want to call the DB Connector from Java Class... rather I want to call the connector from Mule Flow itself.. Is there any way I can do it from flow level ??

I have following Mule Flow :-

<flow name="getDesignation" doc:name="getDesignation">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8090" path="designation" doc:name="HTTP"/>
<cxf:jaxws-service serviceClass="com.getdesignation.test.services.schema.maindata.v1.GetDesignation" doc:name="CXF"/>
<component class="com.getdesignation.test.services.schema.maindata.v1.Impl.GetDesignationImpl" doc:name="Java"/>
</flow> 

Now the webservice has several operations to perform CRUD operation
But I don't want to call the Database from the Java class operation .. Instead I want to call the DB from the Mule flow it self to perform the CRUD .. How can I do so ?

Can you pls provide an example how to achieve it from flow level ... Thanks

On Mule 3.4 and before, use the JDBC Transport: http://www.mulesoft.org/documentation/display/current/JDBC+Transport+Reference

On Mule 3.5 and after, use the Database Connector: http://www.mulesoft.org/documentation/display/current/Database+Connector

So, as David suggested the final solution I found using Mule 3.5 DB component after the <cxf:jaxws-service/> which refers the interface something like below :-

<flow name="getDesignation" doc:name="getDesignation">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8090" path="designation" doc:name="HTTP"/>
<cxf:jaxws-service serviceClass="com.getdesignation.test.services.schema.maindata.v1.GetDesignation" doc:name="CXF"/>
<db:select config-ref="Oracle_Configuration" doc:name="Database">
  <db:parameterized-query><![CDATA[select ID, NAME from table1]]></db:parameterized-query>
</db:select>

and it works !!!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM