Search code examples
wso2wso2-enterprise-integratorwso2-micro-integrator

"invalid JSON content" error from Backend in WSO2 Integration Studio 8.2.0


I tried to create an API using WSO2 Integration studio ,but i got "invalid JSON content" from the Backend .

the API working fine using Postman:

curl --location --request POST 'http://***********/send_ack.php' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic dX' \
--header 'Cookie: PHPSESSID=gm' \
--data-raw '{"login":"Test",
"pass":"Test",
"compte":"topnet",
"op":"1",
"dest_num":"3",
"msg":"test ",
"type":"0",
"auto_detect":"0",
"dt":"24/07/2023",
"hr":"10",
"mn":"58",
"label":"Test",
"ref":"Test"}'

this is my configuration in wso2 Integration Studio :

<?xml version="1.0" encoding="UTF-8"?>
<api context="/smssing" name="Smssing" xmlns="http://ws.apache.org/ns/synapse">
    <resource methods="POST" uri-template="/send">
        <inSequence>
            <property name="messageType" scope="axis2" type="STRING" value="application/json"/>
            <call>
                <endpoint>
                    <http method="post" uri-template="http:*********/send_ack.php">
                        <suspendOnFailure>
                            <initialDuration>-1</initialDuration>
                            <progressionFactor>-1</progressionFactor>
                            <maximumDuration>0</maximumDuration>
                        </suspendOnFailure>
                        <markForSuspension>
                            <retriesBeforeSuspension>0</retriesBeforeSuspension>
                        </markForSuspension>
                        <authentication>
                            <basicAuth>
                                <username>*******</username>
                                <password>******</password>
                            </basicAuth>
                        </authentication>
                    </http>
                </endpoint>
            </call>
            <respond/>
        </inSequence>
        <outSequence/>
        <faultSequence/>
    </resource>
</api>

This is the wire logs i got :

