0
votes

Below is my routing for a sample web service in camel and cxf.

    from("cxf:http://localhost:9000/sampleService?serviceClass=com.sample.CommonIntf")
.id("wsProxy")
.bean(MyBean.class)

Simply I am passing input pojo object to bean. And inside bean I am setting the ws response. Here is the bean class.

@Handler
public SOut handle(SInput sin){
    SOut s = new SOut();
    s.setName(sin.getName());
    s.setSurName("aa");
    return s;
}

However althoug I can see input object is converted and delivered the handler method soap response is empty.

Here is my web service signature.

public interface CommonIntf{
    SOut sampleMethod(SInput input);
}

My question is although my handler returns response, why response soap is empty ?

2

2 Answers

0
votes

I think, you just not set exchange output body (request-reply pattern).

Try to modify your route like this:

from("cxf:http://localhost:9000/sampleService?serviceClass=com.sample.CommonIntf")
.id("wsProxy")
.to("bean:MyBean?method=handle");

MyBean class must be registered in bundle context.

<bean id="MyBean" class="com.sample.MyBean"/>
0
votes

Try the following , define your CXF endpoint [as per http://camel.apache.org/schema/cxf/ ] in a endpoint definition bean, in this refer the service class, and refer the same id (for example wsCxfId)in the Camel route. So the route will be as follows:

from("cxf:bean:wsCxfId")
.id("wsProxy")
.to("bean:MyBean?method=handle");

Hope this helps.