PDA

View Full Version : Error 12007 with httpTransfer POST



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

wila
14-Dec-2021, 06:51 AM
I would run it through Fiddler to see what the difference is with postman.

--
Wil

wila
14-Dec-2021, 07:31 AM
..wait..


Set psRemoteHost to "auth.staging.e-motion.xyz/auth/realms/hume/protocol"


That doesn't fly.. the host can only contain host info, not a full URL.



Set psRemoteHost to "auth.staging.e-motion.xyz"

should be OK

and then the rest of the URL you pass into the HttpVerbAddrRequest as the first parameter.

--
Wil