Aliti
Aliti

Reputation: 2105

camel-cxf problem

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>

Upvotes: 0

Views: 1017

Answers (2)

user3297252
user3297252

Reputation:

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");

Upvotes: 0

Ben ODay
Ben ODay

Reputation: 21015

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

Upvotes: 2

Related Questions