title: Mule REST APIKit- My flow isn't returning a messge body
body: <p>**Issue solved, thanks to neildo. Here's what it took to get a response from a POST</p>
  
  <ol>
  <li>RAML file must have a response body definition</li>
  <li>HTTP Endpoint must be set to request-response</li>
  <li>All Flows using the synchronous Processing Strategy</li>
  <li>Accept and Content-Type HTTP headers set to application/json on the request
  **</li>
  </ol>
  
  <p>The implementation of my REST Flow calls a Java API that returns a Java object. I then convert the object to a JSON document and return it to the client. My Logger step is logging the correct data, <strong>however the client just gets a 200 OK with an empty body</strong>.</p>
  
  <p>I have set all my Flows to <strong>synchronous</strong> and my HTTP Endpoint to <strong>request-response</strong>.  What am I missing?</p>
  
  <p>Thank you!
  Nathan</p>
  
  <p>Here is my XML file</p>
  
  <pre><code>&lt;apikit:config name="IAMPerson-config" raml="IAMPerson.raml" consoleEnabled="true" consolePath="console" doc:name="Router"/&gt;
  &lt;apikit:mapping-exception-strategy name="IAMPerson-apiKitGlobalExceptionMapping"&gt;
      &lt;apikit:mapping statusCode="404"&gt;
          &lt;apikit:exception value="org.mule.module.apikit.exception.NotFoundException" /&gt;
          &lt;set-property propertyName="Content-Type" value="application/json" /&gt;
          &lt;set-payload value="{ &amp;quot;message&amp;quot;: &amp;quot;Resource not found&amp;quot; }" /&gt;
      &lt;/apikit:mapping&gt;
      ...
  &lt;/apikit:mapping-exception-strategy&gt;
  &lt;flow name="IAMPerson-main" doc:name="IAMPerson-main" processingStrategy="synchronous"&gt;
      &lt;http:inbound-endpoint address="http://localhost:8081/api" doc:name="HTTP" exchange-pattern="request-response" password="admin" user="admin" contentType="application/json"/&gt;
      &lt;apikit:router config-ref="IAMPerson-config" doc:name="APIkit Router"/&gt;
      &lt;exception-strategy ref="IAMPerson-apiKitGlobalExceptionMapping" doc:name="Reference Exception Strategy"/&gt;
  &lt;/flow&gt;    
  &lt;flow name="post:/person:IAMPerson-config" doc:name="post:/person:IAMPerson-config" processingStrategy="synchronous"&gt;                                   
      &lt;json:json-to-object-transformer doc:name="JSON to Object" returnClass="PersonDTO"/&gt;
      &lt;invoke name="invokeCreate" object-ref="personService" method="create" methodArguments="#[payload]"&gt;&lt;/invoke&gt;
      &lt;json:object-to-json-transformer sourceClass="Person" doc:name="Person Object to JSON"/&gt;
      &lt;logger level="INFO" doc:name="Logger" message="#[payload]"/&gt;
  &lt;/flow&gt;
  &lt;flow name="put:/person:IAMPerson-config" doc:name="put:/person:IAMPerson-config" processingStrategy="synchronous"&gt;           
      &lt;logger level="INFO" doc:name="Logger" message="#[payload]"/&gt;                                
      &lt;json:json-to-object-transformer doc:name="JSON to Object" returnClass="PersonDTO"/&gt;
      &lt;invoke name="invokeUpdate" object-ref="personService" method="update" methodArguments="#[payload]"/&gt;
      &lt;json:object-to-json-transformer sourceClass="Person" doc:name="Person Object to JSON"/&gt;
      &lt;logger level="INFO" doc:name="Logger" message="#[payload]"/&gt;
  &lt;/flow&gt;     
  </code></pre>
  
  <p>Here is part of my RAML file where I define a request and response body. When I posted a message to Mule, I got this error with nothing logged to the Mule console.</p>
  
  <p>null (java.lang.NullPointerException). Message payload is of type: ContentLengthInputStream</p>
  
  <pre><code> post:    
  body:
    application/json:              
  responses:
    200:
      body:
        application/json:  
  </code></pre>