Hi
Pubudu/Thvya and Vinod thanks for the replies.

I indeed have enabled the response cache, pon disabling response which the
error could be prevented.

many thanks

On Tue, Dec 5, 2017 at 12:54 PM, Dushantha Batuwita <dushan...@wso2.com>
wrote:

> Hi
> Pubudu/Thvya and Vinod thanks for the replies.
>
> I indeed have enabled the response cache, pon disabling response which the
> error could be prevented.
>
> many thanks
>
> On Tue, Dec 5, 2017 at 11:58 AM, Thivya Mahenthirarasa <thi...@wso2.com>
> wrote:
>
>> Hi Dushantha,
>>
>> Did you enable the response cache in your publisher node?
>> Since POST and PUT will not support for response cache you are observing
>> that.
>>
>>
>> Thanks,
>> Thivya
>>
>> On Tue, Dec 5, 2017 at 11:50 AM, Vinod Kavinda <vi...@wso2.com> wrote:
>>
>>> Hi Dushantha,
>>> Is this error logs from APIM or ESB node? Shall we enable wire logs and
>>> see what is actually passed to the backend? Look like an invalid JSON is
>>> passed to the backend ESB.
>>>
>>> Regards,
>>> Vinod
>>>
>>> On Tue, Dec 5, 2017 at 11:28 AM, Dushantha Batuwita <dushan...@wso2.com>
>>> wrote:
>>>
>>>> Hi Dev
>>>>
>>>>  As a part of my work, I have to connect to a SOAP backend via an ESB
>>>> secure proxy that accepts the REST request sent via an API-M.
>>>>
>>>> My Cluster set up is having bellow particulars
>>>>
>>>>
>>>>    - Cluster is developed in the local machine
>>>>    - consists of two Gateway Nodes
>>>>    - One is a* Gateway worker offset by 3*
>>>>    - Other is a *Gateway worker and Manager* *offset by 2*
>>>>    - Those nodes are fronted by LB
>>>>
>>>>
>>>>    -
>>>>
>>>> Now the cluster is up and running.
>>>>
>>>> There are 4 services defined in API-M ( refer to the attached image)
>>>> respectively GET, POST, PUT and DELETE to perform CRUD operations on SOAP
>>>> back-end.
>>>>
>>>>
>>>>
>>>> *Question*
>>>>
>>>> GET/DELETE operations are functioning absolutely as expected and
>>>> generate the required output.
>>>>
>>>> But the POST/PUT which requires JSON payload to be defined at API_M
>>>> throws errors from the terminal but it indeed adds the record(s) to the
>>>> SOAP back end and Updates the record as intended.
>>>>
>>>> *Sample payload supplied to POST and PUT*
>>>> {
>>>>     "patient":{
>>>>
>>>>     "patientFullName":"Ramboda Arachchige",
>>>>       "patientId":"n...@yahoo.com",
>>>>     "insurer":{
>>>>
>>>>       "insurerEmail":"q...@yahoo.com",
>>>>       "insurerName":"MUSTPAY not really",
>>>>       "insurerPhone":"00000000"
>>>>
>>>>     },
>>>>     "medical":{
>>>>
>>>>       "condition":"NO critical ILLNESS",
>>>>       "treatment":"Panadol and Antibiotic"
>>>>
>>>>     },
>>>>     "parentGuardian":{
>>>>
>>>>       "guardianEmail":"hector.batuw...@yahoo.com",
>>>>       "guardianName":"Hector Filex",
>>>>       "guardianPhone":"0322247644"
>>>>
>>>>     },
>>>>     "patientContact":{
>>>>
>>>>       "address":"Hatfield",
>>>>       "email":"stalb...@gamil.com",
>>>>       "phone":"0112345234"
>>>>     },
>>>>     "physician":{
>>>>
>>>>           "physicianEmail":"ab.si...@ebok.com",
>>>>           "physicianName":"CDE Silva",
>>>>           "physicianPhone":"0112678908"
>>>>     }
>>>>   }
>>>> }
>>>>
>>>>
>>>>
>>>>
>>>> *the error:*
>>>>
>>>> ERROR - JsonUtil #writeAsJson. Payload could not be written as JSON.
>>>> MessageID: urn:uuid:b11551de-088c-4e7e-8eab-7c4066e97866
>>>> [2017-12-05 10:50:48,413] ERROR - PassThroughHttpSSLSender Failed to
>>>> submit the response
>>>> org.apache.axis2.AxisFault: Payload could not be written as JSON.
>>>> at org.apache.synapse.commons.json.JsonUtil.writeAsJson(JsonUti
>>>> l.java:276)
>>>> at org.apache.synapse.commons.json.JsonFormatter.writeTo(JsonFo
>>>> rmatter.java:62)
>>>> at org.apache.synapse.transport.passthru.PassThroughHttpSender.
>>>> submitResponse(PassThroughHttpSender.java:573)
>>>> at org.apache.synapse.transport.passthru.PassThroughHttpSender.
>>>> invoke(PassThroughHttpSender.java:264)
>>>> at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
>>>> at org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Send
>>>> er.java:230)
>>>> .
>>>> .
>>>> .
>>>>
>>>>
>>>> [2017-12-05 10:50:48,424] ERROR - Axis2Sender
>>>> Access-Control-Allow-Headers:authorization,Access-Control-Al
>>>> low-Origin,Content-Type,SOAPAction,Access-Control-Allow-Meth
>>>> ods:POST,Access-Control-Allow-Origin:*,Content-Type:application/json;
>>>> charset=UTF-8,<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope
>>>> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";><s
>>>> oapenv:Body/></soapenv:Envelope> Unexpected error sending message back
>>>> org.apache.axis2.AxisFault: Failed to submit the response
>>>> at org.apache.synapse.transport.passthru.PassThroughHttpSender.
>>>> handleException(PassThroughHttpSender.java:632)
>>>> at org.apache.synapse.transport.passthru.PassThroughHttpSender.
>>>> invoke(PassThroughHttpSender.java:266)
>>>> at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
>>>> .
>>>> .
>>>> .
>>>> Caused by: org.apache.axis2.AxisFault: Payload could not be written as
>>>> JSON.
>>>> at org.apache.synapse.commons.json.JsonUtil.writeAsJson(JsonUti
>>>> l.java:276)
>>>> at org.apache.synapse.commons.json.JsonFormatter.writeTo(JsonFo
>>>> rmatter.java:62
>>>>
>>>>
>>>> If you have come across such an incident or have a solution please
>>>> kindly share the wisdom
>>>>
>>>> Many thanks
>>>>
>>>> --
>>>> *Dushantha Nayanajith Chandima Batuwita*
>>>> Software Engineer Support | WSO2
>>>> dushan...@wso2.com
>>>> mobile : 0094777453010
>>>>
>>>> _______________________________________________
>>>> Dev mailing list
>>>> Dev@wso2.org
>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>
>>>>
>>>
>>>
>>> --
>>> Vinod Kavinda
>>> Senior Software Engineer
>>> *WSO2 Inc. - lean . enterprise . middleware <http://www.wso2.com>.*
>>> Mobile : +94 (0) 712 415544
>>> Blog : http://soatechflicks.blogspot.com/
>>> [image: http://wso2.com/signature]
>>> <http://wso2.com/signature>
>>>
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> Dev@wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>>
>> *Thivya Mahenthirarasa*
>>
>> *Software Engineer -Support Team | WSO2*
>>
>>
>> *Email: thi...@wso2.com <thi...@wso2.com>*
>>
>> *Mobile: +94766461966 <+94%2076%20646%201966> <http://wso2.com/signature>*
>> *Web: http://wso2.com <http://wso2.com>*
>>
>
>
>
> --
> *Dushantha Nayanajith Chandima Batuwita*
> Software Engineer Support | WSO2
> dushan...@wso2.com
> mobile : 0094777453010
>



-- 
*Dushantha Nayanajith Chandima Batuwita*
Software Engineer Support | WSO2
dushan...@wso2.com
mobile : 0094777453010
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to