You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Bruce Snyder <br...@gmail.com> on 2009/03/04 22:42:05 UTC

Invoking web services with Camel Using CXF

I'm creating a simple example of using Camel 1.6 with web services
using the java_first_spring_support service that comes with CXF. I
have a XML schema and a Java API of the same service. Both were
created using the Maven archetypes and are being executed via the
camel:run plugin and each is having different issues:

1) Below is the XML schema-based config of the Camel context:

<camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
    <package>com.mycompany.camel</package>
    <route>
      <from uri="file:src/data?noop=true"/>
      <to uri="cxf:http://localhost:9002/HelloWorld?serviceClass=demo.spring.HelloWorld"/>
    </route>
  </camelContext>

The problem with this flavor is the following error:

org.apache.camel.RuntimeCamelException: Can't find the operation name
in the message!

To my knowledge, there is no way to add headers to a message exchange
via the XML. If I'm wrong about this I'd appreciate some suggestions
on how to get beyond the error.


2) Below is the same route using the Java API:

    public void configure() {
		from("file:src/data?noop=true").process(new Processor() {
            public void process(Exchange exchange) throws Exception {
                Message in = exchange.getIn();
                in.setHeader("operationName", "sayHi");
            }
		}).
		to("cxf:http://localhost:9002/HelloWorld?serviceClass=demo.spring.HelloWorld");
	}

The problem with this route is that Camel hangs on the following line
indefinitely and I can't get it beyond it:

...
INFO: Apache Camel 1.6.0 (CamelContext:camelContext) started
Mar 4, 2009 2:01:06 PM org.apache.camel.util.MainSupport generateDot
INFO: Generating DOT file for routes:
/Users/bsnyder/Desktop/eclipse-3.4/workspace-amq-trunk/camel-example-two/target/site/cameldoc
for: org.apache.camel.spring.SpringCamelContext@dd6a83 with name:
camelContext

If anyone can tell me how to move beyond this then I could move on to
the next issue.

Incidentally, patched the org.apache.camel.spring.Main class to add
the ability to disable the DOT file generation. But there is already a
property in the RunMojo named dotEnabled but it's read-only. Why is
this?

Additionally, I've enabled debug logging on org.apache.camel and I'm
still only seeing info level output, even after cleaning and
rebuilding.

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.apache.org/
Apache Camel - http://camel.apache.org/
Apache ServiceMix - http://servicemix.apache.org/

Blog: http://bruceblog.org/

Re: Invoking web services with Camel Using CXF

Posted by Claus Ibsen <cl...@gmail.com>.
I have fixed the camel:run
- to use same parameter name as camel:dot = useDot and its not writeable
- and for camel:run useDot is now default disabled

Will be in Camel 1.6.1 and 2.0.


