You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by dunnlow <du...@yahoo.com> on 2011/09/29 19:20:55 UTC

http4 component

I am trying to use the http4 component to send information to a web service. 
I keep getting an error on the http4 endpoint:

SendProcessor.java:102 - >>>
Endpoint[http4://localhost:9090/service?name=Jay] Exchange[null]
CamelLogger.java:186 - Failed delivery for exchangeid: <ID-......>  On
delivery attempt: 0 caught: org.camel.InvalidPayloadException: No body
available of type: java.io.InputStream but has value: <the accurate toString
of my bean> of type com.biz.MyBean on: null.  Caused by: No type converter
available to convert from type: com.biz.MyBean to the required type:
java.io.InputStream with value <the accurate toString of my bean>. 
Exchange[null].  Caused by:
[org.apache.camel.NoTypeConvertsionAvailableException


My route looks like this:

  <camel:from uri="file://c:/indir/"/>
  <camel:transacted/>
  <camel:bean ref="myBean" method="fromXML"/>    <== loads the values in the
bean via xpath
  <camel:setHeader
headerName="CamelHttpMethod"><camel:constant>GET</camel:constant><camel:setHeader>
  <camel:to uri="http4://localhost:9090/myservice?name=mrx"/>

I know that seems like an odd route/call to the service, but this was to
troubleshoot.  I will eventually call the service with variables in the
header, but I'll burn that bridge when i come to it.

If I replace the http4 with stream:out everything works great. 

Any thoughts about what I am doing wrong?  

Why is the component trying to convert my bean to an input stream (as if
it's trying to do more than just call out to the service with the provided
parameters)??

Thanks for any insight.
-J

--
View this message in context: http://camel.465427.n5.nabble.com/http4-component-tp4854058p4854058.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: http4 component

Posted by Willem Jiang <wi...@gmail.com>.
Hi ,

Which version of Camel are you using ?
Not sure what you do in the fromXML method of the bean.
Did you have change to set the message body with bean value ?
It looks the http4 component try to turn it into an input stream.

If you just want to send Http GET request without any body content, you 
may need to set the message body to be null.

On Fri Sep 30 01:20:55 2011, dunnlow wrote:
> I am trying to use the http4 component to send information to a web service.
> I keep getting an error on the http4 endpoint:
>
> SendProcessor.java:102 ->>>
> Endpoint[http4://localhost:9090/service?name=Jay] Exchange[null]
> CamelLogger.java:186 - Failed delivery for exchangeid:<ID-......>   On
> delivery attempt: 0 caught: org.camel.InvalidPayloadException: No body
> available of type: java.io.InputStream but has value:<the accurate toString
> of my bean>  of type com.biz.MyBean on: null.  Caused by: No type converter
> available to convert from type: com.biz.MyBean to the required type:
> java.io.InputStream with value<the accurate toString of my bean>.
> Exchange[null].  Caused by:
> [org.apache.camel.NoTypeConvertsionAvailableException
>
>
> My route looks like this:
>
>    <camel:from uri="file://c:/indir/"/>
>    <camel:transacted/>
>    <camel:bean ref="myBean" method="fromXML"/>     <== loads the values in the
> bean via xpath
>    <camel:setHeader
> headerName="CamelHttpMethod"><camel:constant>GET</camel:constant><camel:setHeader>
>    <camel:to uri="http4://localhost:9090/myservice?name=mrx"/>
>
> I know that seems like an odd route/call to the service, but this was to
> troubleshoot.  I will eventually call the service with variables in the
> header, but I'll burn that bridge when i come to it.
>
> If I replace the http4 with stream:out everything works great.
>
> Any thoughts about what I am doing wrong?
>
> Why is the component trying to convert my bean to an input stream (as if
> it's trying to do more than just call out to the service with the provided
> parameters)??
>
> Thanks for any insight.
> -J
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/http4-component-tp4854058p4854058.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: willemjiang 
Weibo: willemjiang