File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes SOA and ESB and the fly likes how correctly produce json by RESTFUL web service on Fuse ESB? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » SOA and ESB
Bookmark "how correctly produce json by RESTFUL web service on Fuse ESB?" Watch "how correctly produce json by RESTFUL web service on Fuse ESB?" New topic

how correctly produce json by RESTFUL web service on Fuse ESB?

eman azmy

Joined: Jan 02, 2013
Posts: 1
I'm using FUSE ESB and CXf and JSON, I implement a restful web service as the following:

RestFul Method:
public User handleGeUser() {
User user = new User();
return user;
The provider in the bundle-context.xml
<bean class="org.apache.cxf.jaxrs.provider.JSONProvider">
<property name="dropRootElement" value="true" />
<property name="supportUnwrapped" value="true" />

and I got this error "No message body writer has been found for response class User." when calling the my rest service.

could any one advise?
Roger Sterling
Ranch Hand

Joined: Apr 06, 2012
Posts: 426

You may need to follow the documentation about auto-discovery of new components (note Fuse is ServiceMix, and uses Apache Camel to define mediation) :

to support auto-discovery of your component add a file to META-INF/services/org/apache/camel/component/FOO where FOO is the URI scheme for your component and any related endpoints created on the fly. The latter file should contain the definition of the component class. For example if your component is implemented by the com.example.CustomComponent class, the service file should contain the following line - class=com.example.CustomComponent .

Camel empowers you to define routing and mediation rules in a variety of domain-specific languages, including a Java-based Fluent API, Spring or Blueprint XML Configuration files, and a Scala DSL. This means you get smart completion of routing rules in your IDE, whether in a Java, Scala or XML editor.
Apache Camel uses URIs to work directly with any kind of Transport or messaging model such as HTTP, ActiveMQ, JMS, JBI, SCA, MINA or CXF, as well as pluggable Components and Data Format options. Apache Camel is a small library with minimal dependencies for easy embedding in any Java application. Apache Camel lets you work with the same API regardless which kind of Transport is used - so learn the API once and you can interact with all the Components provided out-of-box.
Apache Camel provides support for Bean Binding and seamless integration with popular frameworks such as Spring, Blueprint and Guice. Camel also has extensive support for unit testing your routes.
The following projects can leverage Apache Camel as a routing and mediation engine:
Apache ServiceMix - a popular distributed open source ESB and JBI container
Apache ActiveMQ - a mature, widely used open source message broker
Apache CXF - a smart web services suite (JAX-WS and JAX-RS)
Apache Karaf - a small OSGi based runtime in which applications can be deployed
Apache MINA - a high-performance NIO-driven networking framework
I agree. Here's the link:
subject: how correctly produce json by RESTFUL web service on Fuse ESB?
jQuery in Action, 3rd edition