On Thu, Mar 5, 2009 at 6:57 AM, Claus Ibsen <cl...@gmail.com> wrote:
> On Thu, Mar 5, 2009 at 6:55 AM, Claus Ibsen <cl...@gmail.com> wrote:
>> On Wed, Mar 4, 2009 at 10:42 PM, Bruce Snyder <br...@gmail.com> wrote:
>>> I'm creating a simple example of using Camel 1.6 with web services
>>> using the java_first_spring_support service that comes with CXF. I
>>> have a XML schema and a Java API of the same service. Both were
>>> created using the Maven archetypes and are being executed via the
>>> camel:run plugin and each is having different issues:
>>>
>>> 1) Below is the XML schema-based config of the Camel context:
>>>
>>> <camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
>>>    <package>com.mycompany.camel</package>
>>>    <route>
>>>      <from uri="file:src/data?noop=true"/>
>>>      <to uri="cxf:http://localhost:9002/HelloWorld?serviceClass=demo.spring.HelloWorld"/>
>>>    </route>
>>>  </camelContext>
>> There is a <setHeader> tag you can use to add the header, just like
>> the Java DSL below.
>> It might use a expression as subtype so you need to wrap it with
>> <constant> for string litterals
>>
>> Something like this:
>> <setHeader name="foo"><constant>Bar</constant></setHeader>
>>
>>
>>
>>>
>>> The problem with this flavor is the following error:
>>>
>>> org.apache.camel.RuntimeCamelException: Can't find the operation name
>>> in the message!
>>>
>>> To my knowledge, there is no way to add headers to a message exchange
>>> via the XML. If I'm wrong about this I'd appreciate some suggestions
>>> on how to get beyond the error.
>>>
>>>
>>> 2) Below is the same route using the Java API:
>>>
>>>    public void configure() {
>>>                from("file:src/data?noop=true").process(new Processor() {
>>>            public void process(Exchange exchange) throws Exception {
>>>                Message in = exchange.getIn();
>>>                in.setHeader("operationName", "sayHi");
>>>            }
>>>                }).
>>>                to("cxf:http://localhost:9002/HelloWorld?serviceClass=demo.spring.HelloWorld");
>>>        }
>>>
>>> The problem with this route is that Camel hangs on the following line
>>> indefinitely and I can't get it beyond it:
>>>
>>> ...
>>> INFO: Apache Camel 1.6.0 (CamelContext:camelContext) started
>>> Mar 4, 2009 2:01:06 PM org.apache.camel.util.MainSupport generateDot
>>> INFO: Generating DOT file for routes:
>>> /Users/bsnyder/Desktop/eclipse-3.4/workspace-amq-trunk/camel-example-two/target/site/cameldoc
>>> for: org.apache.camel.spring.SpringCamelContext@dd6a83 with name:
>>> camelContext
>>>
>>> If anyone can tell me how to move beyond this then I could move on to
>>> the next issue.
>>>
>>> Incidentally, patched the org.apache.camel.spring.Main class to add
>>> the ability to disable the DOT file generation. But there is already a
>>> property in the RunMojo named dotEnabled but it's read-only. Why is
>>> this?
>> Strange, as according to this you should be able to disable it:
>> http://camel.apache.org/camel-dot-maven-goal.html
>>
>> Maybe we should let it be disabled by default as most people will NOT
>> have Graphviz installed by default.
>>
>>
>>
>>>
>>> Additionally, I've enabled debug logging on org.apache.camel and I'm
>>> still only seeing info level output, even after cleaning and
>>> rebuilding.
>> Have you added log4j to the classpath and log4j.properties in
>> src/main/resources?
>>
>> CXF is sadly using JDK Logging (This is really terrible IMHO, always
>> use JCL as all the other frameworks does)
>>
>> Willem Jiang wrote something somewhere how to get CXF to use log4j.
> It is here: http://camel.apache.org/cxf.html
>
>>
>>
>>>
>>> Bruce
>>> --
>>> perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
>>> );'
>>>
>>> Apache ActiveMQ - http://activemq.apache.org/
>>> Apache Camel - http://camel.apache.org/
>>> Apache ServiceMix - http://servicemix.apache.org/
>>>
>>> Blog: http://bruceblog.org/
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/

Re: Invoking web services with Camel Using CXF

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Mar 5, 2009 at 6:55 AM, Claus Ibsen <cl...@gmail.com> wrote:
> On Wed, Mar 4, 2009 at 10:42 PM, Bruce Snyder <br...@gmail.com> wrote:
>> I'm creating a simple example of using Camel 1.6 with web services
>> using the java_first_spring_support service that comes with CXF. I
>> have a XML schema and a Java API of the same service. Both were
>> created using the Maven archetypes and are being executed via the
>> camel:run plugin and each is having different issues:
>>
>> 1) Below is the XML schema-based config of the Camel context:
>>
>> <camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
>>    <package>com.mycompany.camel</package>
>>    <route>
>>      <from uri="file:src/data?noop=true"/>
>>      <to uri="cxf:http://localhost:9002/HelloWorld?serviceClass=demo.spring.HelloWorld"/>
>>    </route>
>>  </camelContext>
> There is a <setHeader> tag you can use to add the header, just like
> the Java DSL below.
> It might use a expression as subtype so you need to wrap it with
> <constant> for string litterals
>
> Something like this:
> <setHeader name="foo"><constant>Bar</constant></setHeader>
>
>
>
>>
>> The problem with this flavor is the following error:
>>
>> org.apache.camel.RuntimeCamelException: Can't find the operation name
>> in the message!
>>
>> To my knowledge, there is no way to add headers to a message exchange
>> via the XML. If I'm wrong about this I'd appreciate some suggestions
>> on how to get beyond the error.
>>
>>
>> 2) Below is the same route using the Java API:
>>
>>    public void configure() {
>>                from("file:src/data?noop=true").process(new Processor() {
>>            public void process(Exchange exchange) throws Exception {
>>                Message in = exchange.getIn();
>>                in.setHeader("operationName", "sayHi");
>>            }
>>                }).
>>                to("cxf:http://localhost:9002/HelloWorld?serviceClass=demo.spring.HelloWorld");
>>        }
>>
>> The problem with this route is that Camel hangs on the following line
>> indefinitely and I can't get it beyond it:
>>
>> ...
>> INFO: Apache Camel 1.6.0 (CamelContext:camelContext) started
>> Mar 4, 2009 2:01:06 PM org.apache.camel.util.MainSupport generateDot
>> INFO: Generating DOT file for routes:
>> /Users/bsnyder/Desktop/eclipse-3.4/workspace-amq-trunk/camel-example-two/target/site/cameldoc
>> for: org.apache.camel.spring.SpringCamelContext@dd6a83 with name:
>> camelContext
>>
>> If anyone can tell me how to move beyond this then I could move on to
>> the next issue.
>>
>> Incidentally, patched the org.apache.camel.spring.Main class to add
>> the ability to disable the DOT file generation. But there is already a
>> property in the RunMojo named dotEnabled but it's read-only. Why is
>> this?
> Strange, as according to this you should be able to disable it:
> http://camel.apache.org/camel-dot-maven-goal.html
>
> Maybe we should let it be disabled by default as most people will NOT
> have Graphviz installed by default.
>
>
>
>>
>> Additionally, I've enabled debug logging on org.apache.camel and I'm
>> still only seeing info level output, even after cleaning and
>> rebuilding.
> Have you added log4j to the classpath and log4j.properties in
> src/main/resources?
>
> CXF is sadly using JDK Logging (This is really terrible IMHO, always
> use JCL as all the other frameworks does)
>
> Willem Jiang wrote something somewhere how to get CXF to use log4j.
It is here: http://camel.apache.org/cxf.html