[2023-07-27 09:03:22,890] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 << "POST /send/webapi/v3/send_ack.php HTTP/1.1[\r][\n]"
[2023-07-27 09:03:22,891] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 << "Authorization: Basic dXNl******[\r][\n]"
[2023-07-27 09:03:22,891] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 << "Cookie: PHPSESSID=d0akoulh******[\r][\n]"
[2023-07-27 09:03:22,891] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 << "activityid: 4bc3f024-8196-4ce3-a245-be6f343e22d3[\r][\n]"
[2023-07-27 09:03:22,891] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 << "Accept: */*[\r][\n]"
[2023-07-27 09:03:22,892] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 << "Accept-Encoding: gzip, deflate, br[\r][\n]"
[2023-07-27 09:03:22,892] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 << "Content-Type: application/json[\r][\n]"
[2023-07-27 09:03:22,892] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 << "Transfer-Encoding: chunked[\r][\n]"
[2023-07-27 09:03:22,892] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 << "Host: 192.168.77.52[\r][\n]"
[2023-07-27 09:03:22,893] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 << "Connection: Keep-Alive[\r][\n]"
[2023-07-27 09:03:22,893] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 << "User-Agent: Synapse-PT-HttpComponents-NIO[\r][\n]"
[2023-07-27 09:03:22,893] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 << "[\r][\n]"
[2023-07-27 09:03:22,893] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 << "f0[\r][\n]"
[2023-07-27 09:03:22,894] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 << "{"login":"*********",[\n]"
[2023-07-27 09:03:22,894] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 << ""pass":"*******",[\n]"
[2023-07-27 09:03:22,894] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 << ""compte":"******",[\n]"
[2023-07-27 09:03:22,895] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 << ""op":"1",[\n]"
[2023-07-27 09:03:22,895] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 << ""dest_num":"******",[\n]"
[2023-07-27 09:03:22,897] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 << ""msg":"******",[\n]"
[2023-07-27 09:03:22,897] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 << ""type":"0",[\n]"
[2023-07-27 09:03:22,897] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 << ""auto_detect":"0",[\n]"
[2023-07-27 09:03:22,897] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 << ""dt":"24/07/2023",[\n]"
[2023-07-27 09:03:22,897] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 << ""hr":"10",[\n]"
[2023-07-27 09:03:22,897] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 << ""mn":"58",[\n]"
[2023-07-27 09:03:22,897] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 << ""label":"******",[\n]"
[2023-07-27 09:03:22,897] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 << ""ref":"******"}[\r][\n]"
[2023-07-27 09:03:22,898] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 << "0[\r][\n]"
[2023-07-27 09:03:22,898] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 << "[\r][\n]"
[2023-07-27 09:03:22,900] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 >> "HTTP/1.1 200 OK[\r][\n]"
[2023-07-27 09:03:22,900] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 >> "Date: Thu, 27 Jul 2023 08:02:34 GMT[\r][\n]"
[2023-07-27 09:03:22,900] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 >> "Server: Apache/2.4.37 (centos) OpenSSL/1.1.1g[\r][\n]"
[2023-07-27 09:03:22,900] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 >> "X-Powered-By: PHP/7.4.16[\r][\n]"
[2023-07-27 09:03:22,900] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 >> "Expires: Thu, 19 Nov 1981 08:52:00 GMT[\r][\n]"
[2023-07-27 09:03:22,900] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 >> "Cache-Control: no-store, no-cache, must-revalidate[\r][\n]"
[2023-07-27 09:03:22,900] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 >> "Pragma: no-cache[\r][\n]"
[2023-07-27 09:03:22,901] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 >> "Keep-Alive: timeout=5, max=100[\r][\n]"
[2023-07-27 09:03:22,901] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 >> "Connection: Keep-Alive[\r][\n]"
[2023-07-27 09:03:22,901] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 >> "Transfer-Encoding: chunked[\r][\n]"
[2023-07-27 09:03:22,902] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 >> "Content-Type: application/json[\r][\n]"
[2023-07-27 09:03:22,902] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 >> "[\r][\n]"
[2023-07-27 09:03:22,902] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 >> "3e[\r][\n]"
[2023-07-27 09:03:22,902] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 >> "{"op":null,"status":-200,"status_desc":"invalid JSON content"}[\r][\n]"
[2023-07-27 09:03:22,902] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 >> "0[\r][\n]"
[2023-07-27 09:03:22,902] DEBUG {wire} - HTTP-Sender I/O dispatcher-1 >> "[\r][\n]"
[2023-07-27 09:03:22,953] DEBUG {wire} - HTTP-Listener I/O dispatcher-1 << "HTTP/1.1 200 OK[\r][\n]"
[2023-07-27 09:03:22,953] DEBUG {wire} - HTTP-Listener I/O dispatcher-1 << "Cache-Control: no-store, no-cache, must-revalidate[\r][\n]"
[2023-07-27 09:03:22,953] DEBUG {wire} - HTTP-Listener I/O dispatcher-1 << "Server: Apache/2.4.37 (centos) OpenSSL/1.1.1g[\r][\n]"
[2023-07-27 09:03:22,953] DEBUG {wire} - HTTP-Listener I/O dispatcher-1 << "Access-Control-Allow-Origin: *[\r][\n]"
[2023-07-27 09:03:22,954] DEBUG {wire} - HTTP-Listener I/O dispatcher-1 << "Access-Control-Allow-Methods: POST[\r][\n]"
[2023-07-27 09:03:22,954] DEBUG {wire} - HTTP-Listener I/O dispatcher-1 << "Expires: Thu, 19 Nov 1981 08:52:00 GMT[\r][\n]"
[2023-07-27 09:03:22,954] DEBUG {wire} - HTTP-Listener I/O dispatcher-1 << "Pragma: no-cache[\r][\n]"
[2023-07-27 09:03:22,954] DEBUG {wire} - HTTP-Listener I/O dispatcher-1 << "Access-Control-Allow-Headers: content-type[\r][\n]"
[2023-07-27 09:03:22,954] DEBUG {wire} - HTTP-Listener I/O dispatcher-1 << "Content-Type: application/json[\r][\n]"
[2023-07-27 09:03:22,954] DEBUG {wire} - HTTP-Listener I/O dispatcher-1 << "X-Powered-By: PHP/7.4.16[\r][\n]"
[2023-07-27 09:03:22,954] DEBUG {wire} - HTTP-Listener I/O dispatcher-1 << "Date: Thu, 27 Jul 2023 08:03:22 GMT[\r][\n]"
[2023-07-27 09:03:22,954] DEBUG {wire} - HTTP-Listener I/O dispatcher-1 << "Transfer-Encoding: chunked[\r][\n]"
[2023-07-27 09:03:22,954] DEBUG {wire} - HTTP-Listener I/O dispatcher-1 << "Connection: keep-alive[\r][\n]"
[2023-07-27 09:03:22,954] DEBUG {wire} - HTTP-Listener I/O dispatcher-1 << "[\r][\n]"
[2023-07-27 09:03:22,954] DEBUG {wire} - HTTP-Listener I/O dispatcher-1 << "3e[\r][\n]"
[2023-07-27 09:03:22,954] DEBUG {wire} - HTTP-Listener I/O dispatcher-1 << "{"op":null,"status":-200,"status_desc":"invalid JSON content"}[\r][\n]"
[2023-07-27 09:03:22,961] DEBUG {wire} - HTTP-Listener I/O dispatcher-1 << "0[\r][\n]"
[2023-07-27 09:03:22,961] DEBUG {wire} - HTTP-Listener I/O dispatcher-1 << "[\r][\n]"

the response from backend show as that the integration studio don't send a JSON Content to the Backend .


Solution

  • Try adding the following property before the call mediator.

    <property name="DISABLE_CHUNKING" value="true" scope="axis2" />