cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
391
Views
0
Helpful
0
Replies

CVP 11.5 Create Rest Request JSON format

fabio.zanotti
Beginner
Beginner

Hello to all

 

i'm tring to create a JSON request with Rest_Client Element. This is my body :

{
"cdOperazione": "7",
"idTrace": {Data.Session.IdTrace},
"cdStatus": "NOK",
"cdErrorCode": {Data.Session.codiceErrore},
"cdErrorDesc": {Data.Session.descrizioneErrore},
"cdDatiLettura":
{
"cdLettura": {Data.Session.cust_in_lettura},
"cdUtenzaFilter": {Data.Session.esitoFilter}
},
"cdFlag": "AU10",
"traceStory":
{
"dsResponse": {Data.Session.codiceErrore}.concat("-").concat({Data.Session.descrizioneErrore}).concat("-").concat({Data.Session.esitoFilter}).concat("-").concat({Data.Session.matricolaContatore})
}

}

 

systematically i receive one error:

 

XXX.XXX.XXX.XXX.1581071814093.44677728.aegas_ind_tr,02/07/2020 11:36:54.233,tr_InitTrace,custom,***** ResponseBody = ,<html><head><title>Apache Tomcat/7.0.73 - Error report</title><style><!--H1 {font-family:TahomaArialsans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:TahomaArialsans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:TahomaArialsans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:TahomaArialsans-serif;color:black;background-color:white;} B {font-family:TahomaArialsans-serif;color:white;background-color:#525D76;} P {font-family:TahomaArialsans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - Expected a '' or '}' at 128 [character 129 line 1]</h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u>Expected a '' or '}' at 128 [character 129 line 1]</u></p><p><b>description</b> <u>The server encountered an internal error that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>org.json.JSONException: Expected a '' or '}' at 128 [character 129 line 1]
org.json.JSONTokener.syntaxError(JSONTokener.java:451)
org.json.JSONObject.&lt;init&gt;(JSONObject.java:230)
org.json.JSONObject.&lt;init&gt;(JSONObject.java:319)
TraceLetture.Trace.processRequest(Trace.java:103)
TraceLetture.Trace.doPost(Trace.java:456)
javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
</pre></p><p><b>note</b> <u>The full stack trace of the root cause is available in the Apache Tomcat/7.0.73 logs.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.73</h3></body></html>

 

this is my question.

In a JSON request can i use string function like "+", concat(), etc inside a JSON ??

this work fine:

{
"cdOperazione": "6",
"idTrace": {Data.Session.IdTrace},
"cdFlag": "AU20",
"traceStory":
{
"cdValore": {Data.Session.lett_AP}
}
}

This doens't work

{
"cdOperazione": "6",
"idTrace": {Data.Session.IdTrace},
"cdFlag": "AU20",
"traceStory":
{
"cdValore": {Data.Session.lett_AP},

"dsResponse": {Data.Session.codiceErrore}.concat("-").concat({Data.Session.descrizioneErrore})
}

}

can someone help me ???

thank you

Fabio

 

0 Replies 0
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Recognize Your Peers