You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Narsi Nallamilli <na...@gmail.com> on 2016/03/30 12:06:53 UTC

camel invoking rest endpoint two times

When I call aiRsServer, it call restClient which calls the nRsServer's login
endpoint but the execution comes to the login endpoint implementation two
time, 

Please find my soapcontext as below,

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:cxf="http://camel.apache.org/schema/cxf"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
	xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
	xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration"	
	 xmlns:sec="http://cxf.apache.org/configuration/security"
	xmlns:jaxrs="http://cxf.apache.org/jaxrs"
	xsi:schemaLocation="
	   http://cxf.apache.org/transports/http/configuration 		   
http://cxf.apache.org/schemas/configuration/http-conf.xsd
	   http://cxf.apache.org/transports/http-jetty/configuration   
http://cxf.apache.org/schemas/configuration/http-jetty.xsd
       http://cxf.apache.org/configuration/security                
http://cxf.apache.org/schemas/configuration/security.xsd
       http://www.springframework.org/schema/beans 				
http://www.springframework.org/schema/beans/spring-beans.xsd
       http://camel.apache.org/schema/cxf 						
http://camel.apache.org/schema/cxf/camel-cxf.xsd
       http://camel.apache.org/schema/spring 					
http://camel.apache.org/schema/spring/camel-spring.xsd
       http://cxf.apache.org/jaxrs 								
http://cxf.apache.org/schemas/jaxrs.xsd">
    <import resource="applicationContext.xml"/>
    <http-conf:conduit name="*.http-conduit">
   		<http-conf:client ReceiveTimeout="720000" ConnectionTimeout="10000"/> 
	</http-conf:conduit> 
	 
	<bean id="loggingFeature"
class="org.apache.cxf.feature.LoggingFeature"></bean>
  	
  	<bean id="niLoginEndPointImpl"
class="com.endpoint.impl.NILoginEndpointImpl"/>
  	<bean id="loginEndPoint" class="com.endpoint.LoginEndpoint"/>
  	<bean id="authenicationFilter" class="com.util.AuthenticationFilter"/>
  	<bean id="niRestPostProcessor"
class="com.processor.NIRestPostProcessor"/>
  	<bean id="aiRestServerProcessor"
class="com.processor.AIRestPostProcessor"/>

  	<cxf:rsServer id="nRsServer"
		address="http://localhost:9001/"
		loggingFeatureEnabled="true" loggingSizeLimit="-1">
		<cxf:serviceBeans>
			<ref bean="niLoginEndPointImpl"/>
		</cxf:serviceBeans>
		<cxf:providers>
			<ref bean="authenicationFilter"/>
			<bean class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider"/>
		</cxf:providers>	
	</cxf:rsServer>
	<cxf:rsServer id="aiRsServer"
		address="/"
		loggingFeatureEnabled="true" loggingSizeLimit="-1" >
		<cxf:providers>
			<bean class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider"/>
		</cxf:providers>
		<cxf:serviceBeans>
			<ref bean="loginEndPoint"/>
		</cxf:serviceBeans>
	</cxf:rsServer> 
        <cxf:rsClient id="rsClient" address="http://localhost:9001/">
  	         <cxf:providers>
			<bean class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider"/>
		</cxf:providers>
        </cxf:rsClient>
  <camelContext id="context-fbf56f63-2d1c-46cf-9bcd-3d9221a80da6"
xmlns="http://camel.apache.org/schema/spring">
  		<endpoint uri="cxfrs://bean://rsClient?throwExceptionOnFailure=false"
id="aiRestProducer"/>
  		<route>
    		      <from
uri="cxfrs:bean:nRsServer?performInvocation=true&amp;propagateContexts=true"/>
    	 	      <process ref="niRestPostProcessor"/>
  		</route>
  		<route>
    		<from uri="cxfrs:bean:aiRsServer"/>
    		      <process ref="aiRestServerProcessor" id="a"/>
    		      <to ref="aiRestProducer"/>
  		</route>
	</camelContext>
</beans>



--
View this message in context: http://camel.465427.n5.nabble.com/camel-invoking-rest-endpoint-two-times-tp5780019.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel invoking rest endpoint two times

Posted by Narsi Nallamilli <na...@gmail.com>.
Please help on this issue.



--
View this message in context: http://camel.465427.n5.nabble.com/camel-invoking-rest-endpoint-two-times-tp5780019p5780743.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel invoking rest endpoint two times

Posted by Narsi Nallamilli <na...@gmail.com>.
The issue is the login rest endpoint is getting called twice when I invoke it
once by below process.

When I hit http://localhost:8080/login it calls the cxfrs server which calls
the cxfrs client according to below route.

<from uri="cxfrs:bean:aiRsServer"/> 
<process ref="aiRestServerProcessor" id="a"/> 
<to ref="aiRestProducer"/> 
</route> 

