简体   繁体   中英

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 . 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?
  2. Is the address represent service url mentioned ablove? I did'nt find it same looking at few exmaples
  3. How would I call a particular operation and pass the input from java class?

Have a look at https://camel.apache.org/cxf . Here you should find all information you need. Have a special look at the Spring configuration here .

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.

Q1: The service class is the class name of the Service Endpoint Interface which is generated from the WSDL. If you use MESSAGE or PAYLOAD data format, you don't need to specify the service class.

Q2 The address is the access point of the service, it can override the address information in the WSDL.

Q3 If you want to route the request from camel to other webservice endpoint, you need to setup the route like this.

<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.

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