Hi everyone:
I am performing a web service to consume third party data and I have everything ready, the code is as follows:
and the json file obtained is the following:
Now the problem is the following if I send the json file from Postman, everything works correctly, but if I send it from my application the following error appears:
"Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $"
When checking the webservice log when it receives the query from Postman it has this information:
JSON: { "tokenOpe
but when it receives it from my application it appears in the log:
JSON: %7B%22tokenOper
someone has an idea of what may be happening
thanks in advance
I am performing a web service to consume third party data and I have everything ready, the code is as follows:
B4X:
Dim webserviceMap As Map = CreateMap("tokenOperacion":"WXP8BP8fRlcIYo22NKuovHj5e1GJ0qDMTxsmADz1y08lILYdeAq2kFutQrpx4ZQg7FYWiZQgpPtdlk4R7yWqIWerq3gDSsAKfzWB", _
"vendedor":"CV2016", _
"sucursal":"108412345", _
"pagoConcepto":CreateMap("referencia":"12000012", _
"valor":"30000","numeroTransaccion":"11288266", _
"fechaPago":"10/07/2019" , _
"horaPago":"04:32:05", _
"datosAdicionales": Array (CreateMap("nombre":"Dato1","valor":"2258899"), _
(CreateMap("nombre":"Dato2","valor":"Carrera 1 No 001")), _
CreateMap("nombre":"DatoN","valor":"4955555"))))
Dim Data As List
Data.Initialize
Data.Add(webserviceMap)
Dim JSONGenerator As JSONGenerator
JSONGenerator.Initialize2(Data)
Dim Job2 As HttpJob
Dim json As String
json = JSONGenerator.ToString.SubString(1)
json = json.SubString2(0,json.Length-1)
Job2.Initialize("consultaIdentificacion",Me)
Job2.PostString("http://192.168.0.109:9013/registrarPago", json)
Job2.GetRequest.SetHeader("Content-Type", "application/json")
Job2.GetRequest.SetHeader("Cache-Control", "no-cache")
and the json file obtained is the following:
B4X:
{
"tokenOperacion": "WXP8BP8fRlcIYo22NKuovHj5e1GJ0qDMTxsmADz1y08lILYdeAq2kFutQrpx4ZQg7FYWiZQgpPtdlk4R7yWqIWerq3gDSsAKfzWB",
"vendedor": "CV2016",
"pagoConcepto": {
"numeroTransaccion": "11288266",
"valor": "30000",
"horaPago": "04:32:05",
"datosAdicionales": [
{
"valor": "2258899",
"nombre": "Dato1"
},
{
"valor": "Carrera 1 No 001",
"nombre": "Dato2"
},
{
"valor": "4955555",
"nombre": "DatoN"
}
],
"referencia": "12000012",
"fechaPago": "10\/07\/2019"
},
"sucursal": "108412345"
}
Now the problem is the following if I send the json file from Postman, everything works correctly, but if I send it from my application the following error appears:
"Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $"
When checking the webservice log when it receives the query from Postman it has this information:
JSON: { "tokenOpe
but when it receives it from my application it appears in the log:
JSON: %7B%22tokenOper
someone has an idea of what may be happening
thanks in advance