Hi

Just a quick reply on the file naming in the route. Am at work so I have other 
duties as well ;)


The Camel file component is defaulting to interpret the file URI as a directory 
name and use a Camel autogenerated filename in that folder.

So if you have file://mytextfile.txt
Then Camel will output as

Mytextfile.txt/some temp folders/camel unique id

To control the behaviour of the filename you must set a special header property 
on the exchange so Camel will use his as the filename.

And the file component has many options to tweak its behaviour, see its wiki 
document.

Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk
-----Original Message-----
From: Glen Mazza [mailto:[EMAIL PROTECTED] 
Sent: 13. maj 2008 12:18
To: [email protected]
Subject: Re: Having a web service automatically activate when data is placed 
into a queue

OK, I've gotten logging better configured but still no luck--no file
created with all the numbers doubled.  Again, I'm trying to send 7
numbers to a queue, have them redirected to a web service call that
doubles their numbers, and then writes to a file.  I'm not getting any
of the System.out() calls in my code output to the console, which
indicates that not even the queue loading part is working (I had that
working before... :( ).

Here's the logging file, source code, and debug output I'm getting:
[1] http://glen.mazza.blog.googlepages.com/home

I know the web service works
(http://localhost:8080/doubleit/services/doubleit?wsdl returns the wsdl)

Any idea what my next step should be?

Also, I have some questions from Claus' response here:
[2]
https://issues.apache.org/activemq/browse/CAMEL-489?focusedCommentId=42542#action_42542

1.)  How do I initialize the Dead Letter Channel--I don't think I'm
getting one generated--also, where would it be created?

2.)  When I code:  .to("file://testfile.txt"). ..., where is
testfile.txt supposed to be created--I'm guessing in the working
directory where I'm running the app, correct?

3.) The input converter that Claus gave in [2] above, I may need when
going from the web service result to the test file (because I assume the
web service result is also an arraylist):
... .to(CXF_URI).to("file://testfile.txt").process(new Processor() { ...

How do I attach the converter to this process (or all I need to do is
just place the converter with its @Converter annotation in the source
file and this will be done automatically?)

Thanks,
Glen


2008-05-01 Willem Jiang wrote:
> Hi Glen,
> 
> You just need to add the Integer 4 into the list.
> Basically the camel-cxf producer (POJO data format)just call the 
> ClientImpl's [1] invoke method to call the real web service, and the 
> outgoing interceptor chain will help you do the parameter marshaling and 
> soap message creating work.
> All you need to do is passing the operation parameters (which are same 
> with SEI defined) the into a list and set this list into the in message 
> body.
> 
> In your case , the list element object's type should be Integer :)
> 
> [1]https://svn.apache.org/repos/asf/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
> 
> Willem.
> 
> Glen Mazza wrote:
> > Thanks Willem, I haven't been able to get back to this problem for
> > awhile.  I think I'm getting closer, although I haven't got the web
> > service call to work properly yet.  I think my next question is what the
> > format of the web service call needs to be in the process method here:
> >
> > from("test-jms:queue:test.queue").process(new Processor() {
> >    public void process(Exchange e) {
> >         final List<String> params = new ArrayList<String>();
> >         e.getIn().setHeader(CxfConstants.OPERATION_NAME,"DoubleIt");
> >         params.add(e.getIn().getBody(String.class));
> > -->     e.getIn().setBody(params);
> >
> >   }
> > }).to(CXF_URI)...
> >
> >
> > For the DoubleIt web service call defined here:
> > http://www.jroller.com/gmazza/date/20080417#WFstep5
> >
> > How much of the web service request xml do I need to put in the
> > setBody() above?  I.e., if I want to double "4", do I need:
> >
> > 1.) 4
> > or
> > 2.) <numberToDouble>4</numberToDouble>
> > or
> > 3.) <DoubleIt><numberToDouble>4</numberToDouble></DoubleIt>
> > or
> > 4.) <soap:body>....(#3 above)....</soap:body>
> >
> > Also, should I be using the List<String> above (i.e., adding #1 or #2
> > above to a List and then setting the body to that list?)  Or should I
> > just be calling e.getIn().setBody( /* a String object of #3 or #4 above
> > */ )?
> >
> > Thanks,
> > Glen
> >
> >
> >
> > 2008-04-21 Willem Jiang wrote:
> >   
> >> Hi Glen,
> >>
> >> I think the router's code snippet should be
> >>
> >> from("test-jms:queue:test.queue").process(new Processor() {
> >>     public void process(Exchange e) {
> >>          final List<String> params = new ArrayList<String>();
> >>         System.out.println("This was called!"); // never gets called
> >>         e.getIn().setHeader(CxfConstants.OPERATION_NAME,"DoubleIt");
> >>         params.add(e.getIn().getBody(String.class));
> >>         e.getIn().setBody(params);
> >>
> >>   }
> >> }).to(CXF_URI).to("file://test").process(new Processor() {
> >>     public void process(Exchange e) {
> >>        System.out.println("Received exchange: " + e.getIn());
> >>     }
> >> });
> >>
> >> You need put the processor which deals with the CXF producer(client) 
> >> invocation parameter before the CXF producer.
> >>
> >> The dsl from(CXF_URI) will create a CXF consumer(server) which will listen 
> >> to the JAXWS_SERVER_ADDRESS that you specified in the CXF_URI.
> >>
> >> Willem.
> >>
> >>
> >> Glen Mazza wrote:
> >>     
> >>> OK, this is what I have so far.  It is not working (doesn't raise an
> >>> error, just doesn't give any output), but before I do much more
> >>> troubleshooting, I want to make sure that I am not doing anything
> >>> obviously wrong.
> >>>
> >>> To review, what I am trying to do with Camel is:
> >>> 1.) Send ten numbers into a queue, 1-10.
> >>> 2.) For each number, call a "doubleit" web service that will double the
> >>> number. (The wsdl is here[1] and it is running on Tomcat)
> >>> 3.) Write the doubled number out to a file.
> >>>
> >>> To do this, I am modifying the walk-through example[2] (which works fine
> >>> on my machine), which goes directly from queue to file, and inserting
> >>> the web service call in the middle.  Here are the only real changes from
> >>> [2]:
> >>>
> >>> private static final String JAXWS_SERVER_ADDRESS =   
> >>>    "http://localhost:8080/doubleit/services/doubleit";;
> >>> private static final String SERVICE_CLASS = 
> >>>    "com.mycompany.webservice.service.DoubleItPortTypeImpl";
> >>> private static final String CXF_URI = "cxf://" + JAXWS_SERVER_ADDRESS
> >>>    + "?serviceClass=" + SERVICE_CLASS;
> >>>
> >>> context.addRoutes(new RouteBuilder() {
> >>>    public void configure() {
> >>>
> >>>       from("test-jms:queue:test.queue").to(CXF_URI).to("file://test");
> >>>
> >>>       from(CXF_URI).process(new Processor() {
> >>>          public void process(Exchange e) {
> >>>             final List<String> params = new ArrayList<String>();
> >>>             System.out.println("This was called!"); // never gets called
> >>>             e.getIn().setHeader(CxfConstants.OPERATION_NAME,"DoubleIt");
> >>>             params.add(e.getIn().getBody(String.class));
> >>>             e.getIn().setBody(params);
> >>>          }
> >>>       });
> >>>
> >>>       from("file://test").process(new Processor() {
> >>>          public void process(Exchange e) {
> >>>             System.out.println("Received exchange: " + e.getIn());
> >>>          }
> >>>       });
> >>>    }
> >>> });
> >>>
> >>> Does anyone see anything I am doing wrong here?  Note debugging is
> >>> showing that the process() attached to CXF_URI is never being called--so
> >>> I may not be attaching things correctly.  BTW, if it matters, my
> >>> DoubleItPortTypeImpl is here[3].
> >>>
> >>> Thanks for any help,
> >>> Glen
> >>>
> >>>
> >>> [1] http://www.jroller.com/gmazza/date/20080417#WFstep5 
> >>> [2] http://tinyurl.com/4dn6c6 
> >>> [3] http://www.jroller.com/gmazza/date/20080417#WFstep6
> >>>
> >>>
> >>> 2008-04-09 Willem Jiang wrote:
> >>>   
> >>>       
> >>>> Hi Glen,
> >>>>
> >>>>  From your requirement , you need to start a "DoubleIt" web service your 
> >>>> self, maybe the same time that Camel context start.
> >>>>
> >>>> Here is the code snippet for setting up the router.
> >>>>
> >>>> from("test-jms:queue:test.queue").to("cxf://http://SERVICEADDRES?SEI=yourSEI...";).to("file://test");
> >>>>
> >>>> If you just feed the queue with a series of numbers,  you need to change 
> >>>> the message for the "DoubleIt" web service in a processer first.
> >>>> Here is an example[1] to show you how to make a web service call by 
> >>>> setting the message header with the Web service operation name , and 
> >>>> message body with the parameters. You can get the result from the 
> >>>> exchange.getOut().getBody(), which is a list.
> >>>>
> >>>> [1]https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerTest.java
> >>>>
> >>>> Willem.
> >>>>
> >>>>
> >>>> Glen Mazza wrote:
> >>>>     
> >>>>         
> >>>>> Hello,
> >>>>>
> >>>>> I'm trying to create a Camel example so I can learn more about the
> >>>>> product.  What I'd like to do is feed a queue a series of numbers, which
> >>>>> would automatically be fed as the lone parameter to a "DoubleIt" web
> >>>>> service, the output of which (i.e., the input number doubled in value)
> >>>>> would then be fed to a file.
> >>>>>
> >>>>> I understand how to write from a message queue to a file from this
> >>>>> example[1], and also, the camel-cxf example[2] gives me a pretty good
> >>>>> idea of how web service calls are made, but I'm not sure how to have a
> >>>>> web service automatically activated based on what is fed through a
> >>>>> queue; further, how to have the number that is fed into the queue serve
> >>>>> as the lone parameter to that web service call (which component, if any,
> >>>>> must occur between the queue and the web service so the number off the
> >>>>> queue is put into the SOAP request.)  Any guidance or known samples
> >>>>> would be appreciated.
> >>>>>
> >>>>> Thanks,
> >>>>> Glen  
> >>>>>
> >>>>> [1] http://activemq.apache.org/camel/walk-through-an-example.html
> >>>>> [2] http://activemq.apache.org/camel/cxf-example.html
> >>>>>
> >>>>>
> >>>>>
> >>>>>   
> >>>>>       
> >>>>>           
> >>>   
> >>>       
> >
> >
> >   
> 

Reply via email to