Re: Do Apache Camel needs a SAP integration?

2012-03-16 Thread Björn Bength
Well, my specific project embeds sap jars and native libs, as well as
hibersap, in an OSGi bundle.
I don't see a way of building, mocking or testing it without those
dependencies.
It might work, somehow, if we extract those and make an hibersap bundle.
But how to mock or test such a thing?

Regards
Björn
 On Mar 16, 2012 2:45 AM, Hadrian Zbarcea hzbar...@gmail.com wrote:


CSV dateformat bug? Attribute 'AutogenColumns' is not allowed to appear in element 'camel:csv'

2012-03-16 Thread Ujeen
Hi colleagues,

I'm trying to use csv marshalling and faced the following issue
cvc-complex-type.3.2.2: Attribute 'AutogenColumns' is not allowed to appear
in element 'csv'
This happens when I try to switch off the autogen columns feature:
camel:csv autogenColumns=false/

It looks like the issue is nested in the
http://camel.apache.org/schema/spring/camel-spring-2.9.0.xsd (2.9.1 as well)
schema. 
The xs:complexType name=csvDataFormat type just doesn't describe the
autogenColumns attribute.
Could you please take a look is that a reason of the error message I get?

Thank you
P.S. And one more important thing - thank you for your brilliant Camel. Now
I can't even imagine how would I live without it :)


--
View this message in context: 
http://camel.465427.n5.nabble.com/CSV-dateformat-bug-Attribute-AutogenColumns-is-not-allowed-to-appear-in-element-camel-csv-tp5570066p5570066.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: How to create a Camel route which takes XML and bind some data to JPA annotated POJO?

2012-03-16 Thread Borut Bolčina
Thanks Babak,

as it turned out, the solution with annotating the WeatherCurrent POJO did
the job. The solution is so short! I posted an answer to my own question at
StackOverflow.

I do have one more problem with the test case, but will post it in another
thread.

-borut

Dne 14. marec 2012 16:24 je Babak Vahdat
babak.vah...@swissonline.chnapisal/-a:

 Hi

 First of all welcome to Apache Camel!

 As you don't own a XSD you can't make use of JDK-XJC compiler tool to
 create your JAXB-POJOs. However having a proper XSD had made your use
 case much easier. As then JAXB would have taken over the job of
 Unmarshalling from XML to POJO.

 Nevertheless I used [1] to show you *one possible way* you could go for it.
 The idea is really simple, just put a Processor in between which does the
 conversion of DOMSource-Object = JPA-Object:

@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
// START SNIPPET: e1
from(file:target/pair)
// split the order child tags, and inherit namespaces from
 the
// orders root tag
.split().tokenizeXML(order, orders).process(new
 Processor() {

@Override
public void process(Exchange exchange) throws
 Exception {
DOMSource source =
 exchange.getIn().getBody(DOMSource.class);

Node order = source.getNode();
NodeList childs = order.getChildNodes();
for (int j = 0; j  childs.getLength(); j++) {
Node text = childs.item(j);

// instead of just dumping the content as I
 do here,
// just create an object of your POJO and
 set the properties
// on it using the current Node here and
 then do something like:
// WeatherCurrent weather = ne
 WeatherCurrent();
// weather.setXXX(text.getTextContent());
// weather.set...
//
// exchange.getIn().setBody(weather);

System.out.println(text.getTextContent());
}
}
})
// of course you would instead send the current exchange
 to
// the JPA producer instead of mock
// .to(jpa://com.foo.WeatherCurrent )
.to(mock:split);
// END SNIPPET: e1
}
};
}

 If you would run this test with my modifications it would additionally dump
 the following into the console:

 Camel in Action
 ActiveMQ in Action
 DSL in Action

 [1]

 https://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/language/TokenXMLPairNamespaceSplitTest.java

 Babak

 --
 View this message in context:
 http://camel.465427.n5.nabble.com/How-to-create-a-Camel-route-which-takes-XML-and-bind-some-data-to-JPA-annotated-POJO-tp5564614p5565135.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



How to create ftp/http listener dynamically

2012-03-16 Thread Johnny Walker
Hi,

We are finding the solution for create the ftp/http listener
dynamically,Let's say we need to deploy 2 camel ftp listener and 1 camel
http listener, and their corresponding configuration information such as ftp
folder name, retrieve rule, http host are stored in database, instead of
hardcode those configuration information in java code or camel-context.xml
file, could we have a central camel communication protocol manager which can
create/start/stop those listener(ftp, http, webservice,etc) based on
database configuration information?Our thought is to have a flexible way to
handle the communication protocols, like we do not need to hardcode the
configuration of ftp/http endpoint information and do not create the
separate bundle to handle different communication instance. 

Look forward to your advise! 


--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-create-ftp-http-listener-dynamically-tp5570099p5570099.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Testing with mocks and unexpected expectedMessageCount

2012-03-16 Thread Borut Bolčina
Hello,

