0

I'm using wso2 integration studio (version 7.2). I'm trying to post a JSON payload factory to an endpoint. This JSON message has a JSON array with a square bracket but wso2 keeps removing that before sending it out. The receiver API doesn't accept it in this format.

See my code below:

<api context="/test" name="testAPi" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="POST">
    <inSequence>
       
              <property name="setCharacterEncoding" value="false" scope="axis2"/>
        
        <payloadFactory media-type="json">
            <format>{"field1": 5,"field2": 2022,"field3": "22","contacts": [{"id":1014,"surname": "N"}],"applicants": [{"nameId": 111111}]}
        </format>
            <args/>
        </payloadFactory>
        <header name="Content-Type" scope="transport" value="application/json"/>
        <property name="contentType" scope="axis2" type="STRING" value="application/json"/>
        <log level="full"/>
        <header name="Accept" scope="transport" value="*/*"/>
        <property name="messageType" scope="axis2" type="STRING" value="application/json"/>
       
        <header name="Connection" scope="transport" value="keep-alive"/>
        <header name="Accept-Encoding" scope="transport" value="gzip, deflate, br"/>
        <property name="DISABLE_CHUNKING" scope="axis2" type="STRING" value="true"/>
       
        <log level="full"/>
        <call blocking="true">
            <endpoint key="tcpmon"/>
        </call>
        <log level="full"/>
    </inSequence>
    <outSequence/>
    <faultSequence/>
</resource>

I used the tcpmon to see what is sending out. and I can see wso2 just remove the [] from the message and send it out.

Do you know how can I fix this?

Mehrnoosh
  • 62
  • 1
  • 1
  • 9
  • AFAIK unless you transform between XML and JSON this shouldn't happen. I tested this in Mi 1.2 and seems to be working fine. You don't have to use TCPMON to check the message, you can enable wirelogs and check the outgoing message. Can you enable wirelogs and add the logs to the question. https://ei.docs.wso2.com/en/7.2.0/micro-integrator/develop/using-wire-logs/ – ycr Oct 07 '22 at 12:46

0 Answers0