You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "michal.warecki" <mi...@gmail.com> on 2012/08/07 22:57:08 UTC

Re: exposing different operations under same service in camel + cxf routing.

I think you should create central route and next use content based router.
Name of current operation is stored in header CxfConstants.OPERATION_NAME.

Something like this:
from(...cxf...)
            .choice()
               
.when(header(CxfConstants.OPERATION_NAME).isEqualTo(operationA))
                    .to("direct:operationARoute")
               
.when(header(CxfConstants.OPERATION_NAME).isEqualTo(operationB))
                    .to("direct:operationBRoute")
                .otherwise()
                    .to("direct:unsupportedOperation");



--
View this message in context: http://camel.465427.n5.nabble.com/exposing-different-operations-under-same-service-in-camel-cxf-routing-tp5716944p5716950.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: exposing different operations under same service in camel + cxf routing.

Posted by anupamsen <an...@yahoo.com>.
My bad, I used the dataFormat as MESSAGE and it seems teh operation name is
available only in case of dataFormat = PAYLOAD. It works for me with
dataFormat = PAYLOAD.

Thanks.



--
View this message in context: http://camel.465427.n5.nabble.com/exposing-different-operations-under-same-service-in-camel-cxf-routing-tp5716944p5717595.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: exposing different operations under same service in camel + cxf routing.

Posted by anupamsen <an...@yahoo.com>.
By the way I am calling the 2 operations in the WSDL using SOAPUI.



--
View this message in context: http://camel.465427.n5.nabble.com/exposing-different-operations-under-same-service-in-camel-cxf-routing-tp5716944p5717444.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: exposing different operations under same service in camel + cxf routing.

Posted by anupamsen <an...@yahoo.com>.
Following is the header that I see in the logs when run with "mvn camel:run"
and routed to log uaing show header option like below-

<to uri="log:before?showHeaders=true"/>.

I don't see no operationName header -

Headers:{SOAPAction="http://reportincident.example.camel.apache.org/ReportIncident",
accept-encoding=gzip,deflate, Host=localhost:9080,
content-type=text/xml;charset=UTF-8, User-Agent=Jakarta
Commons-HttpClient/3.1, breadcrumbId=ID-Anupam-PC-49990-1345051042099-0-2,
CamelCxfMessage={org.apache.cxf.message.Message.PROTOCOL_HEADERS={accept-encoding=[gzip,deflate],
Content-Length=[563], content-type=[text/xml;charset=UTF-8],
Host=[localhost:9080],
SOAPAction=["http://reportincident.example.camel.apache.org/ReportIncident"],
User-Agent=[Jakarta Commons-HttpClient/3.1]},
HTTP_CONTEXT_MATCH_STRATEGY=stem,
org.apache.cxf.request.url=http://localhost:9080/camel-example-cxf-proxy/webservices/ReportIncident,
org.apache.cxf.request.uri=/camel-example-cxf-proxy/webservices/ReportIncident,
HTTP.REQUEST=(POST
/camel-example-cxf-proxy/webservices/ReportIncident)@2349183
org.eclipse.jetty.server.Request@23d87f, HTTP.CONFIG=null,
org.apache.cxf.transport.https.CertConstraints=null, Accept=null,
org.apache.cxf.message.Message.PATH_INFO=/camel-example-cxf-proxy/webservices/ReportIncident,
org.apache.cxf.message.Message.BASE_PATH=/camel-example-cxf-proxy/webservices/ReportIncident,
org.apache.cxf.continuations.ContinuationProvider=org.apache.cxf.transport.http_jetty.continuations.JettyContinuationProvider@15a9fdf,
org.apache.cxf.message.Message.IN_INTERCEPTORS=[org.apache.cxf.transport.https.CertConstraintsInterceptor@b626b0],
org.apache.cxf.binding.soap.SoapVersion=org.apache.cxf.binding.soap.Soap11@a61d64,
org.apache.cxf.message.Message.ENCODING=UTF-8,
org.apache.cxf.message.Message.QUERY_STRING=null, HTTP.RESPONSE=HTTP/1.1 200
,
org.apache.cxf.security.SecurityContext=org.apache.cxf.transport.http.AbstractHTTPDestination$2@1d394ab,
org.apache.cxf.request.method=POST,
org.apache.cxf.async.post.response.dispatch=true,
org.apache.cxf.configuration.security.AuthorizationPolicy=null,
org.apache.cxf.message.MessageFIXED_PARAMETER_ORDER=false,
org.apache.cxf.transport.Destination=org.apache.cxf.transport.http_jetty.JettyHTTPDestination@19318fa,
http.base.path=http://localhost:9080/camel-example-cxf-proxy/webservices,
Content-Type=text/xml;charset=UTF-8,
HTTP.CONTEXT=ServletContext@o.e.j.s.h.ContextHandler{/camel-example-cxf-proxy/webservices,null}}},
BodyType:null, Body:[Body is instance of java.io.InputStream]]


For the purpose of having a test case I have attached a rar containing the
entire project in my earlier post.




--
View this message in context: http://camel.465427.n5.nabble.com/exposing-different-operations-under-same-service-in-camel-cxf-routing-tp5716944p5717441.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: exposing different operations under same service in camel + cxf routing.

Posted by ychawla <pr...@yahoo.com>.
Hi,
Have you tried turning on the tracer to see what headers are on your
exchange?  A simple filter such as this should work:

			<camel:filter>
				<camel:simple>${in.headers.operationName} ==
'SearchRequest'</camel:simple>
				<camel:log message="Search Request has been invoked"/>
			</camel:filter>

Try looking at all the headers on your exchange and make sure the
operationName exists.  The framework should provide that header to you.

Thanks,
Yogesh



--
View this message in context: http://camel.465427.n5.nabble.com/exposing-different-operations-under-same-service-in-camel-cxf-routing-tp5716944p5717346.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: exposing different operations under same service in camel + cxf routing.

Posted by anupamsen <an...@yahoo.com>.
http://camel.465427.n5.nabble.com/file/n5717345/camel-example-cxf-proxy.rar
camel-example-cxf-proxy.rar 
Hi There,

Thanks for the reply. My goal is to expose a WS as an endpoint in Camel-CXF
and based on the WS operation triggered by an external WS consumer I need to
trigger the route/workflow. I have attached the example where I try to
achieve it in the camel-config.xml. The following is the excerpt -


			<from uri="cxf:bean:reportIncident" />
			<camel:choice>
				<camel:when>
					<camel:ognl>request.headers.operationName ==
'ReportIncident'</camel:ognl>
					
					<to uri="bean:enrichBean" />
					
					<to ref="callRealWebService" />
				</camel:when>
				<camel:otherwise>
					
					<to ref="callRealWebService" />
					
					<to uri="log:output" />
				</camel:otherwise>

In the first case, if the operation as per the WSDL is ReportIncident then I
try to enrich the payload, else I don't. Its just a sample project from the
camel examples with minor modification.

 I tried using -
<camel:simple>${header.operationName} == 'ReportIncident'</camel:simple>

and it didnt work, neither can I see any header for operationName.



--
View this message in context: http://camel.465427.n5.nabble.com/exposing-different-operations-under-same-service-in-camel-cxf-routing-tp5716944p5717345.html
Sent from the Camel - Users mailing list archive at Nabble.com.