>
>
>>
>> Bruce
>> --
>> perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
>> );'
>>
>> Apache ActiveMQ - http://activemq.apache.org/
>> Apache Camel - http://camel.apache.org/
>> Apache ServiceMix - http://servicemix.apache.org/
>>
>> Blog: http://bruceblog.org/
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/

Re: Invoking web services with Camel Using CXF

Posted by Bruce Snyder <br...@gmail.com>.
On Thu, Mar 5, 2009 at 10:45 AM, Claus Ibsen <cl...@gmail.com> wrote:

> Can you try
>   mvn dependency:list
> to see if it got log4j in there.
>
> Maybe compare it with the example that worked.

We're thinking alike as I was already doing that via m2e and realized
I was missing Log4J.

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.apache.org/
Apache Camel - http://camel.apache.org/
Apache ServiceMix - http://servicemix.apache.org/

Blog: http://bruceblog.org/

Re: Invoking web services with Camel Using CXF

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Mar 5, 2009 at 6:42 PM, Bruce Snyder <br...@gmail.com> wrote:
> On Thu, Mar 5, 2009 at 9:59 AM, Claus Ibsen <cl...@gmail.com> wrote:
>
>> If it is possible then I have fixed that in 1.6.1-SNAPSHOT or
>> 2.0-SNAPSHOT by disabling DOT by default.
>
> Looks like it hasn't been deployed yet, so I'm having to build it locally.
>
>> btw the parameter for camel:run is dotEnabled, where as its useDot for
>> camel:dot. I have aligned these names to useDot in 1.6.1 onwards.
>
> I tried the dotEnabled config and got this error:
>
> Error configuring: org.apache.camel:camel-maven-plugin. Reason: ERROR:
> Cannot override read-only parameter: dotEnabled in goal: camel:run
Yeah that is a bommer with the @readonly. This is also fixed.

>
>
>
>> Is this entire DEBUG logging or only for CXF? Camel uses commons logging.
>
> This is only using Camel. I'm not using CXF.
>
>> BTW: Beware there re some commons logging .jars with no log4j
>> factories so if you grab one of the wrong ones it cannot log using
>> log4j.
>> Inside the .jar there should be a log4j class somewhere.
>
> The project is using commons-logging-1.1 from the transitive
> dependency via camel-core.
>
>> What about the examples that ships with Camel can you see debug
>> logging there? They use log4j and there is a log4j properties in
>> src/main/resources to tamper with.
>
> That's the weird thing - I can see all debug level logging with the
> Camel examples.
Can you try
   mvn dependency:list
to see if it got log4j in there.

Maybe compare it with the example that worked.


>
> Bruce
> --
> perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> );'
>
> Apache ActiveMQ - http://activemq.apache.org/
> Apache Camel - http://camel.apache.org/
> Apache ServiceMix - http://servicemix.apache.org/
>
> Blog: http://bruceblog.org/
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/

Re: Invoking web services with Camel Using CXF

Posted by Bruce Snyder <br...@gmail.com>.
On Thu, Mar 5, 2009 at 9:59 AM, Claus Ibsen <cl...@gmail.com> wrote:

> If it is possible then I have fixed that in 1.6.1-SNAPSHOT or
> 2.0-SNAPSHOT by disabling DOT by default.

Looks like it hasn't been deployed yet, so I'm having to build it locally.

> btw the parameter for camel:run is dotEnabled, where as its useDot for
> camel:dot. I have aligned these names to useDot in 1.6.1 onwards.

I tried the dotEnabled config and got this error:

Error configuring: org.apache.camel:camel-maven-plugin. Reason: ERROR:
Cannot override read-only parameter: dotEnabled in goal: camel:run



> Is this entire DEBUG logging or only for CXF? Camel uses commons logging.

This is only using Camel. I'm not using CXF.

> BTW: Beware there re some commons logging .jars with no log4j
> factories so if you grab one of the wrong ones it cannot log using
> log4j.
> Inside the .jar there should be a log4j class somewhere.

