Hi, i'm trying to consume API REST from VO.
For example:
https://test.senasa.gov.ar/agrotraza/src/api/Consulta_Tipo_Envase?authUser=USER&authPass=PASSWORD
returns
["Error de autenticaci\u00f3n (2) USER"]
but from VO i always get empty response.
I try:
Option 1
cRequest:= "authUser=USER&authPass=PASSWORD"
oHttpSession:= CHttp{"SENASA.APIREST"}
IF oHttpSession:ConnectRemote("
http://test.senasa.gov.ar")
IF oHttpSession:OpenRequest("GET", "/agrotraza/src/api/Consulta_Tipo_Envase", INTERNET_FLAG_RELOAD + INTERNET_FLAG_KEEP_CONNECTION)
IF oHttpSession:SendRequest(NULL_STRING, PTR(_CAST, cRequest), SLen(cRequest))
cResponse:= oHttpSession:GetResponse()
InfoBox{SELF, "1.Response", cResponse}:Show()
ELSE
WarningBox{SELF, "1.Error.1", oHttpSession:ErrorMsg}:Show()
ENDIF
oHttpSession:CloseRequest()
ELSE
WarningBox{SELF, "1.Error.2", oHttpSession:ErrorMsg}:Show()
ENDIF
oHttpSession:CloseRemote()
oHttpSession:= NULL_OBJECT
ELSE
WarningBox{SELF, "1.Error.3", oHttpSession:ErrorMsg}:Show()
ENDIF
Option 2
oHttpSession:= CHttp{"SENASA.APIREST", 443}
IF oHttpSession:ConnectRemote("
https://test.senasa.gov.ar")
IF oHttpSession:OpenRequest("GET", "/agrotraza/src/api/Consulta_Tipo_Envase", INTERNET_FLAG_RELOAD + INTERNET_FLAG_KEEP_CONNECTION + INTERNET_FLAG_SECURE)
IF oHttpSession:SendRequest(NULL_STRING, PTR(_CAST, cRequest), SLen(cRequest))
cResponse:= oHttpSession:GetResponse()
InfoBox{SELF, "2.Response", cResponse}:Show()
ELSE
WarningBox{SELF, "2.Error.1", oHttpSession:ErrorMsg}:Show()
ENDIF
oHttpSession:CloseRequest()
ELSE
WarningBox{SELF, "2.Error.2", oHttpSession:ErrorMsg}:Show()
ENDIF
oHttpSession:CloseRemote()
oHttpSession:= NULL_OBJECT
ELSE
WarningBox{SELF, "2.Error.3", oHttpSession:ErrorMsg}:Show()
ENDIF
Option 3
oHttpSession:= CHttp{"SENASA.APIREST"}
IF oHttpSession:ConnectRemote("test.senasa.gov.ar")
IF oHttpSession:OpenRequest("GET", "/agrotraza/src/api/Consulta_Tipo_Envase", INTERNET_FLAG_RELOAD + INTERNET_FLAG_KEEP_CONNECTION)
IF oHttpSession:SendRequest(NULL_STRING, PTR(_CAST, cRequest), SLen(cRequest))
cResponse:= oHttpSession:GetResponse()
InfoBox{SELF, "3.Response", cResponse}:Show()
ELSE
WarningBox{SELF, "3.Error.1", oHttpSession:ErrorMsg}:Show()
ENDIF
oHttpSession:CloseRequest()
ELSE
WarningBox{SELF, "3.Error.2", oHttpSession:ErrorMsg}:Show()
ENDIF
oHttpSession:CloseRemote()
oHttpSession:= NULL_OBJECT
ELSE
WarningBox{SELF, "3.Error.3", oHttpSession:ErrorMsg}:Show()
ENDIF
Option 4
oHttpSession:= CHttp{"SENASA.APIREST", 443}
IF oHttpSession:ConnectRemote("test.senasa.gov.ar")
IF oHttpSession:OpenRequest("GET", "/agrotraza/src/api/Consulta_Tipo_Envase", INTERNET_FLAG_RELOAD + INTERNET_FLAG_KEEP_CONNECTION + INTERNET_FLAG_SECURE)
IF oHttpSession:SendRequest(NULL_STRING, PTR(_CAST, cRequest), SLen(cRequest))
cResponse:= oHttpSession:GetResponse()
InfoBox{SELF, "4.Response", cResponse}:Show()
ELSE
WarningBox{SELF, "4.Error.1", oHttpSession:ErrorMsg}:Show()
ENDIF
oHttpSession:CloseRequest()
ELSE
WarningBox{SELF, "4.Error.2", oHttpSession:ErrorMsg}:Show()
ENDIF
oHttpSession:CloseRemote()
oHttpSession:= NULL_OBJECT
ELSE
WarningBox{SELF, "4.Error.3", oHttpSession:ErrorMsg}:Show()
ENDIF
Option 5
oHttpSession:= CHttp{"SENASA.APIREST"}
IF oHttpSession:ConnectRemote("
http://test.senasa.gov.ar")
cResponse:= oHttpSession:GetDocumentByURL("
http://test.senasa.gov.ar/agrotraza/src/api/Consulta_Tipo_Envase?authUser=USER&authPass=PASSWORD")
InfoBox{SELF, "5.Response", cResponse}:Show()
ELSE
WarningBox{SELF, "5.Error.1", oHttpSession:ErrorMsg}:Show()
ENDIF
oHttpSession:CloseRemote()
oHttpSession:= NULL_OBJECT
Option 6
oHttpSession:= CHttp{"SENASA.APIREST", 443}
IF oHttpSession:ConnectRemote("
https://test.senasa.gov.ar")
cResponse:= oHttpSession:GetDocumentByURL("
https://test.senasa.gov.ar/agrotraza/src/api/Consulta_Tipo_Envase?authUser=USER&authPass=PASSWORD")
InfoBox{SELF, "6.Response", cResponse}:Show()
ELSE
WarningBox{SELF, "6.Error.1", oHttpSession:ErrorMsg}:Show()
ENDIF
oHttpSession:CloseRemote()
oHttpSession:= NULL_OBJECT
Option 7
oHttpSession:= CHttp{"SENASA.APIREST"}
IF oHttpSession:ConnectRemote("test.senasa.gov.ar")
cResponse:= oHttpSession:GetDocumentByURL("test.senasa.gov.ar/agrotraza/src/api/Consulta_Tipo_Envase?authUser=USER&authPass=PASSWORD")
InfoBox{SELF, "7.Response", cResponse}:Show()
ELSE
WarningBox{SELF, "7.Error.1", oHttpSession:ErrorMsg}:Show()
ENDIF
oHttpSession:CloseRemote()
oHttpSession:= NULL_OBJECT
Option 8
oHttpSession:= CHttp{"SENASA.APIREST", 443}
IF oHttpSession:ConnectRemote("test.senasa.gov.ar")
cResponse:= oHttpSession:GetDocumentByURL("test.senasa.gov.ar/agrotraza/src/api/Consulta_Tipo_Envase?authUser=USER&authPass=PASSWORD")
InfoBox{SELF, "8.Response", cResponse}:Show()
ELSE
WarningBox{SELF, "8.Error.1", oHttpSession:ErrorMsg}:Show()
ENDIF
oHttpSession:CloseRemote()
oHttpSession:= NULL_OBJECT
Can any help me?
Regards.
Sebastián
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)