camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Came <scott.c...@search.org>
Subject RE: File consumer to CXF issues
Date Wed, 02 Mar 2011 15:54:23 GMT
I continue to see very strange behavior here...  When I look in Eclipse at the "Maven dependencies"
section of my build path, camel-cxf.jar is not there (a lot of other camel and cxf stuff is
there).  What could be causing Maven / m2eclipse not to bring this jar into the project?

Incidentally, it's not an Eclipse problem...I get the same problem when I run mvn install
from the command line.  The following dependency in my pom is apparently not making any difference
at compile time...

<properties>
    <camel-version>2.6.0-fuse-00-00</camel-version>
  </properties>

  <dependencies>
    <dependency>
    	<groupId>org.apache.camel</groupId>
    	<artifactId>camel-core</artifactId>
    	<version>${camel-version}</version>
    	<type>pom</type>
    	<scope>compile</scope>
    </dependency>
    <dependency>
    	<groupId>org.apache.camel</groupId>
    	<artifactId>camel-cxf</artifactId>
    	<version>${camel-version}</version>
    	<type>pom</type>
    	<scope>compile</scope>
    </dependency>
  </dependencies>

Snippet of results from running mvn install:

[INFO] [compiler:compile {execution: default-compile}]
[INFO] Compiling 2 source files to /Users/scott/Documents/eclipse-workspaces/workspace-servicemix-dev/tsc-connector/target/classes
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure

/Users/scott/Documents/eclipse-workspaces/workspace-servicemix-dev/tsc-connector/src/main/java/CxfPayloadConverter.java:[15,37]
package org.apache.camel.component.cxf does not exist

/Users/scott/Documents/eclipse-workspaces/workspace-servicemix-dev/tsc-connector/src/main/java/CxfPayloadConverter.java:[25,22]
cannot find symbol
symbol  : class CxfPayload
location: class CxfPayloadConverter

-----Original Message-----
From: Scott Came [mailto:scott.came@search.org] 
Sent: Tuesday, March 01, 2011 7:47 AM
To: users@camel.apache.org
Subject: RE: File consumer to CXF issues

Thanks, Willem.

I am having trouble getting this going...here is what I'm trying...  I downloaded the source
file you linked (I also need to download NodeListWrapper, in the same package).  I have changed
the package to something application-specific (for now, I just have it in the default package),
then dropped the source file into src/main/java in my project (i.e., the structure containing
src/main/resources/META-INF/spring/camel-context.xml that defines my camel route that needs
the type converter).

When I do this (in Eclipse), the java source file won't compile, because it can't find org.apache.camel.component.cxf.CxfPayload.
 My pom declares a dependency on camel-cxf (where I assume this class is defined), so I would
expect it to compile.  Eclipse doesn't have an issue with the org.apache.camel imports in
the source file.  Do I need to do something else with the pom to get it to find org.apache.camel.component.cxf.CxfPayload?

By the way, I am following the instructions here:  http://fusesource.com/docs/router/1.6/prog_guide/TypeConv-Impl.html,
which is about all I could find on implementing a custom type converter.

Thanks.
--Scott

-----Original Message-----
From: Willem Jiang [mailto:willem.jiang@gmail.com]
Sent: Sunday, February 27, 2011 6:46 PM
To: users@camel.apache.org
Subject: Re: File consumer to CXF issues

Hi Scott,

We just added a CXFPayloadConverter[1][2] into Camel 2.7-SNAPSHOT last month.
You can put this converter into your application if you still need to use camel 2.6.0.

[1]https://issues.apache.org/jira/browse/CAMEL-3580
[2]https://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java