the route bellow splits the XML in smaller XML fragments which are then
umarshaled into an equal number of objects as there are fragments. The
number of fragments and therefore expected objects is 9. This XPath run on
the source XML count(//metData/domain_longTitle) proves the number.

But the test is satisfied whatever numebr of expectedMessageCount I give in
the test method, for example
mock.expectedMessageCount(9);
mock.expectedMessageCount(5);
mock.expectedMessageCount(1);

Why the test does not fail in cases other then 9?

The code:
=
public class WeatherCurrentTest extends CamelTestSupport {
 @EndpointInject(uri = file:src/test/resources)
 private ProducerTemplate inbox;
 @Override
 protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
 @Override
public void configure() throws Exception {
DataFormat jaxbDataFormat = new
JaxbDataFormat(si.najdi.model.entities.weather);

from(file:src/test/resources/?fileName=observation_si_latest.xmlnoop=trueidempotent=false)
 .split()
.tokenizeXML(metData)
.unmarshal(jaxbDataFormat)
 .to(log:si.najdi.datarobot?level=INFO)
.to(mock:meteo);
 }
};
}
 @Test
public void testMetData() throws Exception {
 MockEndpoint mock = getMockEndpoint(mock:meteo);
mock.expectedMessageCount(9);
 File meteo = new File(src/test/resources/observation_si_latest.xml);
 String content = context.getTypeConverter().convertTo(String.class, meteo);
inbox.sendBodyAndHeader(content, Exchange.FILE_NAME,
src/test/resources/observation_si_latest.xml);
 mock.assertIsSatisfied();
}
 }


Re: How to create a Camel route which takes XML and bind some data to JPA annotated POJO?

2012-03-16 Thread Babak Vahdat
Hi

Thanks for sharing your own solution.

