You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by anupamsen <an...@yahoo.com> on 2012/08/08 08:39:27 UTC

Re: How Do We Specify Operation To Choose In Camel CXf

Hi There,

I have a similar short of issue. The problem is with the producer end. That
is the from side of the route I want to chose an operation.

<route>
      
      <from uri="cxf:bean:reportIncident"/>
      .....
</route>

Camel allows having only one endpoint at a single address like the
following-

  <cxf:cxfEndpoint id="reportIncident"
                  
address="http://localhost:${proxy.port}/camel-example-cxf-proxy/webservices/ReportIncident"
                   endpointName="s:ReportIncidentEndpoint"
                   serviceName="s:ReportIncidentEndpointService"
                   wsdlURL="etc/report_incident.wsdl"
                   xmlns:s="http://reportincident.example.camel.apache.org">
    <cxf:properties>

But, in the endpoint I may have multiple operations (eg.
reportCriticalIncidents, reportSmallIncidents etc.). I want to trigger
different workflow based on the method being called rather than have a
single entry point for the entire web service. Does camel provide facility
to route based on the method/operation of an endpoint?



--
View this message in context: http://camel.465427.n5.nabble.com/How-Do-We-Specify-Operation-To-Choose-In-Camel-CXf-tp474620p5716965.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How Do We Specify Operation To Choose In Camel CXf

Posted by anupamsen <an...@yahoo.com>.
Thanks Will, I missed that part.



--
View this message in context: http://camel.465427.n5.nabble.com/How-Do-We-Specify-Operation-To-Choose-In-Camel-CXf-tp474620p5718014.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How Do We Specify Operation To Choose In Camel CXf

Posted by Willem jiang <wi...@gmail.com>.
When you chose MESSAGE data format, camel-cxf will not read the content and it is impossible to know the operation name without help of the soap action header. 

If you chose PAYLOAD or POJO, you should be able to get the operation name from the message header. 

-- 
Willem Jiang

FuseSource
Web: http://www.fusesource.com (http://www.fusesource.com/)
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.javaeye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang 
Weibo: willemjiang




On Friday, August 17, 2012 at 5:10 PM, anupamsen wrote:

> My bad, I used the dataFormat as MESSAGE and it seems the 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/How-Do-We-Specify-Operation-To-Choose-In-Camel-CXf-tp474620p5717596.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).




Re: How Do We Specify Operation To Choose In Camel CXf

Posted by anupamsen <an...@yahoo.com>.
My bad, I used the dataFormat as MESSAGE and it seems the 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/How-Do-We-Specify-Operation-To-Choose-In-Camel-CXf-tp474620p5717596.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How Do We Specify Operation To Choose In Camel CXf

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

I have this in the attached project. But the issue is that the operation
name header is not displayed on teh incoming request. I have used the
following -
<to uri="log:before?showHeaders=true"/>




--
View this message in context: http://camel.465427.n5.nabble.com/How-Do-We-Specify-Operation-To-Choose-In-Camel-CXf-tp474620p5717466.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How Do We Specify Operation To Choose In Camel CXf

Posted by pbarama <pr...@gmail.com>.
Using Camel-CXF 2.16.1


It looks Endpoint configuration taken care of configuring the operation and
operation Name space we need to call. Somehow that is not working. 
My xml throws the error “org.xml.sax.SAXParseException; lineNumber: 46;
columnNumber: 61; cvc-complex-type.3.2.2: Attribute 'defaultOperationName'
is not allowed to appear in element
'cxf:cxfEndpoint'.:org.xml.sax.SAXParseException:cvc-complex-type.3.2.2:
Attribute 

'defaultOperationName' is not allowed to appear in element
'cxf:cxfEndpoint'.”  While deployment.

	End point configuration during the above error is 

	<cxf:cxfEndpoint id="logger" 
		address="http://localhost:7001/MTILogger/webservices/logger"
		endpointName="s:LoggerEndpoint" 
		serviceName="s:LoggerEndpointService"
		wsdlURL="http://localhost:7001/MTILogger/webservices/logger?wsdl" 
		serviceClass="com.adp.taxmod.logger.LoggerEndpoint"
		xmlns:s="http://logger.taxmod.adp.com" 
		defaultOperationName="Logger"
		defaultOperationNamespace="http://logger.taxmod.adp.com"/>

I know, there is a work around using CXFConstants, But we wanted to be part
of the configuration.

Thanks,



--
View this message in context: http://camel.465427.n5.nabble.com/How-Do-We-Specify-Operation-To-Choose-In-Camel-CXf-tp474620p5778755.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How Do We Specify Operation To Choose In Camel CXf

Posted by Willem jiang <wi...@gmail.com>.
Once the message is routing to the next endpoint, you should be able to tell the operation by looking up the message header of "operationName", then you can use the CBR[1] to do the work as you want.

.when(header("operationName").isEqualTo("reportCriticalIncidents")).to(direct:route1)
.when(header("operationName").isEqualTo("reportSmallIncidents")).to(direct:route2)

[1]http://camel.apache.org/content-based-router.html 

-- 
Willem Jiang


On Wednesday, August 8, 2012 at 2:39 PM, anupamsen wrote:

> Hi There,
> 
> I have a similar short of issue. The problem is with the producer end. That
> is the from side of the route I want to chose an operation.
> 
> <route>
> 
> <from uri="cxf:bean:reportIncident"/>
> .....
> </route>
> 
> Camel allows having only one endpoint at a single address like the
> following-
> 
> <cxf:cxfEndpoint id="reportIncident"
> 
> address="http://localhost:${proxy.port}/camel-example-cxf-proxy/webservices/ReportIncident"
> endpointName="s:ReportIncidentEndpoint"
> serviceName="s:ReportIncidentEndpointService"
> wsdlURL="etc/report_incident.wsdl"
> xmlns:s="http://reportincident.example.camel.apache.org">
> <cxf:properties>
> 
> But, in the endpoint I may have multiple operations (eg.
> reportCriticalIncidents, reportSmallIncidents etc.). I want to trigger
> different workflow based on the method being called rather than have a
> single entry point for the entire web service. Does camel provide facility
> to route based on the method/operation of an endpoint?
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-Do-We-Specify-Operation-To-Choose-In-Camel-CXf-tp474620p5716965.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).
> 
>