title: JSON format in WSO2 ESB PayloadFactory mediator
body: <p>PayloadFactory mediator I’m using JSON format string. The Problem is, when I enable the following lines in /repository/conf/axis2/axis2.xml, POST request works fine, but GET request produce error message. </p>
  
  <pre><code>&lt;!--messageFormatter contentType="application/json"
  class="org.apache.axis2.json.JSONStreamFormatter"/--&gt;
  &lt;!--messageBuilder contentType="application/json"
  class="org.apache.axis2.json.JSONStreamBuilder"/--&gt;
  </code></pre>
  
  <p>Here is the ESB template for paypal List all Payment Resources:</p>
  
  <pre><code>&lt;template name="listPaymentResources" xmlns="http://ws.apache.org/ns/synapse"&gt;
    &lt;sequence class="sequence"&gt;
      &lt;payloadFactory media-type="json"&gt;
        &lt;format&gt;
          {}
        &lt;/format&gt;
      &lt;/payloadFactory&gt;
      &lt;property name="messageType" scope="axis2" value="application/json" /&gt;
      &lt;call&gt;
        &lt;endpoint&gt;
          &lt;http method="get" uri-template="{uri.var.paypalUrl}/v1/payments/payment"/&gt;
        &lt;/endpoint&gt;
      &lt;/call&gt;
    &lt;/sequence&gt;
  &lt;/template&gt;
  </code></pre>
  
  <p>Proxy service:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
      &lt;proxy xmlns="http://ws.apache.org/ns/synapse"
             name="listPaymentResources"
             transports="https,http"
             statistics="disable"
             trace="disable"
             startOnLoad="true"&gt;
         &lt;target&gt;
            &lt;inSequence&gt;
               &lt;property xmlns:ns="uri.var.payment"
                         name="ppurl"
                         expression="//ns:paypalurl/text()"/&gt;
               &lt;PayPal.config&gt;
                  &lt;appUri&gt;{$ctx:ppurl}&lt;/appUri&gt;
               &lt;/PayPal.config&gt;
               &lt;PayPal.listPaymentResources/&gt;
               &lt;respond/&gt;
            &lt;/inSequence&gt;
            &lt;outSequence&gt;
               &lt;log/&gt;
               &lt;send/&gt;
            &lt;/outSequence&gt;
         &lt;/target&gt;
         &lt;description/&gt;
      &lt;/proxy&gt;
  </code></pre>
  
  <p>The Error log:</p>
  
  <pre><code>[2013-12-11 17:25:10,971] ERROR - TargetHandler Unexpected error: Cannot get a J
  SON writer
  java.lang.UnsupportedOperationException: Cannot get a JSON writer
          at org.apache.axis2.json.JSONStreamFormatter.getJSONWriter(JSONStreamFor
  matter.java:63)
          at org.apache.axis2.json.AbstractJSONMessageFormatter.getTargetAddress(A
  bstractJSONMessageFormatter.java:228)
          at org.apache.synapse.transport.passthru.TargetRequest.start(TargetReque
  st.java:152)
          at org.apache.synapse.transport.passthru.TargetHandler.requestReady(Targ
  etHandler.java:136)
          at org.apache.http.impl.nio.DefaultNHttpClientConnection.produceOutput(D
  efaultNHttpClientConnection.java:244)
          at org.apache.synapse.transport.http.conn.LoggingNHttpClientConnection.p
  roduceOutput(LoggingNHttpClientConnection.java:112)
          at org.apache.synapse.transport.passthru.ClientIODispatch.onOutputReady(
  ClientIODispatch.java:88)
          at org.apache.synapse.transport.passthru.ClientIODispatch.onOutputReady(
  ClientIODispatch.java:41)
          at org.apache.http.impl.nio.reactor.AbstractIODispatch.outputReady(Abstr
  actIODispatch.java:148) 
  </code></pre>