The JAXB annotations you've put on the POJO *by hand* is exactly what the
XJC compiler would have done by the generated Java sources If there was a
proper XSD of the XML you consume. So to say now you've got a POJO which is
*both* a JPA entity as well a JAXB complaint POJO (not too sexy though, but
that's my personal taste).

An regarding your question on StackOverflow site: The XJC compiler generates
other than JAXB-POJOS also a class called ObjectFactory.java, see for an
explanation of this class here:

http://www.oracle.com/technetwork/articles/javase/index-140168.html

The other option is not making use of this generated class but a simple text
file called jaxb.index listing *all* the JAXB classes being generated/used.
If you make use of Maven then instead of putting this file together with
your WeatherCurrent.java under the same directory you could also put it
under the Maven resource directory src/main/resources. Then Maven will put
this file *under the same path* inside your generated JAR, WAR etc.

As an example look at this one:

https://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-spring-ws/src/main/resources/org/apache/camel/example/server/model/jaxb.index

Babak

--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-create-a-Camel-route-which-takes-XML-and-bind-some-data-to-JPA-annotated-POJO-tp5564614p5570147.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Do Apache Camel needs a SAP integration?

2012-03-16 Thread Erker, Carsten
What if the SAP stuff is mocked out at the level of the Hibersap API? If the 
component depends only on hibersap-core, there is no (transitive) dependency to 
the SAP libs.

Integration testing wouldn't work anyway, since a public SAP system would be 
needed.

Regards
Carsten



Re: QuickFIXJ Filtering

2012-03-16 Thread Claus Ibsen
On Thu, Mar 15, 2012 at 7:15 PM, Gershaw, Geoffrey
geoffrey.gers...@credit-suisse.com wrote:
 Thanks for you quick reply Claus.

 In my bean, I am retrieving a repeating group and checking that a fix tag on 
 that group = blah

                SecurityDefinition.NoRelatedSym symbolGroup = new 
 SecurityDefinition.NoRelatedSym();
                secDef.getGroup(1, symbolGroup);

                StringField instrTypeField = new StringField(9111);
                symbolGroup.getField(instrTypeField);
                instrType = instrTypeField.getValue();
                return instrType.equals(blah )

 Think this is past simple's functionality. Not sure of how the other 
 scripting languages would simplify this. I would rather not write a bean 
 every time I want to filter a FIX msg. Any thoughts you have would be 
 appreciated.


Yeah it seems a bit complicated. You could possible have a bean with
static methods that returns the field value

Where you enlist the bean as
bean id=fixStuff class=com.foo.MyFixBean/

And use a simple predicate, where you can pass in values in the method signature
simple${bean:fixStuff?method=fooMethod(${body}, 911)} == blah/simple

And then have a method signature
public String fooMethod(Object body, String code) {
 ...
}





 Thanks,

 Geoff
 -Original Message-
 From: Claus Ibsen [mailto:claus.ib...@gmail.com]
 Sent: Thursday, March 15, 2012 4:35 AM
 To: users@camel.apache.org
 Subject: Re: QuickFIXJ Filtering

 Hi

 It depends how complicated it is to get that information from FIX.
 What code do you do in your bean?

 The simple language have basic OGNL support, so you can invoke
 methods. But if you need a bit more, then you can use scripting
 languages such as groovy, java script etc.
 http://camel.apache.org/languages

 And they can be configured in the XML DSL.



 On Wed, Mar 14, 2012 at 10:24 PM, Gershaw, Geoffrey
 geoffrey.gers...@credit-suisse.com wrote:
 Hello,



 I would like to filter out a message if the FIX field 9101=N. I am able
 to do this by creating a bean that does this and calling the bean from
 the simple tag using the bean reference. See example below. I wondered
 if it would be possible to do this without the java class.



 filter

 simple${bean:SecurityDefinitionFilter}/simple





 filter

      simple${body}??/simple





 Thanks for any help you can offer.



 Regards




 ===
 Please access the attached hyperlink for an important electronic 
 communications disclaimer:
 http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
 ===




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

 ===
 Please access the attached hyperlink for an important electronic 
 communications disclaimer:
 http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
 ===




-- 
Claus Ibsen
-
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/


Re: Why this works with Spring DSL and not Java DSL - http component

2012-03-16 Thread soumya_sd



Claus Ibsen-2 wrote
 
 Hi
 
 This is also posted as Q on stackoverflow, which is answered there
 http://stackoverflow.com/questions/9728604/apache-camel-simple-https-google-places-call-difference-between-spring-dsl-a
 
 Please when you ask for help on multiple channels, then mention that
 you do that.
 This help keep the conversation at one place and ppl can see what is going
 on.
 
 

Claus, I'm new to Camel and this forum. I was not sure if everyone followed
at both forums, hence the duplicate postings. In the future, I'll post in on
forum and put a link on the other. 

I was also going to update this thread with the solution (that you have
already linked to above.) 

BTW, I'm also reading your book and find it helpful as a Camel newbie. 

Thanks. 

--
View this message in context: 
http://camel.465427.n5.nabble.com/Why-this-works-with-Spring-DSL-and-not-Java-DSL-http-component-tp5569500p5570923.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Why this works with Spring DSL and not Java DSL - http component

2012-03-16 Thread Claus Ibsen
On Fri, Mar 16, 2012 at 12:07 PM, soumya_sd soumya...@yahoo.com wrote:



 Claus Ibsen-2 wrote

 Hi

 This is also posted as Q on stackoverflow, which is answered there
 http://stackoverflow.com/questions/9728604/apache-camel-simple-https-google-places-call-difference-between-spring-dsl-a

 Please when you ask for help on multiple channels, then mention that
 you do that.
 This help keep the conversation at one place and ppl can see what is going
 on.



 Claus, I'm new to Camel and this forum. I was not sure if everyone followed
 at both forums, hence the duplicate postings. In the future, I'll post in on
 forum and put a link on the other.

 I was also going to update this thread with the solution (that you have
 already linked to above.)


No worries, we are just seeing an uptake on this as stackoverflow is
becoming more popular as well.
So its harder for people to help, and also for people who google, may
only fine the question in one channel.
Where as we help answer the question on another channel. And then
those users cannot find the answer on the 2nd channel etc.


 BTW, I'm also reading your book and find it helpful as a Camel newbie.

 Thanks.

 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Why-this-works-with-Spring-DSL-and-not-Java-DSL-http-component-tp5569500p5570923.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/


Re: CSV dateformat bug? Attribute 'AutogenColumns' is not allowed to appear in element 'camel:csv'

2012-03-16 Thread Claus Ibsen
Hi

Thanks for reporting. I have logged a JIRA
https://issues.apache.org/jira/browse/CAMEL-5100


On Fri, Mar 16, 2012 at 7:37 AM, Ujeen uj...@ujeen.com wrote:
 Hi colleagues,

 I'm trying to use csv marshalling and faced the following issue
 cvc-complex-type.3.2.2: Attribute 'AutogenColumns' is not allowed to appear
 in element 'csv'
 This happens when I try to switch off the autogen columns feature:
 camel:csv autogenColumns=false/

 It looks like the issue is nested in the
 http://camel.apache.org/schema/spring/camel-spring-2.9.0.xsd (2.9.1 as well)
 schema.
 The xs:complexType name=csvDataFormat type just doesn't describe the
 autogenColumns attribute.
 Could you please take a look is that a reason of the error message I get?

 Thank you
 P.S. And one more important thing - thank you for your brilliant Camel. Now
 I can't even imagine how would I live without it :)


 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/CSV-dateformat-bug-Attribute-AutogenColumns-is-not-allowed-to-appear-in-element-camel-csv-tp5570066p5570066.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/


Re: Testing with mocks and unexpected expectedMessageCount

2012-03-16 Thread Borut Bolčina
OK, nailed the bastard!

The option idempotent=true (together with noop=true) on the File component
was causing the route to read the file content over an over.

-borut

Dne 16. marec 2012 08:10 je Borut Bolčina borut.bolc...@gmail.comnapisal/-a:

 Hello,

 the route bellow splits the XML in smaller XML fragments which are then
 umarshaled into an equal number of objects as there are fragments. The
 number of fragments and therefore expected objects is 9. This XPath run on
 the source XML count(//metData/domain_longTitle) proves the number.

 But the test is satisfied whatever numebr of expectedMessageCount I give
 in the test method, for example
 mock.expectedMessageCount(9);
 mock.expectedMessageCount(5);
  mock.expectedMessageCount(1);

 Why the test does not fail in cases other then 9?

 The code:

 =
 public class WeatherCurrentTest extends CamelTestSupport {
  @EndpointInject(uri = file:src/test/resources)
  private ProducerTemplate inbox;
  @Override
  protected RouteBuilder createRouteBuilder() throws Exception {
 return new RouteBuilder() {
  @Override
 public void configure() throws Exception {
 DataFormat jaxbDataFormat = new
 JaxbDataFormat(si.najdi.model.entities.weather);

 from(file:src/test/resources/?fileName=observation_si_latest.xmlnoop=trueidempotent=false)
  .split()
 .tokenizeXML(metData)
 .unmarshal(jaxbDataFormat)
  .to(log:si.najdi.datarobot?level=INFO)
 .to(mock:meteo);
  }
 };
 }
  @Test
 public void testMetData() throws Exception {
  MockEndpoint mock = getMockEndpoint(mock:meteo);
 mock.expectedMessageCount(9);
  File meteo = new File(src/test/resources/observation_si_latest.xml);
  String content = context.getTypeConverter().convertTo(String.class,
 meteo);
 inbox.sendBodyAndHeader(content, Exchange.FILE_NAME,
 src/test/resources/observation_si_latest.xml);
  mock.assertIsSatisfied();
 }
  }



FixedLengthRecord and OneToMany

2012-03-16 Thread nmcloughlin
Can anyone confirm/deny whether OneToMany works with FixedLengthRecord? It
doesn't appear to work, but thought I'd ask.

Thanks!

--
View this message in context: 
http://camel.465427.n5.nabble.com/FixedLengthRecord-and-OneToMany-tp5571433p5571433.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Choice() When() always generate empty predicate

2012-03-16 Thread Thibault
Hi all,

I have this DSL route definition:


 from(seda:InTransform)
.choice()
.when(property(input.format).isEqualsTo(test))
   .to(jbi:endpoint:MyService:MyEndpoint)
.otherwise()
   .to(jbi:endpoint:AnotherService:AnotherEndpoint);
 

(I want to test a value that i have already set as input.format property)
The DSL compiles, but when I show the route on Karaf (camel:show-route), it
only displays this:



 (...)
 choice
   when
   expressionDefinition /
   to uri=jbi:endpoint:MyService:MyEndpoint id=to3/
   /when
   otherwise
  (...)
   /otherwise
 /choice
 (...)
 
Why doesn't the predicate on the property input.format appear in the route
? Did I write something wrong ?

Regards,
Thibault


--
View this message in context: 
http://camel.465427.n5.nabble.com/Choice-When-always-generate-empty-predicate-tp5571443p5571443.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: CXF Consumer/Producer endpoint not working properly

2012-03-16 Thread Willem Jiang
It looks like your SEI com.sforce.soap.enterprise.Soap doesn't has 
enough information for CXF to lookup the services name.


You can specify the serviceName and endpointName in the cxfEndpoint of 
salesforceCXFConsumer to fix the error.


Willem

On Fri Mar 16 15:13:48 2012, Castyn wrote:

I have a simple cxf consumer and producer route setup currently, but for some
reason when I go to deploy the route i am getting the following error.

03:07:10,014 | ERROR | xtenderThread-22 | ContextLoaderListener|
?   ? | 84 -
org.springframework.osgi.extender - 1.2.1 | Application context refresh
failed (OsgiBundleXmlApplicationContext(bundle=mdm-realtime-route,
config=osgibundle:/META-INF/spring/*.xml))
org.apache.camel.RuntimeCamelException:
org.apache.cxf.service.factory.ServiceConstructionException: Could not find
definition for service {urn:enterprise.soap.sforce.com}SoapService.
 at
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1149)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
 at
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:108)[91:org.apache.camel.camel-spring:2.8.0.fuse-01-13]
 at
org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:240)[91:org.apache.camel.camel-spring:2.8.0.fuse-01-13]
 at
org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)[75:org.springframework.context:3.0.5.RELEASE]
 at
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303)[75:org.springframework.context:3.0.5.RELEASE]
 at
org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:911)[75:org.springframework.context:3.0.5.RELEASE]
 at
org.springframework.osgi.context.support.AbstractOsgiBundleApplicationContext.finishRefresh(AbstractOsgiBundleApplicationContext.java:235)[81:org.springframework.osgi.core:1.2.1]
 at
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:358)[81:org.springframework.osgi.core:1.2.1]
 at
org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)[81:org.springframework.osgi.core:1.2.1]
 at
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)[81:org.springframework.osgi.core:1.2.1]
 at
org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)[84:org.springframework.osgi.extender:1.2.1]
 at java.lang.Thread.run(Thread.java:662)[:1.6.0_23]
Caused by: org.apache.cxf.service.factory.ServiceConstructionException:
Could not find definition for service
{urn:enterprise.soap.sforce.com}SoapService.
 at
org.apache.cxf.wsdl11.WSDLServiceFactory.create(WSDLServiceFactory.java:139)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
 at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:382)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
 at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:505)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
 at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:241)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
 at
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:202)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
 at
org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:101)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
 at
org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:157)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
 at
org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:202)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
 at
org.apache.camel.component.cxf.CxfConsumer.init(CxfConsumer.java:226)[143:org.apache.camel.camel-cxf:2.8.0.fuse-01-13]
 at
org.apache.camel.component.cxf.CxfEndpoint.createConsumer(CxfEndpoint.java:188)[143:org.apache.camel.camel-cxf:2.8.0.fuse-01-13]
 at
org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:61)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
 at
org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:75)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
 at

Access the entire CXF Payload with XSLT

2012-03-16 Thread Kerry Barnes
Using camel 2.8.3 (tried under 2.9.0 as well) I am trying to process a SOAP
Message received from a cxf:cxfEndpoint from
uri=cxf:bean:ControllerEndpoint?dataFormat=PAYLOADamp;allowStreaming=true/

My problem is that I want to perform an xsl transformation with the header
and body of the SOAP message and forward the request to another server.  I
need to insert the username from the ws-security header into the new
request, which I can't seem to get without writing my own custom processor
(which I am currently using).  I would think I should be able to do this
without any custom code, but I seem to only have access to the soap body,
not the soap header.  How can I get the full envelope to do my
transformations against?

Were am I missing the boat?

Thanks for any help.

--
View this message in context: 
http://camel.465427.n5.nabble.com/Access-the-entire-CXF-Payload-with-XSLT-tp5571577p5571577.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Choice() When() always generate empty predicate

2012-03-16 Thread Claus Ibsen
Hi

What version of Camel are you using?
I think those are fixed on one of the later releases.


On Fri, Mar 16, 2012 at 3:53 PM, Thibault thibault.cas...@gmail.com wrote:
 Hi all,

 I have this DSL route definition:


 from(seda:InTransform)
    .choice()
        .when(property(input.format).isEqualsTo(test))
           .to(jbi:endpoint:MyService:MyEndpoint)
        .otherwise()
           .to(jbi:endpoint:AnotherService:AnotherEndpoint);


 (I want to test a value that i have already set as input.format property)
 The DSL compiles, but when I show the route on Karaf (camel:show-route), it
 only displays this:



 (...)
 choice
   when
       expressionDefinition /
       to uri=jbi:endpoint:MyService:MyEndpoint id=to3/
   /when
   otherwise
      (...)
   /otherwise
 /choice
 (...)

 Why doesn't the predicate on the property input.format appear in the route
 ? Did I write something wrong ?

 Regards,
 Thibault


 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Choice-When-always-generate-empty-predicate-tp5571443p5571443.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/


Re: Choice() When() always generate empty predicate

2012-03-16 Thread Marco Westermann

Hi, you may try building the predicat by simple language:

.when(simple(${property.input.format} == 'test'))

compare to http://camel.apache.org/simple.html

regards, marco

Am 16.03.2012 15:53, schrieb Thibault:

Hi all,

I have this DSL route definition:



from(seda:InTransform)
.choice()
.when(property(input.format).isEqualsTo(test))
   .to(jbi:endpoint:MyService:MyEndpoint)
.otherwise()
   .to(jbi:endpoint:AnotherService:AnotherEndpoint);


(I want to test a value that i have already set as input.format property)
The DSL compiles, but when I show the route on Karaf (camel:show-route), it
only displays this:




(...)
choice
   when
   expressionDefinition /
   to uri=jbi:endpoint:MyService:MyEndpoint id=to3/
   /when
   otherwise
  (...)
   /otherwise
/choice
(...)


Why doesn't the predicate on the property input.format appear in the route
? Did I write something wrong ?

Regards,
Thibault


--
View this message in context: 
http://camel.465427.n5.nabble.com/Choice-When-always-generate-empty-predicate-tp5571443p5571443.html
Sent from the Camel - Users mailing list archive at Nabble.com.





Re: Access the entire CXF Payload with XSLT

2012-03-16 Thread Marco Westermann

Hi,

I'm not completely sure but I think using PAYLOAD means that you always 
geht the soap-body as this is the payload of the message. If you want 
the complete soap-message you can use MESSAGE instead of PAYLOAD.



regards, Marco


Am 16.03.2012 16:29, schrieb Kerry Barnes:

Using camel 2.8.3 (tried under 2.9.0 as well) I am trying to process a SOAP
Message received from acxf:cxfEndpoint  from
uri=cxf:bean:ControllerEndpoint?dataFormat=PAYLOADamp;allowStreaming=true/

My problem is that I want to perform an xsl transformation with the header
and body of the SOAP message and forward the request to another server.  I
need to insert the username from the ws-security header into the new
request, which I can't seem to get without writing my own custom processor
(which I am currently using).  I would think I should be able to do this
without any custom code, but I seem to only have access to the soap body,
not the soap header.  How can I get the full envelope to do my
transformations against?

Were am I missing the boat?

Thanks for any help.

--
View this message in context: 
http://camel.465427.n5.nabble.com/Access-the-entire-CXF-Payload-with-XSLT-tp5571577p5571577.html
Sent from the Camel - Users mailing list archive at Nabble.com.





Re: Access the entire CXF Payload with XSLT

2012-03-16 Thread Jens

Kerry Barnes wrote
 How can I get the full envelope to do my transformations against?

Try

from
uri=cxf:bean:ControllerEndpoint?dataFormat=MESSAGEamp;allowStreaming=true

Regards,
Jens

--
View this message in context: 
http://camel.465427.n5.nabble.com/Access-the-entire-CXF-Payload-with-XSLT-tp5571577p5571628.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: CSV dateformat bug? Attribute 'AutogenColumns' is not allowed to appear in element 'camel:csv'

2012-03-16 Thread Ujeen
Thank you, but you know it looks like the entire autogenColumns feature
doesn't work. 
At least it doesn't work for me (the 2.9.0-RC1 version)
I change the scheme so the org.apache.camel.dataformat.csv.CsvDataFormat
accepts it but if I set autogenColumns flag to false it stops generating
everything.
I'm still struggling with this atm, digging the Camel sources and
apache.common.csv. I hope to fix it by passing some proper Config. The trick
is that I don't know what properties to put there as there is lack
documentation on that :)

My initial task was to print out three different tables with data to the
same csv file so user could open in in Excel and see them as three separate
and not related peace of data. 
That autogenColumns flag corrupts the entire idea as it adds ton of empty
lines here and there. In theory the flag promises to stop messing the data
:)

--
View this message in context: 
http://camel.465427.n5.nabble.com/CSV-dateformat-bug-Attribute-AutogenColumns-is-not-allowed-to-appear-in-element-camel-csv-tp5570066p5571650.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: CSV dateformat bug? Attribute 'AutogenColumns' is not allowed to appear in element 'camel:csv'

2012-03-16 Thread Ujeen
Ok, it looks like I managed to fix it (this flag works when marshalling only) 
I changed the org.apache.camel.dataformat.csv.CsvDataFormat.
1. Removed the if(autogenColumns) condition in the doMarhshalRecord. So now
it looks like this:
private void doMarshalRecord(Exchange exchange, Map row, Writer out,
CSVWriter csv) throws Exception {
Set set = row.keySet();
updateFieldsInConfig(set, exchange);
csv.writeRecord(row);
}
2. put the following snipped into the marshal method making it the very
first there
public void marshal(Exchange exchange, Object object, OutputStream
outputStream) throws Exception {
 if(!autogenColumns) {
config = new CSVConfig();
 }
  

So it works for me but I didn't run any tests (don't have time to perform
all the checks atm)

--
View this message in context: 
http://camel.465427.n5.nabble.com/CSV-dateformat-bug-Attribute-AutogenColumns-is-not-allowed-to-appear-in-element-camel-csv-tp5570066p5571741.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Apache Camel Netty

2012-03-16 Thread Mark Webb
I've been looking into this
(https://issues.apache.org/jira/browse/CAMEL-1077), it will require
large modifications to the existing netty component I believe.



On Fri, Mar 9, 2012 at 6:20 AM, Claus Ibsen claus.ib...@gmail.com wrote:
 On Thu, Mar 8, 2012 at 10:59 PM, sambardar sanjay_ambar...@yahoo.com wrote:
 Yes, the issue was related to Context not up and now it works fine. I have a
 need to create a binary stream over the TCP connection. Means , in client
 server mode, I want to send a message to the server(that will run on a
 particular ip/port) over TCP socket to say start and then server should
 start streaming the binary data over the socket(and this would continue 24x7
 unless we re-start). After this client doesn't send anything to server but
 keep on receiving binary data from server over the socket. Is this
 achievable through Camel Netty component?


 No this is not possible to keep the connection live and receive data ad-hoc.
 There is some JIRA tickets to add such functionality.

 You can use the Netty API to build this yourself.


 Thanks
 Sanjay

 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Apache-Camel-Netty-tp5545678p5549012.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



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


Re: CSV dateformat bug? Attribute 'AutogenColumns' is not allowed to appear in element 'camel:csv'

2012-03-16 Thread Babak Vahdat
Hi

If you want to make use of AutogenColumns == false you should first
explicitly specify the columns you're interested in otherwise nothing will
be appended into the output other than \ns. See the test method
testPresetConfig() by [1] to see how to correctly specify the columns
beforehand.

Also note that the *order* of the output values will be the same as the
*order* you do addField(CSVField) by CSVConfig.

[1]
https://svn.apache.org/repos/asf/camel/trunk/components/camel-csv/src/test/java/org/apache/camel/dataformat/csv/CsvRouteTest.java

Babak

--
View this message in context: 
http://camel.465427.n5.nabble.com/CSV-dateformat-bug-Attribute-AutogenColumns-is-not-allowed-to-appear-in-element-camel-csv-tp5570066p5571945.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: FixedLengthRecord and OneToMany

2012-03-16 Thread surya
I have been using Bindy FixedLengthRecord. I do not think OneToMany is
implemented for FixedLength (somone can correct if wrong) . OneToMany  works
well for Csv and KvP formats. 

May I ask why would you need OneToMany on a fixedlength record? isn't each
field supposed to have unique 'position' in a record. Eg: @DataField(pos =
(151), length = 2). I use @Link on FixedLength with no issues.

peace,
surya

--
View this message in context: 
http://camel.465427.n5.nabble.com/FixedLengthRecord-and-OneToMany-tp5571433p5572022.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel RSS Component and ? char in URL feed

2012-03-16 Thread Claus Ibsen
The ? indicates the start of the query of the uri
http://en.wikipedia.org/wiki/URI_scheme#Generic_syntax

So in your case you should use  to separate values, so it should be:
 
rss:http://unevieagrimper.blogspot.com/feeds/posts/default?alt=rsssplitEntries=falseconsumer.delay=1000


On Fri, Mar 16, 2012 at 6:40 PM, olivierursushorribilis
olivierursushorribi...@gmail.com wrote:
 Hi,

 my RSS feed URL is :
 http://unevieagrimper.blogspot.com/feeds/posts/default?alt=rss

 To me, this URL is quite valid : many RSS feed (thousands !) are using such
 URL suffix (?xx=xx).

 When i try to use Camel RSS Component i get an error :

 rss:http://unevieagrimper.blogspot.com/feeds/posts/default?alt=rss?splitEntries=falseconsumer.delay=1000

 Since ? is a special char for camel URI it causes trouble.

 Then, i tried :

 rss:http://unevieagrimper.blogspot.com/feeds/posts/default%3Falt=rss?splitEntries=falseconsumer.delay=1000


 But, it does not work since %3F is not decoded when Camel RSS tries to get
 data from this URL.

 What is the proper way to get Camel RSS working with this URL ?


 I've patched (quick and dirty for testing purpose) the
 org.apache.camel.component.rss.RssUtils class :


 package org.apache.camel.component.rss;

 import java.io.InputStream;
 import java.net.URL;

 import com.sun.syndication.feed.synd.SyndFeed;
 import com.sun.syndication.io.SyndFeedInput;
 import com.sun.syndication.io.XmlReader;

 public final class RssUtils {
    private RssUtils() {
        // Helper class
    }

    public static SyndFeed createFeed(String feedUri) throws Exception {
        String uri = feedUri;
        if(feedUri.contains(%3F)){
            uri = feedUri.replace(%3F,?);
        }
        InputStream in = new URL(uri).openStream();
        SyndFeedInput input = new SyndFeedInput();
        return input.build(new XmlReader(in));
    }
 }

 The patch handle the encoded %3F.


 Thanks.



 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Camel-RSS-Component-and-char-in-URL-feed-tp5572015p5572015.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/


Re: FixedLengthRecord and OneToMany

2012-03-16 Thread NigelMac
How do you represent an array of data in a message (e.g. as in RECURS 5), I
just assumed that OneToMany would handle this, no?

--
View this message in context: 
http://camel.465427.n5.nabble.com/FixedLengthRecord-and-OneToMany-tp5571433p5572079.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: CSV dateformat bug? Attribute 'AutogenColumns' is not allowed to appear in element 'camel:csv'

2012-03-16 Thread Ujeen
Thank you very much for this hint. Yeah I figured that out. 
And therefore it looks like reporting above is pointless as it doesn't make
sense to bring the autogenColumns flag into the xml because there is no way
to set all the fields inside the cvs/ tag 


--
View this message in context: 
http://camel.465427.n5.nabble.com/CSV-dateformat-bug-Attribute-AutogenColumns-is-not-allowed-to-appear-in-element-camel-csv-tp5570066p5572111.html
Sent from the Camel - Users mailing list archive at Nabble.com.


APN certificate requires password

2012-03-16 Thread MichaelAtSAG
I have defined a /org.apache.camel.component.apns.ApnsComponent/ bean and
tried to use the component in a Camel route. Camel reports that the
certificate must have a password, yet requiring a password on the
certificate is typically discouraged.

Does Camel require the certificate have a password? Why?


Caused by: java.lang.IllegalArgumentException: certificatePassword must be
specified and not empty
at org.apache.camel.util.ObjectHelper.notEmpty(ObjectHelper.java:309)
at
org.apache.camel.component.apns.factory.ApnsServiceFactory.configureApnsCertificate(ApnsServiceFactory.java:181)
at
org.apache.camel.component.apns.factory.ApnsServiceFactory.getApnsService(ApnsServiceFactory.java:164)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)


--
View this message in context: 
http://camel.465427.n5.nabble.com/APN-certificate-requires-password-tp5572525p5572525.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: CSV dateformat bug? Attribute 'AutogenColumns' is not allowed to appear in element 'camel:csv'

2012-03-16 Thread Babak Vahdat
That's indeed true. If we provide a new option for autogenColumns then we
should additionally provide some ways of specifying CSVConfig or CSVField
inside XML DSL to be considered as well. Also note that autogenColumns
default value is true.

@Claus, As you see by [1] the best we get out of the new
autogenColumns=false is just a bunch of line feed characters as no new
column gets added any more!

As now the autogenColumns has been already provided we should also provide a
way inside XML DSL so that the user can specify which columns should be
added. Maybe through CSVFieldRefs (Refs to XML Beans), list of Strings, etc.
which we would then add to CsvDataFormat's CSVConfig.

What do you think?

[1]
https://svn.apache.org/repos/asf/camel/trunk/components/camel-csv/src/test/java/org/apache/camel/dataformat/csv/CsvMarshalAutogenColumnsSpringTest.java

Babak

--
View this message in context: 
http://camel.465427.n5.nabble.com/CSV-dateformat-bug-Attribute-AutogenColumns-is-not-allowed-to-appear-in-element-camel-csv-tp5570066p5572575.html
Sent from the Camel - Users mailing list archive at Nabble.com.


How can I send a file to a remote ftp server using the ftp2 component

2012-03-16 Thread gsilverman
All of the examples I have seen show how to retrieve files from a remote ftp
server using the ftp component, but I need to send files. In my processor, I
create a ProducerTemplate and try to send the file like so:

ProducerTemplate template = exchange.getContext().createProducerTemplate();

String route = protocol + :// + userid + @ +  host + : + port +
directory + ?password= + password;

template.sendBodyAndHeader(route, report, CamelFileName, filename);  

where protocol, userid, host, etc. are dynamic. I don't get any errors when
using the processor but neither is the file uploaded to the host. What am I
doing wrong?

By the way, I'm using camel 2.8.1.



--
View this message in context: 
http://camel.465427.n5.nabble.com/How-can-I-send-a-file-to-a-remote-ftp-server-using-the-ftp2-component-tp5572863p5572863.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Error: cannot run camel-servlet version 2.9.1 in Tomcat

2012-03-16 Thread gsilverman
Here is the maven dependency tree. As you can see, the camel-servlet verson
2.9.1 has a transitive dependency on javax.servlet, from  the http
component. Obviously, while the 2.8.1 version scopes this as provided,
apparently that is not the case with version 2.9.1.

 Building Camel :: Example :: Servlet Tomcat 2.8.1
 

 --- maven-dependency-plugin:2.1:tree (default-cli) @
camel-example-servlet-tomcat ---
 org.apache.camel:camel-example-servlet-tomcat:war:2.8.1
 +- org.apache.camel:camel-core:jar:2.9.1:compile
 |  \- org.slf4j:slf4j-api:jar:1.6.1:compile
 +- org.apache.camel:camel-spring:jar:2.9.1:compile
 |  +- org.springframework:spring-context:jar:3.0.5.RELEASE:compile (version
managed from 3.0.7.RELEASE)
 |  |  +- org.springframework:spring-expression:jar:3.0.5.RELEASE:compile
 |  |  \- org.springframework:spring-asm:jar:3.0.5.RELEASE:compile
 |  +- org.springframework:spring-aop:jar:3.0.5.RELEASE:compile
 |  \- org.springframework:spring-tx:jar:3.0.5.RELEASE:compile (version
managed from 3.0.7.RELEASE)
 +- org.apache.camel:camel-servlet:jar:2.9.1:compile
 |  \- org.apache.camel:camel-http:jar:2.8.1:compile (version managed from
2.9.1)
 | +-
org.apache.geronimo.specs:geronimo-servlet_2.4_spec:jar:1.1.1:compile
 | \- commons-httpclient:commons-httpclient:jar:3.1:compile
 |\- commons-codec:commons-codec:jar:1.2:compile
 +- org.springframework:spring-web:jar:3.0.5.RELEASE:compile
 |  +- aopalliance:aopalliance:jar:1.0:compile
 |  +- org.springframework:spring-beans:jar:3.0.5.RELEASE:compile
 |  \- org.springframework:spring-core:jar:3.0.5.RELEASE:compile
 | \- commons-logging:commons-logging:jar:1.1.1:compile (version managed
from 1.0.4)
 +- log4j:log4j:jar:1.2.16:compile
 +- org.slf4j:slf4j-log4j12:jar:1.6.1:compile
 \- com.sun:tools:jar:1.5.0:system
 
 BUILD SUCCESS
 
 Total time: 4.987s
 Finished at: Fri Mar 16 17:47:33 PDT 2012
 Final Memory: 10M/120M

--
View this message in context: 
http://camel.465427.n5.nabble.com/Error-cannot-run-camel-servlet-version-2-9-1-in-Tomcat-tp5566624p5572865.html
Sent from the Camel - Users mailing list archive at Nabble.com.