The project is using commons-logging-1.1 from the transitive
dependency via camel-core.

> What about the examples that ships with Camel can you see debug
> logging there? They use log4j and there is a log4j properties in
> src/main/resources to tamper with.

That's the weird thing - I can see all debug level logging with the
Camel examples.

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.apache.org/
Apache Camel - http://camel.apache.org/
Apache ServiceMix - http://servicemix.apache.org/

Blog: http://bruceblog.org/

Re: Invoking web services with Camel Using CXF

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Mar 5, 2009 at 5:50 PM, Bruce Snyder <br...@gmail.com> wrote:
> On Wed, Mar 4, 2009 at 10:55 PM, Claus Ibsen <cl...@gmail.com> wrote:
>> There is a <setHeader> tag you can use to add the header, just like
>> the Java DSL below.
>> It might use a expression as subtype so you need to wrap it with
>> <constant> for string litterals
>>
>> Something like this:
>> <setHeader name="foo"><constant>Bar</constant></setHeader>
>
> Thanks, Claus. I missed this element in the XSD.
>
>>>
>>> The problem with this flavor is the following error:
>>>
>>> org.apache.camel.RuntimeCamelException: Can't find the operation name
>>> in the message!
>>>
>>> To my knowledge, there is no way to add headers to a message exchange
>>> via the XML. If I'm wrong about this I'd appreciate some suggestions
>>> on how to get beyond the error.
>>>
>>>
>>> 2) Below is the same route using the Java API:
>>>
>>>    public void configure() {
>>>                from("file:src/data?noop=true").process(new Processor() {
>>>            public void process(Exchange exchange) throws Exception {
>>>                Message in = exchange.getIn();
>>>                in.setHeader("operationName", "sayHi");
>>>            }
>>>                }).
>>>                to("cxf:http://localhost:9002/HelloWorld?serviceClass=demo.spring.HelloWorld");
>>>        }
>>>
>>> The problem with this route is that Camel hangs on the following line
>>> indefinitely and I can't get it beyond it:
>>>
>>> ...
>>> INFO: Apache Camel 1.6.0 (CamelContext:camelContext) started
>>> Mar 4, 2009 2:01:06 PM org.apache.camel.util.MainSupport generateDot
>>> INFO: Generating DOT file for routes:
>>> /Users/bsnyder/Desktop/eclipse-3.4/workspace-amq-trunk/camel-example-two/target/site/cameldoc
>>> for: org.apache.camel.spring.SpringCamelContext@dd6a83 with name:
>>> camelContext
>>>
>>> If anyone can tell me how to move beyond this then I could move on to
>>> the next issue.
>>>
>>> Incidentally, patched the org.apache.camel.spring.Main class to add
>>> the ability to disable the DOT file generation. But there is already a
>>> property in the RunMojo named dotEnabled but it's read-only. Why is
>>> this?
>> Strange, as according to this you should be able to disable it:
>> http://camel.apache.org/camel-dot-maven-goal.html
>
> I've now disabled this in the POM using the following configuration
> and it's still hanging in the same location:
If it is possible then I have fixed that in 1.6.1-SNAPSHOT or
2.0-SNAPSHOT by disabling DOT by default.

btw the parameter for camel:run is dotEnabled, where as its useDot for
camel:dot. I have aligned these names to useDot in 1.6.1 onwards.

Detecting if the EXEC hangs is kinda hard as its use some 3rd part
.jar to exec the Graphviz and wait for return codes. But in you case
it looks like something get it to struck. Im on Mac OS X as well and
have not seen this with Graphwiz.

>
>  <reporting>
>    <plugins>
>      <plugin>
>        <groupId>org.apache.camel</groupId>
>        <artifactId>camel-maven-plugin</artifactId>
>        <version>${camel-version}</version>
>        <configuration>
>          <!--executable>/Applications/Graphviz.app/Contents/MacOS/Graphviz</executable-->
>          <useDot>false</useDot>
>        </configuration>
>      </plugin>
>    </plugins>
>  </reporting>
>
>> Maybe we should let it be disabled by default as most people will NOT
>> have Graphviz installed by default.
>
> That's not a bad idea, but there should be some logging that indicates
> the situation, i.e., Unable to locate the Graphviz executable,
> disabling DOT generation.
>
>>>
>>> Additionally, I've enabled debug logging on org.apache.camel and I'm
>>> still only seeing info level output, even after cleaning and
>>> rebuilding.
>> Have you added log4j to the classpath and log4j.properties in
>> src/main/resources?
>>
>> CXF is sadly using JDK Logging (This is really terrible IMHO, always
>> use JCL as all the other frameworks does)
>>
>> Willem Jiang wrote something somewhere how to get CXF to use log4j.
>
> Yeah, I'm aware of this as I added a tip to the CXF wiki some time ago:
>
> http://cwiki.apache.org/CXF20DOC/debugging.html#Debugging-UsingLog4jInsteadofjava.util.logging
>
> But this is not the issue. I'm no longer using the camel-cxf component
> and I still cannot see debug level logging.
Is this entire DEBUG logging or only for CXF? Camel uses commons logging.