Willem
On 2/26/11 11:28 PM, Scott Came wrote:
> The file contains XML...the root element of the xml document in the file is the child
element of soap:body.
>
> I tried MESSAGE and it seems the CXF component is expecting the file to contain the entire
SOAP message (envelope and body), which would be a pain to create.  I'd rather avoid POJO
mode since I really don't want to have to generate code.  But nonetheless I tried it and ran
into a whole bunch more exceptions...probably wasn't configuring it right.
>
> I'd rather learn how to write a converter and do that than have to generate code.
>
> How do I explore whether there is a converter missing?  Again, it's surprising that there
isn't a converter that will take a GenericFile (or String) and plop it into the soap:body,
since that seems like such a common scenario...so there must be something I'm missing.
>
> Thanks.
>
> -----Original Message-----
> From: Claus Ibsen [mailto:claus.ibsen@gmail.com]
> Sent: Friday, February 25, 2011 11:35 PM
> To: users@camel.apache.org
> Subject: Re: File consumer to CXF issues
>
> Hi
>
> What does your file contain?
>
> Often people use either POJO or MESSAGE format. So there could be a converter to/from
CxfPayload missing. Especially for String, byte[], streams which is common types.
>
>
>
>
> On Sat, Feb 26, 2011 at 7:53 AM, Scott Came<scott.came@search.org>  wrote:
>> After looking at this a bit more (and upgrading to the 4.3.1-fuse-00-00 version of
ServiceMix, which contains Camel 2.6.0), it seems the problem boils down to Camel not knowing
how to convert a GenericFile (what results from the<from>  part of the route) to a CxfPayload
(what is expected by the<to>  part of the route).
>>
>> Am I on the right track here?
>>
>> If so, is there an available converter that does that?  It seems like a fairly common
scenario to pick up an XML document that fits the schema for a particular SOAP operation and
send that document in the body of a SOAP message to a web service.  So I'm surprised this
isn't built in...perhaps it is, and I'm just not doing something correctly.
>>
>> By the way, I tried using convertBodyTo to convert the input file to java.lang.String
and org.w3c.dom.Document, and those efforts resulted in exceptions too.
>>
>> Any help appreciated.
>>
>> Thanks.
>> --Scott
>>
>> -----Original Message-----
>> From: Scott Came [mailto:scott.came@search.org]
>> Sent: Friday, February 25, 2011 1:57 PM
>> To: users@camel.apache.org
>> Subject: File consumer to CXF issues
>>
>> I have a route that looks like this:
>>
>> <osgi:camelContext xmlns="http://camel.apache.org/schema/spring">
>>     <route>
>>       <from uri="file:/tmp/tsc-input"/>
>>       <to uri="cxf:bean:outEndpoint"/>
>>     </route>
>>   </osgi:camelContext>
>>
>> (As you can tell, I'm deploying this in ServiceMix, but the issue I'm 
>> having is in the Camel realm, thus my posting here...)
>>
>> I have defined outEndpoint earlier in the camel-context.xml file using cxfEndpoint.
>>
>> This route is creating exceptions over several different techniques.
>>
>> What I really would like is not to generate code using cxf's wsdl2java (following
this example (http://camel.apache.org/tutorial-osgi-camel-part2.html) though, I did).  I would
like to use<to uri="cxf:bean:outEndpoint?dataFormat=PAYLOAD"/>  which, as I understand
it, should not require code generation.  However, when I try to do it this way, I get a NullPointerException
in org.apache.camel.component.cxf.CxfEndpoint, at line 577, in the setParameters() method.
>>
>> I don't see anything in the documentation of the Camel CXF component that states
or implies that this isn't supported on the client side.
>>
>> So my question is...  Is it possible to use the cxf component in the 
>> <to>  part of a Camel route, WSDL-first, and not generate code, but 
>> rather have it (under the covers) use the JAX-WS Dispatch approach?
>> Is there an example anywhere that does this (I've looked at all the 
>> examples on the Camel website, and several blog postings, and 
>> couldn't find anything that matched my scenario...)
>>
>> If it would be better to post this on the CXF or even ServiceMix lists, please advise.
>>
>> Thanks.
>> --Scott
>>
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>
>
>


--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang

Mime
View raw message