btw you can add a HTTP header to the curl command which should allow you to not use the workaround.
On Tue, Mar 29, 2011 at 8:54 AM, Claus Ibsen <[email protected]> wrote: > Hi Knut > > Thanks for reporting. I have created a ticket > https://issues.apache.org/jira/browse/CAMEL-3816 > > > > On Mon, Mar 28, 2011 at 9:32 PM, Knut Enners <[email protected]> wrote: >> Finally, I found the error - thanks for helping anyway ;) >> >> It's a camel bug (2.4., 2.6) affecting the classes >> org.apache.camel.component.http.DefaultHttpBinding >> org.apache.camel.component.http4.DefaultHttpBinding >> >> method readRequest needs to check null-values, as POST requests may not set >> any headers. >> ... >> Map<String, Object> headers = message.getHeaders(); >> Enumeration names = request.getHeaderNames(); >> while (names.hasMoreElements()) { >> String name = (String)names.nextElement(); >> Object value = request.getHeader(name); >> ... >> >> As a workaround you need to write a custom http binding as described in the >> camel-component docs. The attached file works for me, calling super() in >> case there are headers, otherwise we need to leave out fancy header >> evaluation and message transformation (we do not have access to some private >> props) >> >> cheers, Knut >> >> >> >> On 23.03.2011 02:46, Knut Enners wrote: >>> >>> Hi, >>> basically I need to implement a service to which xml-documents are send >>> via http post. Afterwards they should get routed to a JMS queue. >>> Problem: whatever I post to the service results in the Exception: >>> (curl -v -d file.xml 'http://localhost:4443/to2-service/sendMessage' ; >>> http get requests are answered) >>> >>> java.lang.ArrayIndexOutOfBoundsException: 1 >>> at >>> >>> org.apache.camel.component.http.DefaultHttpBinding.populateRequestParameters(DefaultHttpBinding.java:159)[198:org.apache.camel.camel-http:2.6.0.fuse-00-00] >>> >>> at >>> >>> org.apache.camel.component.http.DefaultHttpBinding.readRequest(DefaultHttpBinding.java:100)[198:org.apache.camel.camel-http:2.6.0.fuse-00-00] >>> >>> at >>> >>> org.apache.camel.component.http.HttpMessage.<init>(HttpMessage.java:46)[198:org.apache.camel.camel-http:2.6.0.fuse-00-00] >>> >>> ... >>> >>> Here is a simplified version that leads to the same error: >>> >>> <?xml version="1.0" encoding="UTF-8"?> >>> <blueprint >>> xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" >>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >>> xsi:schemaLocation=" >>> http://www.osgi.org/xmlns/blueprint/v1.0.0 >>> http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"> >>> >>> <camelContext xmlns="http://camel.apache.org/schema/blueprint"> >>> <route> >>> <from uri="jetty:http://0.0.0.0:4443/service?matchOnUriPrefix=true"/> >>> <log message="Copying ${file:name} to the output directory"/> >>> <to uri="file:data/output"/> >>> </route> >>> </camelContext> >>> >>> </blueprint> >>> >>> Servicemix: apache-servicemix-4.3.0 and apache-servicemix-4.3.1-fuse-00-00 >>> >>> I already played around with converting to String or StreamSource and >>> setting options like disableStreamCache... without luck. >>> >>> With apache-servicemix-4.2.0 everything works fine, but I run into >>> following issue on the JMS side: >>> >>> http://servicemix.396122.n5.nabble.com/java-lang-ClassNotFoundException-org-apache-camel-component-jms-JmsComponent-when-using-camel-from-u-td3413867.html >>> >>> >>> How can I get around this? Have I configured s.th. wrong, should I >>> implement the stuff with servicemix-xyz components or try to get >>> activemq running with apache-servicemix-4.2.0? >>> >>> thanks und regards, >>> Knut >> >> > > > > -- > Claus Ibsen > ----------------- > FuseSource > Email: [email protected] > Web: http://fusesource.com > Twitter: davsclaus > Blog: http://davsclaus.blogspot.com/ > Author of Camel in Action: http://www.manning.com/ibsen/ > -- Claus Ibsen ----------------- FuseSource Email: [email protected] Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
