[stackoverflow] [progress Openedge Abl] Progress 4gl Secure Socket Authentication

Status
Not open for further replies.
T

Tony Tee

Guest
Currently attempting to perform a socket connection to a host that has authentication setup using the username:password@domain syntax. The following curl request works fine when run via command line:

/opt/pware/bin/curl -s -v -S -k -X POST -d @/test/worldpay.xml https://username:password@secure-test.worldpay.com/jsp/merchant/xml/paymentService.jsp


The problem lies when attempting to post the same worldpay.xml payload file using progress secure socket. My socket connects using the following:

DEFINE VARIABLE vhSocket AS HANDLE NO-UNDO.
CREATE SOCKET vhSocket.

vhSocket:CONNECT('-H test.worldpay.com -S 443 -ssl -nohostverify') NO-ERROR.
IF vhSocket:CONNECTED() EQ FALSE THEN
DO:
Message "COULD NOT CONNECT".
vhSocket:DISCONNECT().
DELETE OBJECT vhSocket NO-ERROR.
RETURN.
END.
ELSE
Message "CONNECTED!".


I am setting up my header as follows once the socket connection is opened:

ASSIGN
vRequest = 'POST ' +
username + ":" + password + "@" + "/jsp/merchant/xml/paymentService.jsp" +
' HTTPS/1.1' + chr(13) + chr(10) +
'Connect: close' + chr(13) + chr(10) +
'Host: ' + "secure-test.worldpay.com" + chr(13) + chr(10) +
'Content-Length: ' + string(LENGTH(postdata,"raw")) + chr(13) + chr(10) +
'Content-Type: text/xml' + chr(13) + chr(10) +
chr(13) + chr(10) +
postData +
chr(13) + chr(10).


set-byte-order(vData) = BIG-ENDIAN.
set-size(vData) = LENGTH(vRequest,"raw").
put-string(vData,1,LENGTH(vRequest,"raw")) = vRequest.

vReturnCode = vhSocket:WRITE(vData, 1, LENGTH(vRequest,"raw")).


Any help on figuring out how the header should be structured or how to perform basic authentication over Secure Sockets in Progress would be greatly appreciated. Thanks guys!

Continue reading...
 
Status
Not open for further replies.
Top