Re: Transactional aggregator
On Wed, Jan 9, 2013 at 8:13 AM, orz wrote: > Hi, > > Thanks for your reply. I have already read chapters 8 and 9. > > I understand that I can use HawtDBAggregationRepository and redirect the > aggregated exchange(s) to a DLQ after a certain number of retries. > > However, that is not what I want. I need it to behave like the following > steps > 1. Message A sent to jms:queue:test > 2. Aggregator takes message A from jms:queue:test > 3. Message B sent to jms:queue:test > 4. Aggregator takes message B from jms:queue:test and merged as a new > exchange > 5. Aggregator sends new exchange to Http endpoint and > HttpOperationFailedException is thrown. > 6. The transaction is rollbacked and Message A & B still remain on > jms:queue:test > This is not possible with the aggregator. You would need to write your own java bean, and consume the 2 messages from the JMS queue. And merge them yourself. And call the http (you can use Camel for that). And in case of exception, then rollback. For example using client ack mode etc. And alternative is to send the 2 messages back on the JMS queue, though then they would be inserted as new messages, and on top of the queue. > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Transactional-aggregator-tp5725084p5725165.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Re: Output File Name After Exec
Can you provide the non working route? On Tue, Jan 8, 2013 at 9:44 PM, neilac333 wrote: > I have a Camel route that starts off with an executable for which I use > exec > and which produces an output file. The name of the file is specified in the > outFile parameter to Exec. What I want to do next is to pass that file > /name/--not the contents--in the message body to the next component in the > route. > > Seems simple enough, but I don't see any clues in the documentation as to > how to get that outFile name into a message body. Your insight is > appreciated. > > Thanks. > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Output-File-Name-After-Exec-tp5725152.html > Sent from the Camel - Users mailing list archive at Nabble.com. > -- "In a world without walls and fences who needs Windows and Gates?"
Re: Output File Name After Exec
On Tue, Jan 8, 2013 at 9:44 PM, neilac333 wrote: > I have a Camel route that starts off with an executable for which I use exec > and which produces an output file. The name of the file is specified in the > outFile parameter to Exec. What I want to do next is to pass that file > /name/--not the contents--in the message body to the next component in the > route. > > Seems simple enough, but I don't see any clues in the documentation as to > how to get that outFile name into a message body. Your insight is > appreciated. > See this EIP http://camel.apache.org/message-translator.html To set the message body with the content of a message header myHeader Using the header language http://camel.apache.org/header.html > Thanks. > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Output-File-Name-After-Exec-tp5725152.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Re: RecipientList with delimiter argument
Hi Yeah for method 3 we should have a method so you can set that. I have logged a ticket https://issues.apache.org/jira/browse/CAMEL-5945 On Wed, Jan 9, 2013 at 8:00 AM, liugang wrote: > Hi All: > > > > When I plan to use recipientList component, I can only select one from: > > > > Method 1: > > public RecipientListDefinition > recipientList(Expression recipients) {...} > > Method 2: > >public RecipientListDefinition > recipientList(Expression recipients, String delimiter) {...} > > Method 3: > > public > ExpressionClause> recipientList() {...} > > > > Method 3 has more expression can be used than Method 1 and Method 2 , but > unfortunately, we can't specify the delimiter on this case. > > > > So I'd like to know, how I can have a method which works like: > > > > Method 4: > > public > ExpressionClause> recipientList(String > delimiter) {...} > > > > Thanks a lot > > > > GangLiu > -- Claus Ibsen - Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Re: Unable to consume syslog messages
On Tue, Jan 8, 2013 at 5:56 PM, sscott wrote: > sscott wrote >> I set up rsyslogd to forward *.* to localhost:5140. Every log message >> causes Camel to output an InvalidPayloadException caused by a >> NoTypeConversionAvailableException with the detail "No type converter >> available to convert from type: >> org.jboss.netty.buffer.BigEndianHeapChannelBuffer to the required type: >> java.io.InputStream with value BigEndianHeapChannelBuffer(ridx=0, >> widx=105, cap=105)" >> >> When I change the from() to be "mina:", with or without the sync=false and >> allowDefaultCodec=false options, and change the maven dependencies to >> camel-mina from camel-netty, the same exceptions are thrown with the >> detail "No body available of type: java.io.InputStream on: Message: [Body >> is null]. Caused by: No type converter available to convert from type: >> null to the required type: java.io.InputStream with value null." > > In case anybody ever has this problem in the future, it was caused by using > maven-assembly-plugin to package all the code into a jar-with-dependencies. > I'm assuming it's a TypeConverter / MANIFEST.MF issue. > Thanks for sharing your solution to the problem. Yeah be careful with the packaginging an uber JAR thingy. The content in the various files in the META-INF dir need to be merged together, and not override each other. > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Unable-to-consume-syslog-messages-tp5724850p5725140.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
RE: RecipientList with delimiter argument
OK, thanks. GangLiu -Original Message- From: Claus Ibsen [mailto:claus.ib...@gmail.com] Sent: Wednesday, January 09, 2013 4:23 PM To: users@camel.apache.org Subject: Re: RecipientList with delimiter argument Hi Yeah for method 3 we should have a method so you can set that. I have logged a ticket https://issues.apache.org/jira/browse/CAMEL-5945 On Wed, Jan 9, 2013 at 8:00 AM, liugang wrote: > Hi All: > > > > When I plan to use recipientList component, I can only select one from: > > > > Method 1: > > public RecipientListDefinition > recipientList(Expression recipients) {...} > > Method 2: > >public RecipientListDefinition > recipientList(Expression recipients, String delimiter) {...} > > Method 3: > > public > ExpressionClause> recipientList() {...} > > > > Method 3 has more expression can be used than Method 1 and Method 2 , but > unfortunately, we can't specify the delimiter on this case. > > > > So I'd like to know, how I can have a method which works like: > > > > Method 4: > > public > ExpressionClause> recipientList(String > delimiter) {...} > > > > Thanks a lot > > > > GangLiu > -- Claus Ibsen - Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
How can I tell if Apache Camel Splitter didn't split anything?
I have an Apache Camel Splitter such as the following: ... from("{{direct.split}}") .split().method(splitter, "iterate").streaming() .stopOnException() .setHeader("{{header.index}}", simple("${property.CamelSplitIndex}++")) // Other processing .choice .when(property(Exchange.SPLIT_COMPLETE).isEqualTo(true)) .setHeader("{{header.total}}", property(Exchange.SPLIT_SIZE)) .to("{{bean.myService.update}}") .end() .end() .end() ... where splitter in the call to "method()" is a custom iterator used to parse the particular data I am dealing with. Everything is fine when the XML data received has at least 1 element to parse. My issue is when there are no elements to parse, which is legal since there can be 0 to many elements. I want the call to "bean.myService.update" to be called even in the cases where there are no elements to parse. In the above code this call is not made in the case of 0 elements. Any suggestions? -- View this message in context: http://camel.465427.n5.nabble.com/How-can-I-tell-if-Apache-Camel-Splitter-didn-t-split-anything-tp5725181.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How can I tell if Apache Camel Splitter didn't split anything?
On Wed, Jan 9, 2013 at 1:15 PM, wxkevin wrote: > I have an Apache Camel Splitter such as the following: > > ... > from("{{direct.split}}") > .split().method(splitter, "iterate").streaming() > .stopOnException() > .setHeader("{{header.index}}", simple("${property.CamelSplitIndex}++")) > > // Other processing > > .choice > .when(property(Exchange.SPLIT_COMPLETE).isEqualTo(true)) > .setHeader("{{header.total}}", property(Exchange.SPLIT_SIZE)) > .to("{{bean.myService.update}}") > .end() > .end() > .end() > > ... > > where splitter in the call to "method()" is a custom iterator used to parse > the particular data I am dealing with. > > Everything is fine when the XML data received has at least 1 element to > parse. My issue is when there are no elements to parse, which is legal since > there can be 0 to many elements. I want the call to "bean.myService.update" > to be called even in the cases where there are no elements to parse. In the > above code this call is not made in the case of 0 elements. > > Any suggestions? > You can either - always return at least 1 in the iterator, and eg if you have empty, then return a special response, and then in the inlined content based router, you can detect this empty response and call your bean. Or you can after the splitter, see if there was any split complete property on the exchange. The splitter ought to only set those if there was some splitter done. Then you can have filter that checks for this and call your bean. Though I think possible its cleaner to ensure there is always 1 data. > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/How-can-I-tell-if-Apache-Camel-Splitter-didn-t-split-anything-tp5725181.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Re: How can I tell if Apache Camel Splitter didn't split anything?
It doesn't appear that Exchange.SPLIT_COMPLETE, Exchange.SPLIT_SIZE, etc...are available outside the .splitter block. My original thought was to use those provided properties. I can try the always return 1 approach. -- View this message in context: http://camel.465427.n5.nabble.com/How-can-I-tell-if-Apache-Camel-Splitter-didn-t-split-anything-tp5725181p5725183.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How can I tell if Apache Camel Splitter didn't split anything?
So I ended up using a class variable which is initially set to 0. If there are elements to parse then when the splitter is complete it will update the class variable through the use of a processor. Then after the splitter logic I call another processor to get the number of elements parsed. If still 0 then I know nothing was parsed. It would be nice if the splitter provided a function to perform if there are no elements parsed. Is there a JIRA site or something similar for Apache Camel that I could propose this new functionality? -- View this message in context: http://camel.465427.n5.nabble.com/How-can-I-tell-if-Apache-Camel-Splitter-didn-t-split-anything-tp5725181p5725185.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Problem with calling a simple POJO after a route
How can I keep the CamelContext running after I call start() in a standalone java application? Thread.sleep(xxx) does not seem to be an adequate solution for a production system. On Tue, Jan 8, 2013 at 9:40 AM, Meriem wrote: > I tried with : > > CamelContext context = new DefaultCamelContext(); > context.addRoutes(new MyRouteBuilder()); > context.start(); > Thread.sleep(1000); > context.stop(); > System.out.println("End of the program"); > > and it worked. > > Thank you very much for your help. > > Bests, > Meriem. > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Problem-with-calling-a-simple-POJO-after-a-route-tp5725121p5725134.html > Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Failing over in-flight exchanges
Hi, It may be architectural overkill for Camel to fail-over messages that are inflight to another camel context with another identical route. The cost of adding fail-over implies message persistence by the camel core and a degree of stateful-ness which adds to cost per message for not enough value, while guarding against catastrophic failure. Inflight messages counts in Camel are captured and shown in JMX to provide visibility into processing efficiency as routes are by nature multi-threaded and also to ensure shutdowns & route suspensions can be gracefully executed. Moreover, there are other ways in which this requirement can be easily met without altering/adding cost to per message delivery. For example, persisting messages in a JMS queue and then using a JMS transaction or a transactional Camel route will ensure that the transaction is rolled back to the last persist point prior to the route picking the message up. This will allows another identical route looking at the same queue/topic to pick the rolled back message and process it. It will also ensure that you use a solution that is more suited to what you are looking to accomplish without potentially unnecessary and complex engineering. The ability to failover can also be quickly built instrumented into applications using heartbeat messages to ensure that the context/route is up and active. While this may not protect you transactionally, it will ensure that you will still have a fallback strategy. Hope this helps. Cheers, Ashwin... - - Ashwin Karpe Apache Camel Committer & Sr Principal Consultant Red Hat http://www.redhat.com Blog: http://opensourceknowledge.blogspot.com - -- View this message in context: http://camel.465427.n5.nabble.com/Failing-over-in-flight-exchanges-tp5725162p5725188.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Problem with calling a simple POJO after a route
Hi, The CamelContext will be running once started until the context is stopped. The example above is a rather trivial piece of main-line java code running from the command line. If you would like the context to run with more control on the life-cycle, you need to either run it in a container (tomcat, karaf/servicemix, Application Server/ESB) or instrument a loop looking for a command line option to stop the main-line code and gracefully stop the running camel context. Cheers, Ashwin... - - Ashwin Karpe Apache Camel Committer & Sr Principal Consultant Red Hat http://www.redhat.com Blog: http://opensourceknowledge.blogspot.com - -- View this message in context: http://camel.465427.n5.nabble.com/Problem-with-calling-a-simple-POJO-after-a-route-tp5725121p5725190.html Sent from the Camel - Users mailing list archive at Nabble.com.
Issue using camel-cxf and wss4j
Hi, When I try to authenticate an HTTP request using WS-Security with camel-cxf & wss4j interceptor, I get the following error : org.apache.camel.spring.Main.main() INFO [org.apache.camel.spring.SpringCamelContext] - Total 1 routes, of which 1 is started. org.apache.camel.spring.Main.main() INFO [org.apache.camel.spring.SpringCamelContext] - Apache Camel 2.10.0 (CamelContext: camel-1) started in 0.993 seconds qtp370155726-26 INFO [org.apache.cxf.services.CustomerServiceService.CustomerServicePort.CustomerService] - Inbound Message ID: 1 Address: http://127.0.0.1:9090/training/WebService Encoding: UTF-8 Http-Method: POST Content-Type: text/xml;charset=UTF-8 Headers: {accept-encoding=[gzip,deflate], connection=[keep-alive], Content-Length=[1590], content-type=[text/xml;charset=UTF-8], Host=[ 127.0.0.1:9090], SOAPAction=["http://training.fusesource.com/saveCustomer";], User-Agent=[Apache-HttpClient/4.1.1 (java 1.5)]} Payload: http://schemas.xmlsoap.org/soap/envelope/"; xmlns:tra=" http://training.fusesource.com/";> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd " soap:mustUnderstand="1"> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"; xmlns:wsu=" http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"; wsu:Id="UsernameToken-1"> charles http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest ">TVzWGxNvhlixNVWol8poD9DHxl8= http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary ">WsMNSm/C4dzdPS3OhUi94Q== 2013-01-09T15:46:14.908Z ? ? ? ? ? ? ? -- qtp370155726-26 DEBUG [org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor] - WSS4JInInterceptor: enter handleMessage() qtp370155726-26 WARN [org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor] - Security processing failed (actions mismatch) qtp370155726-26 WARN [org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor] - org.apache.ws.security.WSSecurityException: An error was discovered processing the header at org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.checkActions(WSS4JInInterceptor.java:383) at org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:333) at org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:97) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:348) at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:312) at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:72) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:943) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:879) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117) at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110) at org.eclipse.jetty.server.Server.handle(Server.java:349) at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:441) at org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:936) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:801) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:224) at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:51) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:586) at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:44) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:598) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:533) at java.lang.Thread.run(Thread.java:722) qtp370155726-26 WARN [org.apache.cxf.phase.PhaseInterceptorChain] - Interceptor for {http://training.fusesource.com/}CustomerServiceService has thrown exception, unwinding now org.apache.cxf.binding.soap.SoapFault: An error was discovered processing the header at org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.createSoapFault(WSS4JInInterceptor.java:804) at org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:357) at org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:97) at org.apache.cxf.phase.PhaseInterceptorC
Re: recipientList with POST and request body
Willem, Thanks, I read some of your posts in the past, they were very helpful. I appreciate your advice. My currently situation is: I used beans for complicated business logic, to send different requests to different resources and to aggregate the results in the past. But now our company is moving to cloud computing environment, our platform (modified/enhanced camel environment) moved to cloud environment. So Bean implementation is strongly discouraged since (auto/versioned) bean deployment could be very complicated in the environment. I am moving to write all the code in groovy within the route instead of bean as best practice in our group. ProducerTemplate could be good solution if bean implementation is allowed. I tried a simple test by sending single request in groovy(I need to aggregate the final response as part of requirement, also I used setBody tag to cheat route to send request which may not be best practice): import org.apache.camel.ProducerTemplate import org.apache.camel.impl.DefaultProducerTemplate def template = context.createProducerTemplate() def endpoint = "myendpoint" def body = ${header.REST_REQUEST_BODY} def headers = ["Content-Type":"application/json", CamelHttpMethod:"POST"] def response = template.requestBodyAndHeader(endpoint, body, headers, java.lang.String.class) return response I got expected exception: context is missing since context is NOT default build-in variable. How do I get context in "simple" DSL, or how do I get a producerTemplate without using context? If not, is there other solutions/patterns that I can use for this situation without using beans? I am looking at [splitter][broadcast] pattern, but have not found way to resolve it. Maybe this is too demanding for Camel without bean: dynamic URI list, dynamic HTTP method(optional), dynamic request body(optional), and aggregate all responses. I am using Spring DSL plus groovy only, java DSL is not allowed. -- View this message in context: http://camel.465427.n5.nabble.com/recipientList-with-POST-and-request-body-tp5725142p5725192.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: SSH - BouncyCastle
I'm not using directly the BouncyCastle. It was imported by iText dependency. I excluded the dependency to fix the problem. Thanks Best Regards Leandro Franchi On 08-01-2013 21:20, Christian Müller wrote: Which version of BouncyCastle? What is your runtime? Can you share the complete stack trace? Sent from a mobile device Am 08.01.2013 15:34 schrieb "Leandro Franchi" : Hi, I'm using apache camel 2.10.2 and getting the follow error when try to use ssh component consumer. java.lang.NoClassDefFoundError: org.bouncycastle.crypto.prng.VMPCRandomGenerator The jdk version is: 1.7.0_05. I've try to declare bouncycastle dependency on pom without success. Thanks -- Leandro Franchi http://www.chickenten.com
Re: transactions that span multiple routes
Willem, thanks for the idea. Here is a resulting issue I have run into. The 1st route takes a message from queue/batch/ready, it throws it into the seda queue. It basically takes every message it can and stuffs it into the seda queue as fast as it can. The second route does process them as I would expect, but I cannot allow the first route to consume more than one at a time. There are many more machines running this same route that will not have a chance to get any messages. So I came up with this. It fulfills the ability to consume only as many as needed to process, but I don't think its handling the transaction boundary well because of the "blockWhenFull" attribute. It appears that the blocking on the first route is holding the transaction open until it is able to commit the message to the seda queue. I understand that the seda component is asynchronous, and that we are essentially using it to clip off the transaction at the route boundary. But that has its obvious downside of draining the actvemq queue in rapid fashion and queuing them in seda. It is almost as if I need to us a vm component instead of seda, but vm will participate in the transaction, which is the original problem. I have looked into using a throttle on the first route, but the data size being transferred is very inconsistent, and I cant rely on the throttle to feed the second route appropriately. I appreciate your help. If you could please let me know how I might be able to use camel to achieve what I have mentioned above. -- View this message in context: http://camel.465427.n5.nabble.com/transactions-that-span-multiple-routes-tp5723735p5725194.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Issue using camel-cxf and wss4j
Can you upgrade to wss4j 1.6.9? I had a similar issue... Am 09.01.2013 17:31 schrieb "Charles Moulliard" : > Hi, > > When I try to authenticate an HTTP request using WS-Security with camel-cxf > & wss4j interceptor, I get the following error : > > org.apache.camel.spring.Main.main() INFO > [org.apache.camel.spring.SpringCamelContext] - Total 1 routes, of which 1 > is started. > org.apache.camel.spring.Main.main() INFO > [org.apache.camel.spring.SpringCamelContext] - Apache Camel 2.10.0 > (CamelContext: camel-1) started in 0.993 seconds > qtp370155726-26 INFO > > [org.apache.cxf.services.CustomerServiceService.CustomerServicePort.CustomerService] > - Inbound Message > > ID: 1 > Address: http://127.0.0.1:9090/training/WebService > Encoding: UTF-8 > Http-Method: POST > Content-Type: text/xml;charset=UTF-8 > Headers: {accept-encoding=[gzip,deflate], connection=[keep-alive], > Content-Length=[1590], content-type=[text/xml;charset=UTF-8], Host=[ > 127.0.0.1:9090], SOAPAction=["http://training.fusesource.com/saveCustomer > "], > User-Agent=[Apache-HttpClient/4.1.1 (java 1.5)]} > Payload: http://schemas.xmlsoap.org/soap/envelope/"; xmlns:tra=" > http://training.fusesource.com/";> > > http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd > " >soap:mustUnderstand="1"> > http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd > " > xmlns:wsu=" > > http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd > " > wsu:Id="UsernameToken-1"> > charles > http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest > ">TVzWGxNvhlixNVWol8poD9DHxl8= > http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary > ">WsMNSm/C4dzdPS3OhUi94Q== > 2013-01-09T15:46:14.908Z > > > > > > > > ? > > ? > ? > ? > > ? > > ? > > ? > > > > > -- > qtp370155726-26 DEBUG [org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor] > - WSS4JInInterceptor: enter handleMessage() > qtp370155726-26 WARN [org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor] > - Security processing failed (actions mismatch) > qtp370155726-26 WARN [org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor] > - > org.apache.ws.security.WSSecurityException: An error was discovered > processing the header > at > > org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.checkActions(WSS4JInInterceptor.java:383) > at > > org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:333) > at > > org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:97) > at > > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262) > at > > org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) > at > > org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:348) > at > > org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:312) > at > > org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:72) > at > > org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:943) > at > > org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:879) > at > > org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117) > at > > org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250) > at > > org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110) > at org.eclipse.jetty.server.Server.handle(Server.java:349) > at > > org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:441) > at > > org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:936) > at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:801) > at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:224) > at > > org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:51) > at > > org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:586) > at > > org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:44) > at > > org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:598) > at > > org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:533) > at java.lang.Thread.run(Thread.java:722) > qtp370155726-26 WARN [org.apache.cxf.phase.PhaseInterceptorChain] - > Interceptor for {http://training.fusesource.com/}CustomerServiceServicehas > thrown exception, unwinding now > org.apache.cxf.binding.soap.S
Re: Issue using camel-cxf and wss4j
Will test with 1.6.9. Until now in debug mode, I see that in the class WSS4JInInterceptor, when we handle the message (handleMessage(SoapMessage msg) throws Fault), the element is empty (Element elem = WSSecurityUtil.getSecurityHeader(doc.getSOAPPart(), actor); ) even if a SOAPHeader with usernameToken + timeStamp has been provided in the SOAPEnveloppe On Wed, Jan 9, 2013 at 6:53 PM, Christian Müller < christian.muel...@gmail.com> wrote: > Can you upgrade to wss4j 1.6.9? I had a similar issue... > Am 09.01.2013 17:31 schrieb "Charles Moulliard" : > > > Hi, > > > > When I try to authenticate an HTTP request using WS-Security with > camel-cxf > > & wss4j interceptor, I get the following error : > > > > org.apache.camel.spring.Main.main() INFO > > [org.apache.camel.spring.SpringCamelContext] - Total 1 routes, of which 1 > > is started. > > org.apache.camel.spring.Main.main() INFO > > [org.apache.camel.spring.SpringCamelContext] - Apache Camel 2.10.0 > > (CamelContext: camel-1) started in 0.993 seconds > > qtp370155726-26 INFO > > > > > [org.apache.cxf.services.CustomerServiceService.CustomerServicePort.CustomerService] > > - Inbound Message > > > > ID: 1 > > Address: http://127.0.0.1:9090/training/WebService > > Encoding: UTF-8 > > Http-Method: POST > > Content-Type: text/xml;charset=UTF-8 > > Headers: {accept-encoding=[gzip,deflate], connection=[keep-alive], > > Content-Length=[1590], content-type=[text/xml;charset=UTF-8], Host=[ > > 127.0.0.1:9090], SOAPAction=[" > http://training.fusesource.com/saveCustomer > > "], > > User-Agent=[Apache-HttpClient/4.1.1 (java 1.5)]} > > Payload: http://schemas.xmlsoap.org/soap/envelope/"; xmlns:tra=" > > http://training.fusesource.com/";> > > > > http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd > > " > >soap:mustUnderstand="1"> > > http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd > > " > > xmlns:wsu=" > > > > > http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd > > " > > wsu:Id="UsernameToken-1"> > > charles > > http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest > > ">TVzWGxNvhlixNVWol8poD9DHxl8= > > http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary > > ">WsMNSm/C4dzdPS3OhUi94Q== > > 2013-01-09T15:46:14.908Z > > > > > > > > > > > > > > > > ? > > > > ? > > ? > > ? > > > > ? > > > > ? > > > > ? > > > > > > > > > > -- > > qtp370155726-26 DEBUG > [org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor] > > - WSS4JInInterceptor: enter handleMessage() > > qtp370155726-26 WARN > [org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor] > > - Security processing failed (actions mismatch) > > qtp370155726-26 WARN > [org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor] > > - > > org.apache.ws.security.WSSecurityException: An error was discovered > > processing the header > > at > > > > > org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.checkActions(WSS4JInInterceptor.java:383) > > at > > > > > org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:333) > > at > > > > > org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:97) > > at > > > > > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262) > > at > > > > > org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) > > at > > > > > org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:348) > > at > > > > > org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:312) > > at > > > > > org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:72) > > at > > > > > org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:943) > > at > > > > > org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:879) > > at > > > > > org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117) > > at > > > > > org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250) > > at > > > > > org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110) > > at org.eclipse.jetty.server.Server.handle(Server.java:349) > > at > > > > > org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:441) > > at > > > > > org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:936) > > at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:801) > > at org.eclipse.jetty.http.Htt
Re: Issue using camel-cxf and wss4j
Get same issue even If I use camel with cxf 2.7.1 and wss4j 1.6.9. Surprisingly the example that we have in camel project (that I created a few years ago) including a unit test succeeds --> https://github.com/apache/camel/blob/trunk/examples/camel-example-reportincident-wssecurity/src/test/java/org/apache/camel/example/reportincident/ReportIncidentRoutesTest.java On Wed, Jan 9, 2013 at 8:02 PM, Charles Moulliard wrote: > Will test with 1.6.9. > > Until now in debug mode, I see that in the class WSS4JInInterceptor, when > we handle the message (handleMessage(SoapMessage msg) throws Fault), the > element is empty (Element elem = > WSSecurityUtil.getSecurityHeader(doc.getSOAPPart(), actor); ) even if a > SOAPHeader with usernameToken + timeStamp has been provided in the > SOAPEnveloppe > > > On Wed, Jan 9, 2013 at 6:53 PM, Christian Müller < > christian.muel...@gmail.com> wrote: > >> Can you upgrade to wss4j 1.6.9? I had a similar issue... >> Am 09.01.2013 17:31 schrieb "Charles Moulliard" : >> >> > Hi, >> > >> > When I try to authenticate an HTTP request using WS-Security with >> camel-cxf >> > & wss4j interceptor, I get the following error : >> > >> > org.apache.camel.spring.Main.main() INFO >> > [org.apache.camel.spring.SpringCamelContext] - Total 1 routes, of which >> 1 >> > is started. >> > org.apache.camel.spring.Main.main() INFO >> > [org.apache.camel.spring.SpringCamelContext] - Apache Camel 2.10.0 >> > (CamelContext: camel-1) started in 0.993 seconds >> > qtp370155726-26 INFO >> > >> > >> [org.apache.cxf.services.CustomerServiceService.CustomerServicePort.CustomerService] >> > - Inbound Message >> > >> > ID: 1 >> > Address: http://127.0.0.1:9090/training/WebService >> > Encoding: UTF-8 >> > Http-Method: POST >> > Content-Type: text/xml;charset=UTF-8 >> > Headers: {accept-encoding=[gzip,deflate], connection=[keep-alive], >> > Content-Length=[1590], content-type=[text/xml;charset=UTF-8], Host=[ >> > 127.0.0.1:9090], SOAPAction=[" >> http://training.fusesource.com/saveCustomer >> > "], >> > User-Agent=[Apache-HttpClient/4.1.1 (java 1.5)]} >> > Payload: http://schemas.xmlsoap.org/soap/envelope/"; xmlns:tra=" >> > http://training.fusesource.com/";> >> > >> > http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd >> > " >> >soap:mustUnderstand="1"> >> > http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd >> > " >> > xmlns:wsu=" >> > >> > >> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd >> > " >> > wsu:Id="UsernameToken-1"> >> > charles >> > http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest >> > ">TVzWGxNvhlixNVWol8poD9DHxl8= >> > http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary >> > ">WsMNSm/C4dzdPS3OhUi94Q== >> > 2013-01-09T15:46:14.908Z >> > >> > >> > >> > >> > >> > >> > >> > ? >> > >> > ? >> > ? >> > ? >> > >> > ? >> > >> > ? >> > >> > ? >> > >> > >> > >> > >> > -- >> > qtp370155726-26 DEBUG >> [org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor] >> > - WSS4JInInterceptor: enter handleMessage() >> > qtp370155726-26 WARN >> [org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor] >> > - Security processing failed (actions mismatch) >> > qtp370155726-26 WARN >> [org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor] >> > - >> > org.apache.ws.security.WSSecurityException: An error was discovered >> > processing the header >> > at >> > >> > >> org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.checkActions(WSS4JInInterceptor.java:383) >> > at >> > >> > >> org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:333) >> > at >> > >> > >> org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:97) >> > at >> > >> > >> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262) >> > at >> > >> > >> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) >> > at >> > >> > >> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:348) >> > at >> > >> > >> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:312) >> > at >> > >> > >> org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:72) >> > at >> > >> > >> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:943) >> > at >> > >> > >> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:879) >> > at >> > >> > >> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
Re: repeating the steps from the route
http://camel.apache.org/loop.html On Tue, Jan 8, 2013 at 1:45 PM, Kesireddy, Chandana (ITD) < chandana.kesire...@state.ma.us> wrote: > Following is the route : > > public class MyRouteBuilder extends RouteBuilder { > @Override > public void configure() throws Exception { > // xnc route here > String xncFileSupport = ICEndPoints.getValue(XNC_FILE_SUPPORT); > if (XNC_SUPPORT_ON.equalsIgnoreCase(xncFileSupport)) { >try { > InProcessor inproc = new InProcessor(); > String rootXncFolder = ICEndPoints.getRootXNCFolder(); > String sourceFolder = > getXNCSourceURI(pollDelayParameter,rootXncFolder); > AgentAuthProcessor authProc = new AgentAuthProcessor(); > ConfigurationUtils utils = ConfigurationUtils.getInstance(); > Configuration config = utils.getConfig(); > String agentUserPwdUrl = MyUtils.getAgentUserPwdUrl(utils, config); > // xnc route starts here > from(sourceFolder) > // the exception clause here > .onException(Exception.class) > .maximumRedeliveries(redeliveryCount) > .redeliveryDelay(redeliveryDelay) > .logHandled(true) > .logRetryStackTrace(stackValue) > .retryAttemptedLogLevel(LoggingLevel.WARN) > .retriesExhaustedLogLevel(LoggingLevel.ERROR) > .backOffMultiplier(2.0) > .handled(true) > .to(SEDA_XNC_EXCEPTION) > .end() > .process(pickupProc) > .choice() >.when(header(Constants.GATEWAY_AUTH_VALUE).isEqualTo(true)) >.process(authProc) >.to(agentUserPwdUrl) >.otherwise() >.process(authProc) >.end() > .process(inproc) > .recipientList(header(Constants.DESTINATION_URI)) > .process(new CommandResponseProcessor()) // try using xpath here also > > > } > } > } > > > I want to repeat the following steps from the route based on a condition: > > .choice() > .when(header(Constants.GATEWAY_AUTH_VALUE).isEqualTo(true)) > .process(authProc) > .to(agentUserPwdUrl) > .otherwise() > .process(authProc) > .end() > .process(inproc) > .recipientList(header(Constants.DESTINATION_URI)) > > Iam using camel 2.4 , can you please suggest me how to repeat the above > steps from the route based on a condition. > > Thanks, > Chandana > > > -- *Christian Posta* http://www.christianposta.com/blog twitter: @christianposta
Re: recipientList with POST and request body
I tried producerTemplate for bean approach (in groovy) too. I got exception when I tried to POST to an HTTP endpoint: def template = context.createProducerTemplate() def endpointUri = headers.END_POINT def xheaders = ["Content-Type":"application/json", "CamelHttpMethod":"POST"] def xbody ='''{"id":["48792683442"],"index":"0"}''' def response = template.requestBodyAndHeaders(endpointUri, xbody, xheaders, java.lang.String.class) exchange.in.setBody(response) the exception is: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: {"id":["48792683442"],"index":"0"}] at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1237)[camel-core-2.9.1.jar:2.9.1] at org.apache.camel.util.ExchangeHelper.extractResultBody(ExchangeHelper.java:509)[camel-core-2.9.1.jar:2.9.1] at org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:442)[camel-core-2.9.1.jar:2.9.1] at org.apache.camel.impl.DefaultProducerTemplate.sendBodyAndHeaders(DefaultProducerTemplate.java:247)[camel-core-2.9.1.jar:2.9.1] at org.apache.camel.impl.DefaultProducerTemplate.requestBodyAndHeaders(DefaultProducerTemplate.java:296)[camel-core-2.9.1.jar:2.9.1] at org.apache.camel.impl.DefaultProducerTemplate.requestBodyAndHeaders(DefaultProducerTemplate.java:292)[camel-core-2.9.1.jar:2.9.1] at org.apache.camel.impl.DefaultProducerTemplate.requestBodyAndHeaders(DefaultProducerTemplate.java:329)[camel-core-2.9.1.jar:2.9.1] at org.apache.camel.ProducerTemplate$requestBodyAndHeaders.call(Unknown Source) I changed to use template.sendBodyAndHeaders(endpointUri, xbody, xheaders) in case the result is causing problem, I got same exception. Can anybody help to use producerTemplate to POST/PUT/DELETE HTTP request? It should not be limited to do only GET, isn't it? no document says anything about setting HTTP methods for producerTemplate. It would be tedious to write my own httpClient based code. -- View this message in context: http://camel.465427.n5.nabble.com/recipientList-with-POST-and-request-body-tp5725142p5725201.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Issue using camel-cxf and wss4j
Find the issue. When we setup camel-cxf endpoint using as DataFormat=MESSAGE, SOAP securityHeaders are removed. On Wed, Jan 9, 2013 at 5:30 PM, Charles Moulliard wrote: > Hi, > > When I try to authenticate an HTTP request using WS-Security with > camel-cxf & wss4j interceptor, I get the following error : > > org.apache.camel.spring.Main.main() INFO > [org.apache.camel.spring.SpringCamelContext] - Total 1 routes, of which 1 > is started. > org.apache.camel.spring.Main.main() INFO > [org.apache.camel.spring.SpringCamelContext] - Apache Camel 2.10.0 > (CamelContext: camel-1) started in 0.993 seconds > qtp370155726-26 INFO > [org.apache.cxf.services.CustomerServiceService.CustomerServicePort.CustomerService] > - Inbound Message > > ID: 1 > Address: http://127.0.0.1:9090/training/WebService > Encoding: UTF-8 > Http-Method: POST > Content-Type: text/xml;charset=UTF-8 > Headers: {accept-encoding=[gzip,deflate], connection=[keep-alive], > Content-Length=[1590], content-type=[text/xml;charset=UTF-8], Host=[ > 127.0.0.1:9090], SOAPAction=["http://training.fusesource.com/saveCustomer";], > User-Agent=[Apache-HttpClient/4.1.1 (java 1.5)]} > Payload: http://schemas.xmlsoap.org/soap/envelope/"; xmlns:tra=" > http://training.fusesource.com/";> > > http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd > " >soap:mustUnderstand="1"> > http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"; > xmlns:wsu=" > http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"; > wsu:Id="UsernameToken-1"> > charles > http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest > ">TVzWGxNvhlixNVWol8poD9DHxl8= > http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary > ">WsMNSm/C4dzdPS3OhUi94Q== > 2013-01-09T15:46:14.908Z > > > > > > > > ? > > ? > ? > ? > > ? > > ? > > ? > > > > > -- > qtp370155726-26 DEBUG > [org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor] - WSS4JInInterceptor: > enter handleMessage() > qtp370155726-26 WARN [org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor] > - Security processing failed (actions mismatch) > qtp370155726-26 WARN [org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor] > - > org.apache.ws.security.WSSecurityException: An error was discovered > processing the header > at > org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.checkActions(WSS4JInInterceptor.java:383) > at > org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:333) > at > org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:97) > at > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262) > at > org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) > at > org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:348) > at > org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:312) > at > org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:72) > at > org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:943) > at > org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:879) > at > org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117) > at > org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250) > at > org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110) > at org.eclipse.jetty.server.Server.handle(Server.java:349) > at > org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:441) > at > org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:936) > at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:801) > at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:224) > at > org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:51) > at > org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:586) > at > org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:44) > at > org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:598) > at > org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:533) > at java.lang.Thread.run(Thread.java:722) > qtp370155726-26 WARN [org.apache.cxf.phase.PhaseInterceptorChain] - > Interceptor for {http://training.fusesource.com/}CustomerServiceServicehas > thrown exception, unwinding no
Re: recipientList with POST and request body
I just checked the camel-script code, it will bind the camel context within the script context. But it should be more easy to write a custom bean[1] and inject the camel context to it, then you can get full control of it. [1]http://camel.apache.org/bean.html -- Willem Jiang Red Hat, Inc. FuseSource is now part of Red Hat Web: http://www.fusesource.com | http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: 姜宁willem On Thursday, January 10, 2013 at 1:00 AM, Zemin Hu wrote: > Willem, > Thanks, I read some of your posts in the past, they were very helpful. I > appreciate your advice. > My currently situation is: I used beans for complicated business logic, to > send different requests to different resources and to aggregate the results > in the past. But now our company is moving to cloud computing environment, > our platform (modified/enhanced camel environment) moved to cloud > environment. So Bean implementation is strongly discouraged since > (auto/versioned) bean deployment could be very complicated in the > environment. > > I am moving to write all the code in groovy within the route instead of bean > as best practice in our group. ProducerTemplate could be good solution if > bean implementation is allowed. I tried a simple test by sending single > request in groovy(I need to aggregate the final response as part of > requirement, also I used setBody tag to cheat route to send request which > may not be best practice): > > > import org.apache.camel.ProducerTemplate > import org.apache.camel.impl.DefaultProducerTemplate > > def template = context.createProducerTemplate() > def endpoint = "myendpoint" > def body = ${header.REST_REQUEST_BODY} > def headers = ["Content-Type":"application/json", CamelHttpMethod:"POST"] > def response = template.requestBodyAndHeader(endpoint, body, headers, > java.lang.String.class) > return response > > > I got expected exception: context is missing since context is NOT default > build-in variable. How do I get context in "simple" DSL, or how do I get a > producerTemplate without using context? > If not, is there other solutions/patterns that I can use for this situation > without using beans? > I am looking at [splitter][broadcast] pattern, but have not found way to > resolve it. Maybe this is too demanding for Camel without bean: dynamic URI > list, dynamic HTTP method(optional), dynamic request body(optional), and > aggregate all responses. I am using Spring DSL plus groovy only, java DSL is > not allowed. > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/recipientList-with-POST-and-request-body-tp5725142p5725192.html > Sent from the Camel - Users mailing list archive at Nabble.com > (http://Nabble.com).
Re: recipientList with POST and request body
Oh, you need to start the template before using it to send the request. -- Willem Jiang Red Hat, Inc. FuseSource is now part of Red Hat Web: http://www.fusesource.com | http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: 姜宁willem On Thursday, January 10, 2013 at 4:42 AM, Zemin Hu wrote: > I tried producerTemplate for bean approach (in groovy) too. I got exception > when I tried to POST to an HTTP endpoint: > def template = context.createProducerTemplate() > > def endpointUri = headers.END_POINT > def xheaders = ["Content-Type":"application/json", > "CamelHttpMethod":"POST"] > def xbody ='''{"id":["48792683442"],"index":"0"}''' > > def response = template.requestBodyAndHeaders(endpointUri, xbody, xheaders, > java.lang.String.class) > exchange.in.setBody(response) > the exception is: > > org.apache.camel.CamelExecutionException: Exception occurred during > execution on the exchange: Exchange[Message: > {"id":["48792683442"],"index":"0"}] > at > org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1237)[camel-core-2.9.1.jar:2.9.1] > at > org.apache.camel.util.ExchangeHelper.extractResultBody(ExchangeHelper.java:509)[camel-core-2.9.1.jar:2.9.1] > at > org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:442)[camel-core-2.9.1.jar:2.9.1] > at > org.apache.camel.impl.DefaultProducerTemplate.sendBodyAndHeaders(DefaultProducerTemplate.java:247)[camel-core-2.9.1.jar:2.9.1] > at > org.apache.camel.impl.DefaultProducerTemplate.requestBodyAndHeaders(DefaultProducerTemplate.java:296)[camel-core-2.9.1.jar:2.9.1] > at > org.apache.camel.impl.DefaultProducerTemplate.requestBodyAndHeaders(DefaultProducerTemplate.java:292)[camel-core-2.9.1.jar:2.9.1] > at > org.apache.camel.impl.DefaultProducerTemplate.requestBodyAndHeaders(DefaultProducerTemplate.java:329)[camel-core-2.9.1.jar:2.9.1] > at org.apache.camel.ProducerTemplate$requestBodyAndHeaders.call(Unknown > Source) > > I changed to use template.sendBodyAndHeaders(endpointUri, xbody, xheaders) > in case the result is causing problem, I got same exception. > Can anybody help to use producerTemplate to POST/PUT/DELETE HTTP request? It > should not be limited to do only GET, isn't it? no document says anything > about setting HTTP methods for producerTemplate. It would be tedious to > write my own httpClient based code. > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/recipientList-with-POST-and-request-body-tp5725142p5725201.html > Sent from the Camel - Users mailing list archive at Nabble.com > (http://Nabble.com).
Re: Issue using camel-cxf and wss4j
On Thu, Jan 10, 2013 at 12:00 AM, Charles Moulliard wrote: > Find the issue. When we setup camel-cxf endpoint using as > DataFormat=MESSAGE, SOAP securityHeaders are removed. > I think there is a new CXF_MESSAGE or something. There was some new formats added, but never documented. I logged a ticket about the missing docs. I think one of the new ones, support both headers + payload in a streaming like mode. > > On Wed, Jan 9, 2013 at 5:30 PM, Charles Moulliard wrote: > >> Hi, >> >> When I try to authenticate an HTTP request using WS-Security with >> camel-cxf & wss4j interceptor, I get the following error : >> >> org.apache.camel.spring.Main.main() INFO >> [org.apache.camel.spring.SpringCamelContext] - Total 1 routes, of which 1 >> is started. >> org.apache.camel.spring.Main.main() INFO >> [org.apache.camel.spring.SpringCamelContext] - Apache Camel 2.10.0 >> (CamelContext: camel-1) started in 0.993 seconds >> qtp370155726-26 INFO >> [org.apache.cxf.services.CustomerServiceService.CustomerServicePort.CustomerService] >> - Inbound Message >> >> ID: 1 >> Address: http://127.0.0.1:9090/training/WebService >> Encoding: UTF-8 >> Http-Method: POST >> Content-Type: text/xml;charset=UTF-8 >> Headers: {accept-encoding=[gzip,deflate], connection=[keep-alive], >> Content-Length=[1590], content-type=[text/xml;charset=UTF-8], Host=[ >> 127.0.0.1:9090], SOAPAction=["http://training.fusesource.com/saveCustomer";], >> User-Agent=[Apache-HttpClient/4.1.1 (java 1.5)]} >> Payload: http://schemas.xmlsoap.org/soap/envelope/"; xmlns:tra=" >> http://training.fusesource.com/";> >> >> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd >> " >>soap:mustUnderstand="1"> >> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"; >> xmlns:wsu=" >> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"; >> wsu:Id="UsernameToken-1"> >> charles >> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest >> ">TVzWGxNvhlixNVWol8poD9DHxl8= >> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary >> ">WsMNSm/C4dzdPS3OhUi94Q== >> 2013-01-09T15:46:14.908Z >> >> >> >> >> >> >> >> ? >> >> ? >> ? >> ? >> >> ? >> >> ? >> >> ? >> >> >> >> >> -- >> qtp370155726-26 DEBUG >> [org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor] - WSS4JInInterceptor: >> enter handleMessage() >> qtp370155726-26 WARN [org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor] >> - Security processing failed (actions mismatch) >> qtp370155726-26 WARN [org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor] >> - >> org.apache.ws.security.WSSecurityException: An error was discovered >> processing the header >> at >> org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.checkActions(WSS4JInInterceptor.java:383) >> at >> org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:333) >> at >> org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:97) >> at >> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262) >> at >> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) >> at >> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:348) >> at >> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:312) >> at >> org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:72) >> at >> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:943) >> at >> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:879) >> at >> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117) >> at >> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250) >> at >> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110) >> at org.eclipse.jetty.server.Server.handle(Server.java:349) >> at >> org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:441) >> at >> org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:936) >> at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:801) >> at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:224) >> at >> org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:51) >> at >> org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:586) >> at >> org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelE
Re: Issue using camel-cxf and wss4j
In the MESSAGE data format, camel-cxf will not let the interceptor which can build the SOAP message from the input stream to be called. So the WSS4JInInterceptor will not work any more. I think that is why CXF_MESSAGE is introduced, I will dig the code to see if I see the whole picture of it. -- Willem Jiang Red Hat, Inc. FuseSource is now part of Red Hat Web: http://www.fusesource.com | http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: 姜宁willem On Thursday, January 10, 2013 at 7:00 AM, Charles Moulliard wrote: > Find the issue. When we setup camel-cxf endpoint using as > DataFormat=MESSAGE, SOAP securityHeaders are removed. > > > On Wed, Jan 9, 2013 at 5:30 PM, Charles Moulliard (mailto:ch0...@gmail.com)> wrote: > > > Hi, > > > > When I try to authenticate an HTTP request using WS-Security with > > camel-cxf & wss4j interceptor, I get the following error : > > > > org.apache.camel.spring.Main.main() INFO > > [org.apache.camel.spring.SpringCamelContext] - Total 1 routes, of which 1 > > is started. > > org.apache.camel.spring.Main.main() INFO > > [org.apache.camel.spring.SpringCamelContext] - Apache Camel 2.10.0 > > (CamelContext: camel-1) started in 0.993 seconds > > qtp370155726-26 INFO > > [org.apache.cxf.services.CustomerServiceService.CustomerServicePort.CustomerService] > > - Inbound Message > > > > ID: 1 > > Address: http://127.0.0.1:9090/training/WebService > > Encoding: UTF-8 > > Http-Method: POST > > Content-Type: text/xml;charset=UTF-8 > > Headers: {accept-encoding=[gzip,deflate], connection=[keep-alive], > > Content-Length=[1590], content-type=[text/xml;charset=UTF-8], Host=[ > > 127.0.0.1:9090], SOAPAction=["http://training.fusesource.com/saveCustomer";], > > User-Agent=[Apache-HttpClient/4.1.1 (java 1.5)]} > > Payload: http://schemas.xmlsoap.org/soap/envelope/"; xmlns:tra=" > > http://training.fusesource.com/";> > > > > http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd > > " > > soap:mustUnderstand="1"> > > http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"; > > xmlns:wsu=" > > http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"; > > wsu:Id="UsernameToken-1"> > > charles > > http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest > > ">TVzWGxNvhlixNVWol8poD9DHxl8= > > http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary > > ">WsMNSm/C4dzdPS3OhUi94Q== > > 2013-01-09T15:46:14.908Z > > > > > > > > > > > > > > > > ? > > > > ? > > ? > > ? > > > > ? > > > > ? > > > > ? > > > > > > > > > > -- > > qtp370155726-26 DEBUG > > [org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor] - WSS4JInInterceptor: > > enter handleMessage() > > qtp370155726-26 WARN [org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor] > > - Security processing failed (actions mismatch) > > qtp370155726-26 WARN [org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor] > > - > > org.apache.ws.security.WSSecurityException: An error was discovered > > processing the header > > at > > org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.checkActions(WSS4JInInterceptor.java:383) > > at > > org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:333) > > at > > org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor.handleMessage(WSS4JInInterceptor.java:97) > > at > > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262) > > at > > org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) > > at > > org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:348) > > at > > org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:312) > > at > > org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:72) > > at > > org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:943) > > at > > org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:879) > > at > > org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117) > > at > > org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250) > > at > > org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110) > > at org.eclipse.jetty.server.Server.handle(Server.java:349) > > at > > org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:441) > > at > > org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:936) > > at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:801) > > at org.eclipse.jetty.http.Http