BTW: Beware there re some commons logging .jars with no log4j
factories so if you grab one of the wrong ones it cannot log using
log4j.
Inside the .jar there should be a log4j class somewhere.

What about the examples that ships with Camel can you see debug
logging there? They use log4j and there is a log4j properties in
src/main/resources to tamper with.



>
> Bruce
> --
> perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> );'
>
> Apache ActiveMQ - http://activemq.apache.org/
> Apache Camel - http://camel.apache.org/
> Apache ServiceMix - http://servicemix.apache.org/
>
> Blog: http://bruceblog.org/
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/

Re: Invoking web services with Camel Using CXF

Posted by Bruce Snyder <br...@gmail.com>.
On Wed, Mar 4, 2009 at 10:55 PM, Claus Ibsen <cl...@gmail.com> wrote:
> There is a <setHeader> tag you can use to add the header, just like
> the Java DSL below.
> It might use a expression as subtype so you need to wrap it with
> <constant> for string litterals
>
> Something like this:
> <setHeader name="foo"><constant>Bar</constant></setHeader>

Thanks, Claus. I missed this element in the XSD.

>>
>> The problem with this flavor is the following error:
>>
>> org.apache.camel.RuntimeCamelException: Can't find the operation name
>> in the message!
>>
>> To my knowledge, there is no way to add headers to a message exchange
>> via the XML. If I'm wrong about this I'd appreciate some suggestions
>> on how to get beyond the error.
>>
>>
>> 2) Below is the same route using the Java API:
>>
>>    public void configure() {
>>                from("file:src/data?noop=true").process(new Processor() {
>>            public void process(Exchange exchange) throws Exception {
>>                Message in = exchange.getIn();
>>                in.setHeader("operationName", "sayHi");
>>            }
>>                }).
>>                to("cxf:http://localhost:9002/HelloWorld?serviceClass=demo.spring.HelloWorld");
>>        }
>>
>> The problem with this route is that Camel hangs on the following line
>> indefinitely and I can't get it beyond it:
>>
>> ...
>> INFO: Apache Camel 1.6.0 (CamelContext:camelContext) started
>> Mar 4, 2009 2:01:06 PM org.apache.camel.util.MainSupport generateDot
>> INFO: Generating DOT file for routes:
>> /Users/bsnyder/Desktop/eclipse-3.4/workspace-amq-trunk/camel-example-two/target/site/cameldoc
>> for: org.apache.camel.spring.SpringCamelContext@dd6a83 with name:
>> camelContext
>>
>> If anyone can tell me how to move beyond this then I could move on to
>> the next issue.
>>
>> Incidentally, patched the org.apache.camel.spring.Main class to add
>> the ability to disable the DOT file generation. But there is already a
>> property in the RunMojo named dotEnabled but it's read-only. Why is
>> this?
> Strange, as according to this you should be able to disable it:
> http://camel.apache.org/camel-dot-maven-goal.html

I've now disabled this in the POM using the following configuration
and it's still hanging in the same location:

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-maven-plugin</artifactId>
        <version>${camel-version}</version>
        <configuration>
          <!--executable>/Applications/Graphviz.app/Contents/MacOS/Graphviz</executable-->
          <useDot>false</useDot>
        </configuration>
      </plugin>
    </plugins>
  </reporting>

> Maybe we should let it be disabled by default as most people will NOT
> have Graphviz installed by default.

That's not a bad idea, but there should be some logging that indicates
the situation, i.e., Unable to locate the Graphviz executable,
disabling DOT generation.

>>
>> Additionally, I've enabled debug logging on org.apache.camel and I'm
>> still only seeing info level output, even after cleaning and
>> rebuilding.
> Have you added log4j to the classpath and log4j.properties in
> src/main/resources?
>
> CXF is sadly using JDK Logging (This is really terrible IMHO, always
> use JCL as all the other frameworks does)
>
> Willem Jiang wrote something somewhere how to get CXF to use log4j.

Yeah, I'm aware of this as I added a tip to the CXF wiki some time ago:

http://cwiki.apache.org/CXF20DOC/debugging.html#Debugging-UsingLog4jInsteadofjava.util.logging

But this is not the issue. I'm no longer using the camel-cxf component
and I still cannot see debug level logging.

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.apache.org/
Apache Camel - http://camel.apache.org/
Apache ServiceMix - http://servicemix.apache.org/

Blog: http://bruceblog.org/

