Yeah, the Jetty Producer is a processor, it just send the message body which is file input stream in you route to the back end service. If you uses CXF with MESSAGE data formate, camel-cxf producer can do the same thing as the Jetty producer does.
-- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (English) http://jnn.iteye.com (Chinese) Twitter: willemjiang Weibo: 姜宁willem On May 5, 2014 at 9:56:47 AM, Stephen Cameron ([email protected]) wrote: > Hi Willem, > > I have found that a simple way to do this is as below, I need to read up > more on SOAP to understand why the recommended approach using CXF is > failing. But for now this might be suitable. > > Why this works is still unclear, I was imagining that jetty could be used > as a consumer or producer, but in this route it's a processor, but a > producer is a processor, so I guess that is why it works. > > package temp.test; > > import org.apache.camel.CamelContext; > import org.apache.camel.Exchange; > import org.apache.camel.builder.RouteBuilder; > import org.apache.camel.impl.DefaultCamelContext; > > > public class JettyRoute { > > public static void main(String[] args) throws Exception { > > CamelContext context = new DefaultCamelContext(); > context.addRoutes(new RouteBuilder(){ > > public void configure(){ > from("file://temp/soap/request?fileName=soap.xml&noop=true") > .convertBodyTo(String.class,"UTF-8") > .setHeader(Exchange.HTTP_METHOD,constant("POST")) > .setHeader(Exchange.CONTENT_TYPE,constant("text/xml")) > .to("jetty:http://xml.rothco.com/xmlfeed.asmx") > .to("file://temp/soap/response?fileName=soap.xml"); > } > }); > context.start(); > Thread.sleep(5000); > context.stop(); > } > } > > > On Sun, May 4, 2014 at 11:19 PM, Willem Jiang wrote: > > > You can user camel-jetty component to build up a proxy for you. > > It just redirect the request( it could be GET request or POST request) to > > the back end service, the request body can be send the back end service as > > well. > > > > -- > > Willem Jiang > > > > Red Hat, Inc. > > Web: http://www.redhat.com > > Blog: http://willemjiang.blogspot.com (English) > > http://jnn.iteye.com (Chinese) > > Twitter: willemjiang > > Weibo: 姜宁willem > > > > > > > > On May 4, 2014 at 9:15:21 PM, Stephen Cameron ([email protected]) > > wrote: > > > Hi, > > > > > > I thought to try doing a simple HTTP POST to a web-service using Camel. > > > > > > My understanding is that this is a Jetty endpoint acting as a Consumer, I > > > simply pass the URL of the webservice to getting and process the response > > > as the start of my route. > > > > > > But how can I do a POST and set the body of the request that Jetty sends > > to > > > the (producer) web-service to be the content of an XML file? > > > > > > [This relates to my previous issue with CXF, I was hoping to sidestep CXF > > > for a brief moment, but nothing is simple] > > > > > > > >
