LindaNice
14-Dec-2021, 06:19 AM
I am struggling with an REST-API call.
When i try to run it, i get an 12007 error...
With postman and with Visual Studio i got this working. But not in DataFlex.
And i dont know where the problem sits.
I tried to find a way to see what the full URL is that Dataflex make of my post request. But i cannt find it.
I checked the port, and thats corrent. And because it is working in postman and visual studio, the firewall is also not the problem
Procedure Construct_object
String sRemoteHost sSecure sVersion
Forward Send Construct_Object
Property UChar[] paUDataReceived
Set psRemoteHost to "auth.staging.e-motion.xyz/auth/realms/hume/protocol"
Set piRemotePort to rpHttpSSL
Set peTransferFlags to ifSecure
End_Procedure
Function HttpPostRequest String sRequest String sData Returns Integer
Integer iRetVal iErr
String sVersion sRemoteHost sSecure sProxy
Address aAddrOfsHash
Boolean bSucces
Move (AddressOf(sData)) to aAddrOfsHash
Get AddHeader "CONTENT-TYPE" "application/x-www-form-urlencoded" to bSucces
Get HttpVerbAddrRequest ("/openid-connect/token") (AddressOf(sData)) (Length(sData)) False "POST" to iRetVal
Get LastErrorCode to iErr //-> ophalen laatste Error code
Function_Return iRetVal
End_Function
When i try to run it, i get an 12007 error...
With postman and with Visual Studio i got this working. But not in DataFlex.
And i dont know where the problem sits.
I tried to find a way to see what the full URL is that Dataflex make of my post request. But i cannt find it.
I checked the port, and thats corrent. And because it is working in postman and visual studio, the firewall is also not the problem
Procedure Construct_object
String sRemoteHost sSecure sVersion
Forward Send Construct_Object
Property UChar[] paUDataReceived
Set psRemoteHost to "auth.staging.e-motion.xyz/auth/realms/hume/protocol"
Set piRemotePort to rpHttpSSL
Set peTransferFlags to ifSecure
End_Procedure
Function HttpPostRequest String sRequest String sData Returns Integer
Integer iRetVal iErr
String sVersion sRemoteHost sSecure sProxy
Address aAddrOfsHash
Boolean bSucces
Move (AddressOf(sData)) to aAddrOfsHash
Get AddHeader "CONTENT-TYPE" "application/x-www-form-urlencoded" to bSucces
Get HttpVerbAddrRequest ("/openid-connect/token") (AddressOf(sData)) (Length(sData)) False "POST" to iRetVal
Get LastErrorCode to iErr //-> ophalen laatste Error code
Function_Return iRetVal
End_Function