Re: Invoking web services with Camel Using CXF

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Mar 4, 2009 at 10:42 PM, Bruce Snyder <br...@gmail.com> wrote:
> I'm creating a simple example of using Camel 1.6 with web services
> using the java_first_spring_support service that comes with CXF. I
> have a XML schema and a Java API of the same service. Both were
> created using the Maven archetypes and are being executed via the
> camel:run plugin and each is having different issues:
>
> 1) Below is the XML schema-based config of the Camel context:
>
> <camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
>    <package>com.mycompany.camel</package>
>    <route>
>      <from uri="file:src/data?noop=true"/>
>      <to uri="cxf:http://localhost:9002/HelloWorld?serviceClass=demo.spring.HelloWorld"/>
>    </route>
>  </camelContext>
There is a <setHeader> tag you can use to add the header, just like
the Java DSL below.
It might use a expression as subtype so you need to wrap it with
<constant> for string litterals

Something like this:
<setHeader name="foo"><constant>Bar</constant></setHeader>



>
> The problem with this flavor is the following error:
>
> org.apache.camel.RuntimeCamelException: Can't find the operation name
> in the message!
>
> To my knowledge, there is no way to add headers to a message exchange
> via the XML. If I'm wrong about this I'd appreciate some suggestions
> on how to get beyond the error.
>
>
> 2) Below is the same route using the Java API:
>
>    public void configure() {
>                from("file:src/data?noop=true").process(new Processor() {
>            public void process(Exchange exchange) throws Exception {
>                Message in = exchange.getIn();
>                in.setHeader("operationName", "sayHi");
>            }
>                }).
>                to("cxf:http://localhost:9002/HelloWorld?serviceClass=demo.spring.HelloWorld");
>        }
>
> The problem with this route is that Camel hangs on the following line
> indefinitely and I can't get it beyond it:
>
> ...
> INFO: Apache Camel 1.6.0 (CamelContext:camelContext) started
> Mar 4, 2009 2:01:06 PM org.apache.camel.util.MainSupport generateDot
> INFO: Generating DOT file for routes:
> /Users/bsnyder/Desktop/eclipse-3.4/workspace-amq-trunk/camel-example-two/target/site/cameldoc
> for: org.apache.camel.spring.SpringCamelContext@dd6a83 with name:
> camelContext
>
> If anyone can tell me how to move beyond this then I could move on to
> the next issue.
>
> Incidentally, patched the org.apache.camel.spring.Main class to add
> the ability to disable the DOT file generation. But there is already a
> property in the RunMojo named dotEnabled but it's read-only. Why is
> this?
Strange, as according to this you should be able to disable it:
http://camel.apache.org/camel-dot-maven-goal.html

Maybe we should let it be disabled by default as most people will NOT
have Graphviz installed by default.



>
> Additionally, I've enabled debug logging on org.apache.camel and I'm
> still only seeing info level output, even after cleaning and
> rebuilding.
Have you added log4j to the classpath and log4j.properties in
src/main/resources?

CXF is sadly using JDK Logging (This is really terrible IMHO, always
use JCL as all the other frameworks does)

Willem Jiang wrote something somewhere how to get CXF to use log4j.


>
> Bruce
> --
> perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> );'
>
> Apache ActiveMQ - http://activemq.apache.org/
> Apache Camel - http://camel.apache.org/
> Apache ServiceMix - http://servicemix.apache.org/
>
> Blog: http://bruceblog.org/
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/

Re: Invoking web services with Camel Using CXF

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Mar 5, 2009 at 5:57 PM, Bruce Snyder <br...@gmail.com> wrote:
> On Thu, Mar 5, 2009 at 9:46 AM, Claus Ibsen <cl...@gmail.com> wrote:
>
>>> However, it's invoking the web service twice - I'm seeing output from
>>> two invocations of the web service:
>>>
>>> sayHi called
>>> sayHi called
>>>
>>> Any idea why it's invoking it twice instead of just once?
>> I have before been tricked by log4j if you have it defined twice as a
>> appender. Could it be that?
>>
>> Or do you have 2 files in the folder?
>
> No, I've only got one log4j.properties file as that's what the
> archetype generated.
>
> Interestingly, now both examples have stopped running because they're
> hanging on the camel:dot generation:
>
> Mar 5, 2009 9:55:00 AM org.apache.camel.util.MainSupport generateDot
> INFO: Generating DOT file for routes:
> /Users/bsnyder/Desktop/eclipse-3.4/workspace-amq-trunk/camel-example-one/target/site/cameldoc
> for: org.apache.camel.spring.SpringCamelContext@3e9fd8a7 with name:
> camelContext
>
> This is happening despite the fact that I've disabled it via the POM.
No there was a miss match with the options in Camel 1.6.0. useDot and
dotEnabled.

dotEnabled is used by camel:run
useDot is used by camel:dot

So if you remove all the DOT stuff from your POM it should not try to
run it as it can not locate the executeable

