You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by dsjaxen <do...@siemens.com> on 2015/09/15 22:39:00 UTC

cxf endpoint configuration in java DSL

Hi!
I want to create the following route in camel:

    <camel-cxf:cxfEndpoint id="soapClientEndpoint"
wsdlURL="wsdl/invoke.wsdl">
        <camel-cxf:properties>
            <entry key="dataFormat" value="CXF_MESSAGE"/>
        </camel-cxf:properties>
    </camel-cxf:cxfEndpoint>

   ...

        <route id="soapClient">
            <from uri="direct:soapClient"/>
            <to uri="cxf:bean:soapClientEndpoint"/>
        </route>


However, when I try to do so, I keep getting this error:

java.lang.IllegalArgumentException: endpointUri is not specified and
org.apache.camel.component.cxf.CxfEndpoint does not implement
createEndpointUri() to create a default value

Here is the Java I am using:
      camelContext_.addRoutes(new RouteBuilder() {
         @Override
         public void configure()
            throws Exception {
            CxfEndpoint cxfEndpoint = new CxfEndpoint();
            cxfEndpoint.setWsdlURL("wsdl/invoke.wsdl");
            cxfEndpoint.setCamelContext(camelContext_);

//         cxfEndpoint.setBeanId("soapClientEndpoint");  also tried this
            cxfEndpoint.setEndpointNameString("soapClientEndpoint");

           
cxfEndpoint.setDataFormat(org.apache.camel.component.cxf.DataFormat.CXF_MESSAGE);
            camelContext_.addEndpoint("soapClientEndpoint", cxfEndpoint);
            from("direct:soapClient").to("soapClientEndpoint");
         }
      });




--
View this message in context: http://camel.465427.n5.nabble.com/cxf-endpoint-configuration-in-java-DSL-tp5771538.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: cxf endpoint configuration in java DSL

Posted by "calyan.bandi" <ca...@gmail.com>.
Hi,

I do not think that the below initialization would listen for the requests
on the url provided in the SERVICE_ADDRESS. 

CxfEndpoint serviceEndpoint = new CxfEndpoint(SERVICE_ADDRESS,
cxfComponent);

You initialize the CxfEndpoint with the required properties. If you want to
use it as a producer, you use it as below:
from("...")
.to("soapClientEndpoint");
When used in the to() section, camel will know that you are trying to make
use of the producer capability of the cxf endpoint and hence would make a
SOAP/REST request to the URI provided.

And if you use it in the from() section then it would listen for any
incoming SOAP/REST requests.

Thanks,
Kalyan



--
View this message in context: http://camel.465427.n5.nabble.com/cxf-endpoint-configuration-in-java-DSL-tp5771538p5772217.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: cxf endpoint configuration in java DSL

Posted by dsjaxen <do...@siemens.com>.
Hi!
What impact would setting the service address have on the cxf endpoint?

   CxfEndpoint serviceEndpoint = new CxfEndpoint(SERVICE_ADDRESS,
cxfComponent);

I assume that SERVICE_ADDRESS has to be a URL.
Would it then listen for soap requests on that URL?  I do not want that.
All I want is a client that can send a SOAP request/response to a 3rd party
web service.

There is no Javadoc in the class at all, so it is hard to know exactly what
it is going to do with the arguments and in what situation you need to set
things.  It's sad people don't see the value of Javadoc.
-Doug




--
View this message in context: http://camel.465427.n5.nabble.com/cxf-endpoint-configuration-in-java-DSL-tp5771538p5772118.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: cxf endpoint configuration in java DSL

Posted by yogu13 <yo...@gmail.com>.
Could you try defining it as below

CxfComponent cxfComponent = new CxfComponent(getContext());
CxfEndpoint serviceEndpoint = new CxfEndpoint(SERVICE_ADDRESS,
cxfComponent);

Regards,
-Yogesh



--
View this message in context: http://camel.465427.n5.nabble.com/cxf-endpoint-configuration-in-java-DSL-tp5771538p5771882.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: cxf endpoint configuration in java DSL

Posted by dsjaxen <do...@siemens.com>.
Hi!
Thanks for the reply.
The "camel-cxf" prefix was declared elsewhere for the XML.
It was the Java code that I was having trouble with:

      camelContext_.addRoutes(new RouteBuilder() {
         @Override
         public void configure()
            throws Exception {
            CxfEndpoint cxfEndpoint = new CxfEndpoint();
            cxfEndpoint.setWsdlURL("wsdl/invoke.wsdl");
            cxfEndpoint.setCamelContext(camelContext_);

//         cxfEndpoint.setBeanId("soapClientEndpoint");  also tried this
            cxfEndpoint.setEndpointNameString("soapClientEndpoint");

           
cxfEndpoint.setDataFormat(org.apache.camel.component.cxf.DataFormat.CXF_MESSAGE);
            camelContext_.addEndpoint("soapClientEndpoint", cxfEndpoint);
            from("direct:soapClient").to("soapClientEndpoint");
         }
      });

java.lang.IllegalArgumentException: endpointUri is not specified and
org.apache.camel.component.cxf.CxfEndpoint does not implement
createEndpointUri() to create a default value.
The XML worked and was what I was aiming to get dynamically from Java.
-Doug




--
View this message in context: http://camel.465427.n5.nabble.com/cxf-endpoint-configuration-in-java-DSL-tp5771538p5771881.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: cxf endpoint configuration in java DSL

Posted by "calyan.bandi" <ca...@gmail.com>.
Hi,

There is no such namespache as "camel-cxf". You should remove this and use
something like below:

<cxf:cxfEndpoint id="myCxfEndpoingID" ......>

If there is indeed a namespace such as "camel-cxf" it should be added in
your beans tag definition.

Thanks,
Kalyan



--
View this message in context: http://camel.465427.n5.nabble.com/cxf-endpoint-configuration-in-java-DSL-tp5771538p5771865.html
Sent from the Camel - Users mailing list archive at Nabble.com.