简体   繁体   English

如何在不具有Java组件的Mule中使用CXF SOAP服务调用数据库连接器

[英]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. 我想知道是否仍然可以在不使用Java组件的情况下调用CXF SOAP Web服务中的Mule数据库连接器。我想创建并公开将执行CRUD操作的SOAP Web服务。 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 ?? 现在,执行此操作的一般方法是创建WSDL,然后将其转换为Java接口,然后实现需要从Service层调用DAO层以执行DB操作的接口。.但是在这种情况下,我不我不想从Java类中调用数据库连接器...而是我想从Mule Flow本身中调用连接器。有什么办法可以从流级别做到这一点?

I have following Mule Flow :- 我有以下M子流:-

<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 现在,Web服务具有执行CRUD操作的若干操作
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 ? 但是我不想从Java类操作中调用数据库。相反,我想从Mule流中自行调用DB来执行CRUD ..我该怎么做?

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 在Mule 3.4及更高版本上,请使用JDBC传输: 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 在Mule 3.5及更高版本上,使用数据库连接器: 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 :- 因此,正如David建议的最终解决方案一样,我发现在<cxf:jaxws-service/>之后使用Mule 3.5 DB组件,该组件引用如下所示的接口:-

<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 !!! 它的工作原理!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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