Hi

Please use the user forum / (@user) mailing list to ask this kind of
question about using Camel

On Mon, May 22, 2017 at 4:41 PM, rohith sreevatsava
<[email protected]> wrote:
>  Hi,
>
> I have defined a cxf end point in my camel-context.xml and using camel test
> class which extends CamelTestSupport to test camel route. In the camel
> route at some point it needs to route to cxf end point am getting no bean
> exception.
>
> So in my test class created one before class method where
> DefaultCamelContext with registry object to which the cxf bean is added is
> set and the context is started.
>
> I could get the cxfend point immediately in the same method. But when I am
> trying the same in route code its not working including what I have tried
>
> The basic requirement is to test the cxf wsdl enpoint from the test class
> before deploying the code to the actual environment. The test class should
> work when we do maven install
>
> camel-context.xml
>
>  <cxf:cxfEndpoint id="Id"
>                    address="url"
>                    serviceClass="Sample.class"
>                    endpointName="s:Type"
>                    serviceName="s:Service"
>                    wsdlURL="url2" >
>       <cxf:properties>
>       <beans:entry key="dataFormat" value="PAYLOAD" />
>     </cxf:properties>
>  </cxf:cxfEndpoint>
>
> Tried to hit this bean from route got no bean exception so tried the
> following method which is also not working to hit the cxf endpoint route.
>
> Camel Route test class following before class is successful to insert cxf
> end point into the registry
>
>   @BeforeClass
>   public static void startServer() throws Exception
>   {
>     SimpleRegistry registry = new SimpleRegistry();
>     CxfEndpoint requestCXF = new CxfEndpoint();
>     requestCXF.setAddress("url");
>
>     requestCXF.setServiceClass(Sample.class);
>     requestCXF.setEndpointName("Sample");
>     requestCXF.setServiceName(Sample.SERVICE);
>     requestCXF.setWsdlURL("url2");
>    final HashMap<String, Object> properties = new HashMap<String, Object>();
>     properties.put("dataFormat", DataFormat.PAYLOAD.toString());
>     requestCXF.setProperties(properties);
>     registry.put("requestCXF", requestCXF);
>     System.out.println("FFFFFFFFFFFFFFFFFFF");
>     CamelContext context = new DefaultCamelContext(registry);
>     context.addEndpoint("request", requestCXF);
>     context.start();
>     System.out.println("VVVVVVV" +
> context.getEndpoint("cxf:bean:requestCXF"));//this is successful
>     CxfEndpoint ex = (CxfEndpoint) context.getEndpoint("cxf:bean:requestCXF");
>    }
>
> In the above code kept all the required fields and inserted the cxf end
> point in the registry I could get the cxfend point immediately in the same
> method.
>
> But when i am trying to route code its not working including what i have
> tried but when i tried this route builder route code .to("cxf:bean:request")
> getting
>
>   Failed to create route route1 at: >>> To[cxf:bean:request] <<< in
> route: Route(route1)[[From[direct:start]] -> [OnException[[class or...
> because of Failed to resolve endpoint: cxf://bean:request due to: No
> bean could be found in the registry for: request of type:
> org.apache.camel.component.cxf.CxfEndpoint
>
> The basic requirement is to test the cxf wsdl enpoint from the test class
> before deploying the code to the actual environment. The test class should
> work when we do maven install
> BR/
> Rohith



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

Reply via email to