camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: How to set endpoint id in Java dsl?
Date Fri, 16 Dec 2011 16:43:15 GMT
Hi

the <cxf:cxfEndpoint id="foo"> is a namespace handler, that will
create a CxfEndpoint and register it in the Registry with that given
id.

In pure Java code for an unit test, you would need to enlist the CXF
endpoint manually.
For example you can use the SimpleRegistry with  the
DefaultCamelContext, which is just a Map.
Then you can put the created CxfEndpoint in that map with the id of choice.



On Fri, Dec 16, 2011 at 3:50 PM, Nij Bijvank, Laura
<LNijBijvank@kluwer.nl> wrote:
> I have a xml-file with the camel-context, and an endpoint configured
> like this:
>
>
>
> <cxf:cxfEndpoint id="CommonServiceEndpoint"
>
>
> address="${com.company.integration.endpoints.commonservice.url}"
>
>                     endpointName="s:CommonServicePort"
>
>                     serviceName="s:CommonService"
>
>                     wsdlURL="wsdl/CommonService.wsdl"
>
>                     xmlns:s="http://impl.gateway.pumax.company.com/"/>
>
>
>
> From my routebuilder I can use this endpoint:
>
> .to("cxf:bean:CommonServiceEndpoint?dataFormat=PAYLOAD")
>
>
>
> But for my test classes I don't want to use the camel-context defined in
> the xml-file. So I start with a default context and try to add the
> endpoint:
>
>
>
> CamelContext context = new DefaultCamelContext();
>
> CxfEndpoint commonService =
> this.getContext().getEndpoint("cxf:${com.company.integration.endpoints.c
> ommonservice.url}",CxfEndpoint.class);
>
> commonService.setWsdlURL("wsdl/CommonService.wsdl");
>
> commonService.setServiceName("{http://impl.gateway.pumax.company.com/}Co
> mmonService");
>
> commonService.setPortName("{http://impl.gateway.pumax.company.com/}Commo
> nServicePort");
>
> context.addRoutes(new myRouteBuilder());
>
>
>
> But I don't see a way to set the id to "CommonServiceEndpoint". How can
> I set the id in java so the routebuilder uses the endpoint defined in
> the test?
>
>
> This email and any attachments may contain confidential or privileged information and
is intended for the addressee only. If you are not the intended recipient, please immediately
notify us by email or telephone and delete the original email and attachments without using,
disseminating or reproducing its contents to anyone other than the intended recipient. Kluwer
shall not be liable for the incorrect or incomplete transmission of this email or any attachments,
nor for unauthorized use by its employees.
>
> Deze e-mail (en eventuele bijlagen) kan vertrouwelijke informatie bevatten en is alleen
bestemd voor de geadresseerde. Als u niet de bedoelde geadresseerde bent, informeer ons a.u.b.
hierover per e-mail of telefoon en verwijder de originele e-mail zonder de inhoud en bijlagen
te gebruiken, te verspreiden of te vermenigvuldigen aan anderen dan de bedoelde geadresseerde.
Kluwer is niet aansprakelijk voor onjuiste of incomplete verzending van deze e-mail en bijlagen,
noch voor ongeautoriseerd gebruik door haar medewerkers.
> Kluwer bv is statutair gevestigd te Deventer en ingeschreven in het handelsregister van
de Kamer van Koophandel onder het nummer 380 132 26.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Mime
View raw message