I defined a collection for 4 web services (Login, Articulos, ArticuloxCodigo, ArticuloxBarCode) in Postman, test them and work fine. When using Apimatic to try to generate YAML documentation, only the first to are included and imported to Genexus using OpenApi. So I intended to consume each one "manually". The Login method to get a token works ok. The service Articulos that lists all the products works fine too. The others respond with some encoding problem (\u003d instead of =) Running ArticuloxBarCode from Genexus I get the response: {"success":false,"message":"Articulo no encontrado para el codigo de barra : 011788/XXX-frontend/external/articulo?bc\u003d011788"} Running ArticuloxBarCode from Postman: { "totalCount": 1, "rows": [ { "id": 451628, "codigo": "11209003", "codigoBarra": "011788", ...
No special headers used, but tried to use the same in Genexus code:
&Token = XXXLoginWS()
&httpclient.Host = "apps.XXX.com.uy"
//&httpclient.Port = 8080
&httpclient.Secure = 1
&httpclient.BaseUrl = '/XXX-frontend/external/articulo?bc=' + &BarCode.Trim()
&httpclient.addHeader("Authorization", "Bearer " + &Token)
&httpclient.AddHeader('Content-type','application/json')
&httpclient.AddHeader("Content-Type", "application/x-www-form-urlencoded")
&httpclient.AddHeader("Accept", "*/*") //from Postman
&httpclient.AddHeader("Accept-Encoding", "gzip, deflate, br") //from Postman
&httpclient.AddHeader("Connection", "keep-alive") //from Postman
&ServiceURL= /*'https://' + &httpclient.Host +*/ &httpclient.BaseUrl
//&httpclient.Execute('GET','/articulo')
&httpclient.Execute('GET',&ServiceURL.Trim())
&responsejson = &httpclient.ToString()
&ArticulosERP.FromJson(&responsejson)
I tried with any combination of those headers with the same result.
HTML sent by Postman (that obtains a correct response) is:
GET /XXX-frontend/external/articulo?bc=*011788* HTTP/1.1
Host: apps.XXX.com.uy
Authorization: Bearer xxxXXXxxx.xxxXXXxxx
I appreciate any advice. Thank you!