简体   繁体   English

Apache Camel:构建CXF使用者并调用该服务

[英]Apache Camel: Build a CXF consumer and call the service

I am confused with different options used to create a consumer endpoint. 我对用于创建消费者端点的不同选项感到困惑。
Trying to consume a webservice published at http://{ip}:{port}/webservices/name1 . 尝试使用在http://{ip}:{port}/webservices/name1 Typical endpoint looks like this: 典型端点如下所示:

<cxf:cxfEndpoint id="consume1"
                   serviceClass=""
                   address=""
                   endpointName=""
                   serviceName=""
                   wsdlURL=""
                   />

A typical route may look like this: 典型路线可能如下所示:

<route>
  <from uri="cxf:bean:consume1?dataFormat=MESSAGE"/>
  <to uri="log:output"/>
</route>

Here are my doubts: 以下是我的疑惑:

  1. What will be the value of service class here? 这里服务类的价值是多少? How would I know service class by looking at the wsdl? 通过查看wsdl我怎么知道服务类?
  2. Is the address represent service url mentioned ablove? 地址是否代表服务网址提到了ablove? I did'nt find it same looking at few exmaples 我没有发现同样看几个exmaples
  3. How would I call a particular operation and pass the input from java class? 我如何调用特定操作并从java类传递输入?

Have a look at https://camel.apache.org/cxf . 看看https://camel.apache.org/cxf Here you should find all information you need. 在这里,您应该找到所需的所有信息。 Have a special look at the Spring configuration here . 这里特别关注Spring配置。

At the link you referenced ( https://camel.apache.org/cxf-proxy-example.html ) only the configuration is described that is needed if Camel is used as a web service proxy. 在您引用的链接( https://camel.apache.org/cxf-proxy-example.html )中,仅描述了将Camel用作Web服务代理时所需的配置。

Q1: The service class is the class name of the Service Endpoint Interface which is generated from the WSDL. Q1:服务类是从WSDL生成的服务端点接口的类名。 If you use MESSAGE or PAYLOAD data format, you don't need to specify the service class. 如果使用MESSAGE或PAYLOAD数据格式,则无需指定服务类。

Q2 The address is the access point of the service, it can override the address information in the WSDL. Q2地址是服务的访问点,它可以覆盖WSDL中的地址信息。

Q3 If you want to route the request from camel to other webservice endpoint, you need to setup the route like this. Q3如果要将请求从camel路由到其他Web服务端点,则需要设置这样的路由。

<route>
  <from uri="direct:start" />
  <to uri="cxf:bean:service"/>
</route>

Than you can setup the message header of operation name and setup the invocation parameters into the message body. 您可以设置操作名称的消息头,并将调用参数设置到消息正文中。

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

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