You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Zulio84 <gi...@hotmail.com> on 2014/03/11 13:08:09 UTC
HttpClient Bean Serialization inside an Http Header
Hi guys!
I've a bean that contains some serializable value (the bean is serializable
too).
I want to send that bean to a server.
I put this bean inside an Exchange header the i use HTTPComponent as
httpclient to invoke a server.
Inside the server i try to deserialize the bean from the header but that i
read is the "java object id".
E.g.
"com.class.MyBean@b9d1cf3f"
Any suggestion?
--
View this message in context: http://camel.465427.n5.nabble.com/HttpClient-Bean-Serialization-inside-an-Http-Header-tp5748628.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: HttpClient Bean Serialization inside an Http Header
Posted by Zulio84 <gi...@hotmail.com>.
Ok perfect, thanks Claus!
I added a Json serialization/deserialization and it worked.
--
View this message in context: http://camel.465427.n5.nabble.com/HttpClient-Bean-Serialization-inside-an-Http-Header-tp5748628p5748639.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: HttpClient Bean Serialization inside an Http Header
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Ah no the headers is not serialized. You need to do that yourself.
On Tue, Mar 11, 2014 at 2:30 PM, Zulio84 <gi...@hotmail.com> wrote:
> Thanks Claus
>
> but... it doesn't works for me because inside the camel body I've a
> SOAPMessage that have a different Content-Type (text/xml, not
> application/x-java-serialized-object).
>
> There's an instruction that allows to serialize only the headers?
> Or I must override the toString method and implement the deserialize by
> myself?
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/HttpClient-Bean-Serialization-inside-an-Http-Header-tp5748628p5748637.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Make your Camel applications look hawt, try: http://hawt.io
Re: HttpClient Bean Serialization inside an Http Header
Posted by Zulio84 <gi...@hotmail.com>.
Thanks Claus
but... it doesn't works for me because inside the camel body I've a
SOAPMessage that have a different Content-Type (text/xml, not
application/x-java-serialized-object).
There's an instruction that allows to serialize only the headers?
Or I must override the toString method and implement the deserialize by
myself?
--
View this message in context: http://camel.465427.n5.nabble.com/HttpClient-Bean-Serialization-inside-an-Http-Header-tp5748628p5748637.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: HttpClient Bean Serialization inside an Http Header
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
There is a mime/type for serialized data, you need to set that as a
header, so it can be serialized over HTTP.
public static final String CONTENT_TYPE_JAVA_SERIALIZED_OBJECT =
"application/x-java-serialized-object";
On Tue, Mar 11, 2014 at 1:08 PM, Zulio84 <gi...@hotmail.com> wrote:
> Hi guys!
>
> I've a bean that contains some serializable value (the bean is serializable
> too).
> I want to send that bean to a server.
> I put this bean inside an Exchange header the i use HTTPComponent as
> httpclient to invoke a server.
>
> Inside the server i try to deserialize the bean from the header but that i
> read is the "java object id".
>
> E.g.
>
>
> "com.class.MyBean@b9d1cf3f"
>
>
> Any suggestion?
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/HttpClient-Bean-Serialization-inside-an-Http-Header-tp5748628.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Make your Camel applications look hawt, try: http://hawt.io