title: How to map the response for the REST request by Apache camel HTTP component
body: <p>I have implemented following route with Apache camel XML mode.</p>
  
  <pre><code>&lt;restConfiguration component="servlet" bindingMode="json" contextPath="/abc-esb/rest" port="8181"&gt; 
      &lt;dataFormatProperty key="prettyPrint" value="true" /&gt;
      &lt;dataFormatProperty key="json.in.disableFeatures" value="FAIL_ON_EMPTY_BEANS,FAIL_ON_UNKNOWN_PROPERTIES" /&gt;
  &lt;/restConfiguration&gt;
  
  &lt;rest path="/service-http" consumes="application/json" produces="application/json"&gt;
      &lt;put type="com.abc.abcd.esb.models.UserServiceMapping" uri="/create"&gt;
          &lt;route&gt;
              &lt;setHeader headerName="Authorization"&gt;
                  &lt;simple&gt;Basic YWRtaW46YWRtaW4=&lt;/simple&gt;
              &lt;/setHeader&gt;
              &lt;setHeader headerName="CamelHttpMethod"&gt;
                  &lt;constant&gt;POST&lt;/constant&gt;
              &lt;/setHeader&gt;
              &lt;setBody&gt;
                  &lt;simple&gt;
                      {"SystemUserDetails":{"userName":"${body.objectDetails.userName}",
                      "password": "${body.objectDetails.password}"}}
                  &lt;/simple&gt;
              &lt;/setBody&gt;
              &lt;to uri="http://192.168.1.20:8081/abcd/services/UserServiceRest/V1.0/users/create?bridgeEndpoint=true" /&gt;
          &lt;/route&gt;
      &lt;/put&gt;
  &lt;/rest&gt;
  </code></pre>
  
  <p>Functionality happens as expected. But camel returns HTTP 500 mentioning following error.</p>
  
  <blockquote>
    <p>com.fasterxml.jackson.databind.JsonMappingException: No serializer
    found for class
    org.apache.camel.converter.stream.CachedOutputStream$WrappedInputStream
    and no properties discovered to create BeanSerializer (to avoid
    exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) )    at
    com.fasterxml.jackson.databind.ser.impl.UnknownSerializer.failForEmpty(UnknownSerializer.java:69)
      at
    com.fasterxml.jackson.databind.ser.impl.UnknownSerializer.serialize(UnknownSerializer.java:32)
      at
    com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:130)</p>
  </blockquote>
  
  <p>When I analyze a tcp dump related to this scenario, I found this HTTP 500 occurred when trying to mapping the <code>{"status" : "Success"}</code> response from the external webservice. </p>
  
  <p><strong>Content of the UserServiceMapping class</strong></p>
  
  <pre><code>    private String serviceName;
      private String serviceMethod;
      private String mappedServiceObject;
      private SystemUserDetails objectDetails;
      // private StatusDetails statusDetails;
  
      public String getMappedServiceObject() {
          return mappedServiceObject;
      }
  
      public void setMappedServiceObject(String mappedServiceObject) {
          this.mappedServiceObject = mappedServiceObject;
      }
  
      public String getServiceName() {
          return serviceName;
      }
  
      public void setServiceName(String serviceName) {
          this.serviceName = serviceName;
      }
  
      public String getServiceMethod() {
          return serviceMethod;
      }
  
      public void setServiceMethod(String serviceMethod) {
          this.serviceMethod = serviceMethod;
      }
  
      public SystemUserDetails getObjectDetails() {
          return objectDetails;
      }
  
      public void setObjectDetails(SystemUserDetails objectDetails) {
          this.objectDetails = objectDetails;
      }
  
      /*
       * public StatusDetails getStatusDetails() { return statusDetails; }
       * 
       * public void setStatusDetails(StatusDetails statusDetails) {
       * this.statusDetails = statusDetails; }
       */
  </code></pre>
  
  <p><a href="http://i.stack.imgur.com/4ghhR.jpg" rel="nofollow">Request response flow of the scenario</a></p>