-
1. Re: HOW TO REPLY BACK TO WEBSERVICE INCOMING CALL
mahesh_maheshs Aug 10, 2009 1:56 AM (in response to khaliqgaffar)Hi,
If you use CXF endpoint as the first service in your eip diagram. The route is exposed as a webservice. The wsdl is accessed by "?wsdl" after running the eip.
The CXF component replies with the MessageExchange's OUT (if set otherwise nothing will be returned to the invoker).
So please keep the Message Exchange's OUT with the relevant response content. If OUT is not from anywhere in the route, you can use a bean to set it.
regards,
Mahesh
-
2. Re: HOW TO REPLY BACK TO WEBSERVICE INCOMING CALL
khaliqgaffar Aug 10, 2009 5:22 AM (in response to mahesh_maheshs)Hi Mahesh,
I don't have any issue with plain web service where there is input and output.Issues comes when there is a intermediate process which dumps some values to queues.In this case the client calling the web service waits for infinite time eventually times out.
PFA, camel xml for the same eip diagram
Regards,
Khaliq
-
CXFDiagram-camel.xml 3.6 KB
-
-
3. Re: HOW TO REPLY BACK TO WEBSERVICE INCOMING CALL
mahesh_maheshs Aug 10, 2009 5:44 AM (in response to khaliqgaffar)I thought of this but didn't want to piggy bag all the information in to one response.
Problem explanation:
When CXF is used as first endpoint the message exchange pattern is set to REQUEST-REPLY on the message. The same message reaches the JMS endpoint. Now JMS endpoint tries to fetch response from the receiver using JMS ReplyTo mechanism. So JMS makes the route to wait. In the mean time the HTTP connection times out. So the clients receive error response.
One possible solution:
You can implement the route as follows:
CXF->Bean(setIN_ONLY)->JMS->Bean2(set INOUT)
Bean class has 2 methods
setInonly(Exchange ex) - sets the MEP to Inonly on ex.
setInOut(Exchange ex) - sets the MEP to Inout on ex.
This sends message to JMS destination and returns response to the client.
-
4. Re: HOW TO REPLY BACK TO WEBSERVICE INCOMING CALL
khaliqgaffar Aug 10, 2009 7:17 AM (in response to mahesh_maheshs)Hi Mahesh,
Can you tell me how to set in and out messages in bean within eip ? I dont see any property which defines this ?
Please let me know if this can be accomplished via FID?
I have attached something which i had based on your recommendation. Please let me know if this is the right way to do?
Regards,
Khaliq
-
CXFDiagram-camel.xml 3.7 KB
-
-
5. Re: HOW TO REPLY BACK TO WEBSERVICE INCOMING CALL
mahesh_maheshs Aug 10, 2009 10:17 AM (in response to khaliqgaffar)Yup this is right have your bean to define like this:
CXF ->Bean (setPattern2InOnly) -> JMS -> Bean(setPattern2InOut);
Where 'Bean' = "ExchangeHelper.java"
-
ExchangeHelper.java
-
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
public class ExchangeHelper {
public void setPattern2InOnly(Exchange exchange) {
ExchangePattern inOnly = ExchangePattern.InOnly;+
setPattern(exchange, inOnly);
}
public void setPattern2InOut(Exchange exchange) {
setPattern(exchange, ExchangePattern.InOut);
}
private void setPattern(Exchange exchange, ExchangePattern pattern) {
exchange.setPattern(pattern);
}
}
Edited by: mahesh on Aug 10, 2009 2:16 PM
-
6. Re: HOW TO REPLY BACK TO WEBSERVICE INCOMING CALL
davsclaus Aug 10, 2009 12:03 PM (in response to mahesh_maheshs)The latest releases of Camel have DSL for changing the MEP
from(webservice)
.inOnly()
.to(jms)
.inOut()
.bean(set some response for the webservice)
-
7. Re: HOW TO REPLY BACK TO WEBSERVICE INCOMING CALL
khaliqgaffar Aug 11, 2009 1:25 AM (in response to mahesh_maheshs)Mahesh,
Your solution which you provided worked like charm. Thanks for your support.
Regards,
Khaliq
-
8. Re: HOW TO REPLY BACK TO WEBSERVICE INCOMING CALL
khaliqgaffar Aug 11, 2009 1:26 AM (in response to khaliqgaffar)Please see the last post by mahesh for correct answer