Camel CXF POJO mode using Java DSL

二次信任 提交于 2019-12-05 05:27:23

In my experience there are some things in Camel, like calling a SOAP Web service or making a REST call, that are easier to do in a custom processor, than using a component like CXF, HTTP or HTTP4.

I usually work with Spring, so I tend to use either Spring REST template or the JaxWsPortProxyFactoryBean (for Webservice calls) for outbound calls.

Here is an example using a JAX-WS call:

    public class WebServiceProcessorBean {

    @Autowired
    private JAXWSProxy theProxy;


    public void callWebservice(Exchange exchange) {
        Response response = theProxy.call();

        //Do something with the response and Exchange.
    }
  }

The definition in the Spring application context:

<bean id="theProxyService" class="org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean">
        <property name="serviceInterface" value="XXX"/>
        <property name="wsdlDocumentUrl" value="http://xxxxx.wsdl"/>
        <property name="namespaceUri" value="xxxx"/>
        <property name="serviceName" value="xxxx"/>
        <property name="portName" value="xxxxx"/>
</bean> 

Use the WebServiceProcessorBean defined in Spring application context with beanRef() DSL method.

.beanRef("theProxyService", "callWebservice")

I try also dig into Apache Camel with CXF:).

I think exception, which is throws, is about problem with number of argument. template.sendBody(what_is_called, input_parameter_s, output_parameter);

Output parameter is the most probably return value from calling of cxf webservices.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!