Then the client is calling another cxfrs service which has got the actual
login endpoint implementation.
<route> 
<from
uri="cxfrs:bean:nRsServer?performInvocation=true&amp;propagateContexts=true"/> 
<process ref="niRestPostProcessor"/> 
</route>

Now during the execution of the process the login endpoint is getting called
twice. 
 




--
View this message in context: http://camel.465427.n5.nabble.com/camel-invoking-rest-endpoint-two-times-tp5780019p5780838.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel invoking rest endpoint two times

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Sorry but its hard to help you with such a problem. You paste a bunch
of configuration but dont talk so much about what rest is called two
times, and what you do.

Please dive more into your problem and try to narrow down what happens.

It may be that you are indeed calling it 2 times.

On Wed, Mar 30, 2016 at 12:06 PM, Narsi Nallamilli
<na...@gmail.com> wrote:
> When I call aiRsServer, it call restClient which calls the nRsServer's login
> endpoint but the execution comes to the login endpoint implementation two
> time,
>
> Please find my soapcontext as below,
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
>         xmlns:cxf="http://camel.apache.org/schema/cxf"
>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>         xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
>         xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration"
>          xmlns:sec="http://cxf.apache.org/configuration/security"
>         xmlns:jaxrs="http://cxf.apache.org/jaxrs"
>         xsi:schemaLocation="
>            http://cxf.apache.org/transports/http/configuration
> http://cxf.apache.org/schemas/configuration/http-conf.xsd
>            http://cxf.apache.org/transports/http-jetty/configuration
> http://cxf.apache.org/schemas/configuration/http-jetty.xsd
>        http://cxf.apache.org/configuration/security
> http://cxf.apache.org/schemas/configuration/security.xsd
>        http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans.xsd
>        http://camel.apache.org/schema/cxf
> http://camel.apache.org/schema/cxf/camel-cxf.xsd
>        http://camel.apache.org/schema/spring
> http://camel.apache.org/schema/spring/camel-spring.xsd
>        http://cxf.apache.org/jaxrs
> http://cxf.apache.org/schemas/jaxrs.xsd">
>     <import resource="applicationContext.xml"/>
>     <http-conf:conduit name="*.http-conduit">
>                 <http-conf:client ReceiveTimeout="720000" ConnectionTimeout="10000"/>
>         </http-conf:conduit>
>
>         <bean id="loggingFeature"
> class="org.apache.cxf.feature.LoggingFeature"></bean>
>
>         <bean id="niLoginEndPointImpl"
> class="com.endpoint.impl.NILoginEndpointImpl"/>
>         <bean id="loginEndPoint" class="com.endpoint.LoginEndpoint"/>
>         <bean id="authenicationFilter" class="com.util.AuthenticationFilter"/>
>         <bean id="niRestPostProcessor"
> class="com.processor.NIRestPostProcessor"/>
>         <bean id="aiRestServerProcessor"
> class="com.processor.AIRestPostProcessor"/>
>
>         <cxf:rsServer id="nRsServer"
>                 address="http://localhost:9001/"
>                 loggingFeatureEnabled="true" loggingSizeLimit="-1">
>                 <cxf:serviceBeans>
>                         <ref bean="niLoginEndPointImpl"/>
>                 </cxf:serviceBeans>
>                 <cxf:providers>
>                         <ref bean="authenicationFilter"/>
>                         <bean class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider"/>
>                 </cxf:providers>
>         </cxf:rsServer>
>         <cxf:rsServer id="aiRsServer"
>                 address="/"
>                 loggingFeatureEnabled="true" loggingSizeLimit="-1" >
>                 <cxf:providers>
>                         <bean class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider"/>
>                 </cxf:providers>
>                 <cxf:serviceBeans>
>                         <ref bean="loginEndPoint"/>
>                 </cxf:serviceBeans>
>         </cxf:rsServer>
>         <cxf:rsClient id="rsClient" address="http://localhost:9001/">
>                  <cxf:providers>
>                         <bean class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider"/>
>                 </cxf:providers>
>         </cxf:rsClient>
>   <camelContext id="context-fbf56f63-2d1c-46cf-9bcd-3d9221a80da6"
> xmlns="http://camel.apache.org/schema/spring">
>                 <endpoint uri="cxfrs://bean://rsClient?throwExceptionOnFailure=false"
> id="aiRestProducer"/>
>                 <route>
>                       <from
> uri="cxfrs:bean:nRsServer?performInvocation=true&amp;propagateContexts=true"/>
>                       <process ref="niRestPostProcessor"/>
>                 </route>
>                 <route>
>                 <from uri="cxfrs:bean:aiRsServer"/>
>                       <process ref="aiRestServerProcessor" id="a"/>
>                       <to ref="aiRestProducer"/>
>                 </route>
>         </camelContext>
> </beans>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-invoking-rest-endpoint-two-times-tp5780019.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2