If possible you can try out 1.6.1-SNAPSHOT or 2.0-SNAPSHOT


>
> Bruce
> --
> perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> );'
>
> Apache ActiveMQ - http://activemq.apache.org/
> Apache Camel - http://camel.apache.org/
> Apache ServiceMix - http://servicemix.apache.org/
>
> Blog: http://bruceblog.org/
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/

Re: Invoking web services with Camel Using CXF

Posted by Bruce Snyder <br...@gmail.com>.
On Thu, Mar 5, 2009 at 9:46 AM, Claus Ibsen <cl...@gmail.com> wrote:

>> However, it's invoking the web service twice - I'm seeing output from
>> two invocations of the web service:
>>
>> sayHi called
>> sayHi called
>>
>> Any idea why it's invoking it twice instead of just once?
> I have before been tricked by log4j if you have it defined twice as a
> appender. Could it be that?
>
> Or do you have 2 files in the folder?

No, I've only got one log4j.properties file as that's what the
archetype generated.

Interestingly, now both examples have stopped running because they're
hanging on the camel:dot generation:

Mar 5, 2009 9:55:00 AM org.apache.camel.util.MainSupport generateDot
INFO: Generating DOT file for routes:
/Users/bsnyder/Desktop/eclipse-3.4/workspace-amq-trunk/camel-example-one/target/site/cameldoc
for: org.apache.camel.spring.SpringCamelContext@3e9fd8a7 with name:
camelContext

This is happening despite the fact that I've disabled it via the POM.

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.apache.org/
Apache Camel - http://camel.apache.org/
Apache ServiceMix - http://servicemix.apache.org/

Blog: http://bruceblog.org/

Re: Invoking web services with Camel Using CXF

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Mar 5, 2009 at 5:31 PM, Bruce Snyder <br...@gmail.com> wrote:
> On Wed, Mar 4, 2009 at 10:54 PM, Willem Jiang <wi...@gmail.com> wrote:
>> Hi Bruce,
>>
>> If you already has the request message from the file endpoint, you just
>> need to use http endpoint to call the external web service like this.
>>
>> <camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
>>     <package>com.mycompany.camel</package>
>>     <route>
>>       <from uri="file:src/data?noop=true"/>
>>       <to uri="http://localhost:9002/HelloWorld"/>
>>     </route>
>> </camelContext>
>
> Thanks for the advice, Willem. I incorrectly assumed that the
> camel-cxf module must be used to invoke a web service.
>
> The invocation is now working with the following route:
>
>    <route>
>      <from uri="file:src/data?noop=true"/>
>      <to uri="http://localhost:9002/HelloWorld"/>
>      <to uri="log:HELLO_WORLD"/>
>    </route>
>
> However, it's invoking the web service twice - I'm seeing output from
> two invocations of the web service:
>
> sayHi called
> sayHi called
>
> Any idea why it's invoking it twice instead of just once?
I have before been tricked by log4j if you have it defined twice as a
appender. Could it be that?

Or do you have 2 files in the folder?


>
> Bruce
> --
> perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> );'
>
> Apache ActiveMQ - http://activemq.apache.org/
> Apache Camel - http://camel.apache.org/
> Apache ServiceMix - http://servicemix.apache.org/
>
> Blog: http://bruceblog.org/
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/

Re: Invoking web services with Camel Using CXF

Posted by Bruce Snyder <br...@gmail.com>.
On Thu, Mar 5, 2009 at 3:23 PM, Bruce Snyder <br...@gmail.com> wrote:
> On Thu, Mar 5, 2009 at 9:31 AM, Bruce Snyder <br...@gmail.com> wrote:
>
>> Thanks for the advice, Willem. I incorrectly assumed that the
>> camel-cxf module must be used to invoke a web service.
>>
>> The invocation is now working with the following route:
>>
>>    <route>
>>      <from uri="file:src/data?noop=true"/>
>>      <to uri="http://localhost:9002/HelloWorld"/>
>>      <to uri="log:HELLO_WORLD"/>
>>    </route>
>>
>> However, it's invoking the web service twice - I'm seeing output from
>> two invocations of the web service:
>>
>> sayHi called
>> sayHi called
>>
>> Any idea why it's invoking it twice instead of just once?
>
> Camel is still invoking the web service twice and I can't figure out
> why? Even if I remove the call to the log. Any suggestions?
>

Nevermind, I figured it out.

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.apache.org/
Apache Camel - http://camel.apache.org/
Apache ServiceMix - http://servicemix.apache.org/

Blog: http://bruceblog.org/

Re: Invoking web services with Camel Using CXF

Posted by Bruce Snyder <br...@gmail.com>.
On Thu, Mar 5, 2009 at 9:31 AM, Bruce Snyder <br...@gmail.com> wrote:

