开发者

camel-cxf problem

开发者 https://www.devze.com 2023-03-11 07:23 出处:网络
I have cxf webservice and I want to call that by camel. could anybody help me. my source is: <camel:camelContext xmlns=\"http://camel.apache.org/schema/spring\">

I have cxf webservice and I want to call that by camel.

could anybody help me.

my source is:

<camel:camelContext xmlns="http://camel.apache.org/schema/spring">
    <camel:package>com.aliti.integeration开发者_开发问答</camel:package>

    <route>
        <from uri="cxf:bean:helloService?defaultOperationName=sayHello"/>
        <from uri="cxf:bean:helloService?defaultOperationName=sayHi"/>

        <log message=">>>> ${body}"/>

    </route>

</camel:camelContext>


Something like this will expose a service on localhost:8080/test and send requests through your route

from(cxf://http://localhost:8080/test?serviceClass=com.aliti.integeration.HelloService)
.choice()
    .when(header(CxfConstants.OPERATION_NAME).isEqualTo("sayHello"))
        setBody(constant("hello")
    .when(header(CxfConstants.OPERATION_NAME).isEqualTo("sayHi"))
        setBody(constant("hi");

...
public interface HelloService {
    String sayHello();
    String sayHi();
}

For more information, take a look at the camel-cxf page, the cxf unit tests and this blog post for an CXFRS example...


Just try camel in code; there you can choose your method. But in DSL mode I do'nt have any idea.

like boday say:

.choice()
    .when(header(CxfConstants.OPERATION_NAME).isEqualTo("sayHello"))
        setBody(constant("hello")
    .when(header(CxfConstants.OPERATION_NAME).isEqualTo("sayHi"))
        setBody(constant("hi");
0

精彩评论

暂无评论...
验证码 换一张
取 消