Hi,
When you use the content-type of "application/x-www-form-urlencoded”, you are
supposed to send the parameters in message body instead of using URL options.
You can find more information here[1]
Please put paramters into the message body by using setBody DSL
setBody("serviceType=getNextIDFromDB&serviceID=1&dataElementID=814&dataSourceID=50”)
[1]http://stackoverflow.com/questions/14551194/how-are-parameters-sent-in-an-http-post-request
--
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 March 20, 2015 at 6:56:38 AM, Alden, John ([email protected])
wrote:
> Hi all, I'm having some trouble making a REST service call with POST
> parameters. I saw
> a similar post but I didn't understand the solution and I need some more
> direction.
>
> http://camel.465427.n5.nabble.com/Http-Component-Sending-Post-Parameters-td5740321.html#a5740409
>
>
> The following is my route configuration.
>
> from("timer://runOnce?repeatCount=1")
> .onException(Exception.class)
> .handled(true)
> .process(new GenericExceptionProcessor())
> .end()
> .setHeader(Exchange.HTTP_METHOD, simple("POST"))
> .setHeader(Exchange.CONTENT_TYPE,
> simple("application/x-www-form-urlencoded"))
> .to("https://dev-sdsservices-was8/IMSDSWebService/servlet/SDSClientRequestServlet"
>
> +
> "?proxyHost=VDDP03C-EDB4ED9&proxyPort=8888&httpClient.authenticationPreemptive=true"
>
> + "&authMethod=Basic&authUsername=********&authPassword=********")
> +
> "&serviceType=getNextIDFromDB&serviceID=1&dataElementID=814&dataSourceID=50"
> .to("file:{{sf.archive.dir}}?fileName=sds-response.xml")
> .end();
>
> The request is made using the POST method -- verified with Fiddler. However,
> the parameters
> are being sent as a query string on the URL. I am successfully calling the
> service, however,
> an error is returned because the service requires POST parameters.
>
> I would appreciate any help with POSTing the parameters
> ("&serviceType=getNextIDFromDB&serviceID=1&dataElementID=814&dataSourceID=50")
>
> to the service.
>
>