Reputation: 2343
I have created endpoint and a route inside of my camel-context.xml
like this:
<cxf:cxfEndpoint id="testEndpoint" address="https://127.0.0.1:443/ws"
serviceClass="pl.test.ws.testWsImpl"
wsdlURL="/META-INF/wsdl/testCFService.wsdl"
endpointName="s:test_Port"
serviceName="s:testDescriptor"
xmlns:s = "test.namespace"/>
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="direct://start" />
<to uri="cxf:bean:testEndpoint" />
</route>
</camelContext>
and then I am trying to call this webservice by creating ProducerTemplate
@Produce(uri="direct:start")
ProducerTemplate pt;
and sending message into it:
pt.send(new Processor() {
public void process(Exchange exchange_) throws Exception {
TestRequest test = new TestRequest();
test.setRequest("hello world");
exchange_.getIn().setBody(test);
System.out.println(exchange_.getOut().getBody());
}});
I have WebService
locally up and running so I can see that the request is being send because it is being received, however I don't knew how to handle response.
line System.out.println(exchange_.getOut().getBody());
is returning null
value when WebService
sent Received
in response.
Can anyone tell me how to process the response from Exchange
?
Upvotes: 0
Views: 197
Reputation: 56082
The reply comes from what pt.send returns.
The process method is only for configuring the request method. Not to get the reply. The reply is from what the pt.send
returns.
Exchange reply = pt.send(...)
Also mind about OUT vs IN see this FAQ http://camel.apache.org/using-getin-or-getout-methods-on-exchange.html
Upvotes: 1