On Wed, Mar 4, 2009 at 10:42 PM, Bruce Snyder <bruce.sny...@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.springcamelcont...@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)u8...@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/

Reply via email to