> Thanks for the advice, Willem. I incorrectly assumed that the
> camel-cxf module must be used to invoke a web service.
>
> The invocation is now working with the following route:
>
>    <route>
>      <from uri="file:src/data?noop=true"/>
>      <to uri="http://localhost:9002/HelloWorld"/>
>      <to uri="log:HELLO_WORLD"/>
>    </route>
>
> However, it's invoking the web service twice - I'm seeing output from
> two invocations of the web service:
>
> sayHi called
> sayHi called
>
> Any idea why it's invoking it twice instead of just once?

Camel is still invoking the web service twice and I can't figure out
why? Even if I remove the call to the log. Any suggestions?

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.apache.org/
Apache Camel - http://camel.apache.org/
Apache ServiceMix - http://servicemix.apache.org/

Blog: http://bruceblog.org/

Re: Invoking web services with Camel Using CXF

Posted by Bruce Snyder <br...@gmail.com>.
On Wed, Mar 4, 2009 at 10:54 PM, Willem Jiang <wi...@gmail.com> wrote:
> Hi Bruce,
>
> If you already has the request message from the file endpoint, you just
> need to use http endpoint to call the external web service like this.
>
> <camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
>     <package>com.mycompany.camel</package>
>     <route>
>       <from uri="file:src/data?noop=true"/>
>       <to uri="http://localhost:9002/HelloWorld"/>
>     </route>
> </camelContext>

Thanks for the advice, Willem. I incorrectly assumed that the
camel-cxf module must be used to invoke a web service.

The invocation is now working with the following route:

    <route>
      <from uri="file:src/data?noop=true"/>
      <to uri="http://localhost:9002/HelloWorld"/>
      <to uri="log:HELLO_WORLD"/>
    </route>

However, it's invoking the web service twice - I'm seeing output from
two invocations of the web service:

sayHi called
sayHi called

Any idea why it's invoking it twice instead of just once?

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.apache.org/
Apache Camel - http://camel.apache.org/
Apache ServiceMix - http://servicemix.apache.org/

Blog: http://bruceblog.org/

Re: Invoking web services with Camel Using CXF

Posted by Willem Jiang <wi...@gmail.com>.
Hi Bruce,

If you already has the request message from the file endpoint, you just
need to use http endpoint to call the external web service like this.

<camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
     <package>com.mycompany.camel</package>
     <route>
       <from uri="file:src/data?noop=true"/>
       <to uri="http://localhost:9002/HelloWorld"/>
     </route>
</camelContext>

Willem

Bruce Snyder wrote:
> I'm creating a simple example of using Camel 1.6 with web services
> using the java_first_spring_support service that comes with CXF. I
> have a XML schema and a Java API of the same service. Both were
> created using the Maven archetypes and are being executed via the
> camel:run plugin and each is having different issues:
> 
> 1) Below is the XML schema-based config of the Camel context:
> 
> <camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
>     <package>com.mycompany.camel</package>
>     <route>
>       <from uri="file:src/data?noop=true"/>
>       <to uri="cxf:http://localhost:9002/HelloWorld?serviceClass=demo.spring.HelloWorld"/>
>     </route>
>   </camelContext>
> 
> The problem with this flavor is the following error:
> 
> org.apache.camel.RuntimeCamelException: Can't find the operation name
> in the message!
> 
> To my knowledge, there is no way to add headers to a message exchange
> via the XML. If I'm wrong about this I'd appreciate some suggestions
> on how to get beyond the error.
> 
> 
> 2) Below is the same route using the Java API:
> 
>     public void configure() {
> 		from("file:src/data?noop=true").process(new Processor() {
>             public void process(Exchange exchange) throws Exception {
>                 Message in = exchange.getIn();
>                 in.setHeader("operationName", "sayHi");
>             }
> 		}).
> 		to("cxf:http://localhost:9002/HelloWorld?serviceClass=demo.spring.HelloWorld");
> 	}
> 
> The problem with this route is that Camel hangs on the following line
> indefinitely and I can't get it beyond it:
> 
> ...
> INFO: Apache Camel 1.6.0 (CamelContext:camelContext) started
> Mar 4, 2009 2:01:06 PM org.apache.camel.util.MainSupport generateDot
> INFO: Generating DOT file for routes:
> /Users/bsnyder/Desktop/eclipse-3.4/workspace-amq-trunk/camel-example-two/target/site/cameldoc
> for: org.apache.camel.spring.SpringCamelContext@dd6a83 with name:
> camelContext
> 
> If anyone can tell me how to move beyond this then I could move on to
> the next issue.
> 
> Incidentally, patched the org.apache.camel.spring.Main class to add
> the ability to disable the DOT file generation. But there is already a
> property in the RunMojo named dotEnabled but it's read-only. Why is
> this?
> 
> Additionally, I've enabled debug logging on org.apache.camel and I'm
> still only seeing info level output, even after cleaning and
> rebuilding.
> 
> Bruce