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 <[email protected]>
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":"[email protected]",
>     "insurer":{
>
>       "insurerEmail":"[email protected]",
>       "insurerName":"MUSTPAY not really",
>       "insurerPhone":"00000000"
>
>     },
>     "medical":{
>
>       "condition":"NO critical ILLNESS",
>       "treatment":"Panadol and Antibiotic"
>
>     },
>     "parentGuardian":{
>
>       "guardianEmail":"[email protected]",
>       "guardianName":"Hector Filex",
>       "guardianPhone":"0322247644"
>
>     },
>     "patientContact":{
>
>       "address":"Hatfield",
>       "email":"[email protected]",
>       "phone":"0112345234"
>     },
>     "physician":{
>
>           "physicianEmail":"[email protected]",
>           "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(JsonUtil.java:276)
> at org.apache.synapse.commons.json.JsonFormatter.writeTo(
> JsonFormatter.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(
> Axis2Sender.java:230)
> .
> .
> .
>
>
> [2017-12-05 10:50:48,424] ERROR - Axis2Sender Access-Control-Allow-Headers:
> authorization,Access-Control-Allow-Origin,Content-Type,
> SOAPAction,Access-Control-Allow-Methods: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/";><soapenv: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(JsonUtil.java:276)
> at org.apache.synapse.commons.json.JsonFormatter.writeTo(
> JsonFormatter.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
> [email protected]
> mobile : 0094777453010
>
> _______________________________________________
> Dev mailing list
> [email protected]
> 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
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to