I'm trying to set up a simple example with Spring remoting via HTTP, and
I'm not sure if my configuration or my assumptions are wrong, or if
there's a problem in the Camel HTTP component.
Essentially, my setup is similar to the camel-example-spring-jms with
CamelClientRemoting, only I'm using HTTP instead of JMS as transport.
On the client side, I'm creating a proxy for a HelloService service
interface using a CamelProxyFactoryBean, using the remote HTTP endpoint
as serviceUrl, e.g. http://localhost:9999/hello.
Now when starting the Camel context, I'm getting the following exception:
Caused by: org.apache.camel.NoTypeConversionAvailableException: No type
converter available to convert from type:
org.apache.camel.component.bean.BeanInvocation to the required type:
java.io.InputStream with value BeanInvocation public abstract void
com.blogspot.hwellmann.camel.greeter.api.HelloService.sayGoodbye(com.blogspot.hwellmann.camel.greeter.api.Person)
with [com.blogspot.hwellmann.camel.greeter.api.Person@1badd463]]
at
org.apache.camel.impl.converter.BaseTypeConverterRegistry.mandatoryConvertTo(BaseTypeConverterRegistry.java:143)
~[camel-core-2.6.0.jar:2.6.0]
at
org.apache.camel.impl.MessageSupport.getMandatoryBody(MessageSupport.java:100)
~[camel-core-2.6.0.jar:2.6.0]
... 31 common frames omitted
It seems the HTTP component is unable to convert the BeanInvocation
object to anything that can be written to the HTTP Request.
As a workaround, I'm now connecting my proxy to a direct endpoint with
an intermediate XStream marshaller like this:
from("direct:start")
.marshal().xstream()
.to("http://localhost:9999/hello");
and on the server side:
from("jetty:http://0.0.0.0:9999/hello").
unmarshal().xstream().
to("helloService");
Is there a way to avoid the marshaller and simply use serialized objects?
Best regards,
Harald