在 Camel 中复制相同的 SOAP web 服务
Duplicating a same SOAP webservice in Camel
系统公开了 SOAP 网络服务。我有一个 web 服务的 wsdl 文件。我能够发送请求并从 soap ui 获得响应。我想在我部署在 servicemix 中的骆驼路线中复制这个 wsdl SOAP web 服务,从而使我的 ESB 公开一个与系统的 web 服务类似的 web 服务。许多系统通过这种方式访问此 Web 服务以联系系统。
如何使用系统的wsdl文件复制一个webservice?
找到解决方案 - 概念是 cxf-proxying
有了系统的wsdl,创建一个类似的wsdl,根据本地主机和端口号定义Endpoints。
将 wsdl 保存到您的本地项目中,
在 pom 中提供 wsdl 的路径,通过在 cxf-codegen-plugin.
中提及将 wsdl 转换为 java
使用本地 wsdl 文件的详细信息创建 cxf 消费者 bean
<cxf:cxfEndpoint id="consumerProxy" address="http://remote:port/service/"
serviceClass="com.remote.service.RemoteService" endpointName="c:RemoteService"
serviceName="c:RemoteService" xmlns:c="http://remote/namespace/">
<cxf:properties>
<entry key="dataFormat" value="MESSAGE" />
</cxf:properties>
</cxf:cxfEndpoint>
使用远程 wsdl 文件的详细信息创建 cxf 生产者 bean
<cxf:cxfEndpoint id="producerRemote" address="http://localhost:9001/service/"
serviceClass="com.remote.service.RemoteService" endpointName="c:RemoteService"
serviceName="c:RemoteService" xmlns:c="http://remote/namespace/">
<cxf:properties>
<entry key="dataFormat" value="MESSAGE" />
</cxf:properties>
</cxf:cxfEndpoint>
代理路由可以像下面这样
从(cxfEndpoint("consumerProxy"))
.to(cxfEndpoint("producerRemote"));
向本地主机发送请求将由 cxf 端点 - consumerProxy 消费并发送到 cxf 端点 - producerRemote。
响应以相反的方式发回。
要复制由系统公开的webservice,可以使用http代理路由,基于jetty:
<route id="ServiceProxy">
<from uri="jetty:http://0.0.0.0:8186/service/?disableStreamCache=true&matchOnUriPrefix=true&continuationTimeout=900000&httpClient.timeout=120000"/>
<to uri="jetty:http://{{app-server.host}}:{{app-server.http.port}}/service/?bridgeEndpoint=true&throwExceptionOnFailure=false&continuationTimeout=120000&httpClient.timeout=900000"/>
</route>
您可以在 JavaDSL 上编写相同的路由。
系统公开了 SOAP 网络服务。我有一个 web 服务的 wsdl 文件。我能够发送请求并从 soap ui 获得响应。我想在我部署在 servicemix 中的骆驼路线中复制这个 wsdl SOAP web 服务,从而使我的 ESB 公开一个与系统的 web 服务类似的 web 服务。许多系统通过这种方式访问此 Web 服务以联系系统。 如何使用系统的wsdl文件复制一个webservice?
找到解决方案 - 概念是 cxf-proxying
有了系统的wsdl,创建一个类似的wsdl,根据本地主机和端口号定义Endpoints。
将 wsdl 保存到您的本地项目中, 在 pom 中提供 wsdl 的路径,通过在 cxf-codegen-plugin.
中提及将 wsdl 转换为 java使用本地 wsdl 文件的详细信息创建 cxf 消费者 bean
<cxf:cxfEndpoint id="consumerProxy" address="http://remote:port/service/"
serviceClass="com.remote.service.RemoteService" endpointName="c:RemoteService"
serviceName="c:RemoteService" xmlns:c="http://remote/namespace/">
<cxf:properties>
<entry key="dataFormat" value="MESSAGE" />
</cxf:properties>
</cxf:cxfEndpoint>
使用远程 wsdl 文件的详细信息创建 cxf 生产者 bean
<cxf:cxfEndpoint id="producerRemote" address="http://localhost:9001/service/"
serviceClass="com.remote.service.RemoteService" endpointName="c:RemoteService"
serviceName="c:RemoteService" xmlns:c="http://remote/namespace/">
<cxf:properties>
<entry key="dataFormat" value="MESSAGE" />
</cxf:properties>
</cxf:cxfEndpoint>
代理路由可以像下面这样
从(cxfEndpoint("consumerProxy")) .to(cxfEndpoint("producerRemote"));
向本地主机发送请求将由 cxf 端点 - consumerProxy 消费并发送到 cxf 端点 - producerRemote。 响应以相反的方式发回。
要复制由系统公开的webservice,可以使用http代理路由,基于jetty:
<route id="ServiceProxy">
<from uri="jetty:http://0.0.0.0:8186/service/?disableStreamCache=true&matchOnUriPrefix=true&continuationTimeout=900000&httpClient.timeout=120000"/>
<to uri="jetty:http://{{app-server.host}}:{{app-server.http.port}}/service/?bridgeEndpoint=true&throwExceptionOnFailure=false&continuationTimeout=120000&httpClient.timeout=900000"/>
</route>
您可以在 JavaDSL 上编写相同的路由。