Calling WS-Security WebService from ABL

Posted by thomass@proventus.no on 09-Apr-2010 01:17

I need to call an external webservice which is protected by WS-Security from my Progress ABL-application.

From earlier versions of OpenEdge and from some recent posts here in this forum (http://communities.progress.com/pcom/message/79504#79504) I've heard that this is a no-go.

I rememeber from a seminar a few years ago (I think from the 10.1 launch) that this was on the feature roadmap for OpenEdge, anyone know the status of this?

Any ideas for work-arounds to get this working (OE 10 - Unix)?

Thanks!

All Replies

Posted by rstanciu on 09-Apr-2010 05:58

WS-Security is a no-go option.

WS-*  is not scheduled 10.1x and 10.2x neither.


You can try to use the old fashion 4GL sockets (here an  example).

Use soapUI (eviware.com) tool to see  what you have to do.


/*********************************************************/
/* httppost.p (how to call a webService using sockets)   */
/*********************************************************/
DEFINE VARIABLE vcHost   AS CHARACTER INITIAL "localhost" NO-UNDO.
DEFINE VARIABLE vcPort   AS CHARACTER INITIAL "25011" NO-UNDO.
DEFINE VARIABLE vhSocket AS HANDLE NO-UNDO.

CREATE SOCKET vhSocket.
vhSocket:CONNECT('-H ' + vcHost + ' -S ' + vcPort) NO-ERROR.

IF vhSocket:CONNECTED() = FALSE THEN DO:
   MESSAGE "Connection failure" SKIP
           ERROR-STATUS:GET-MESSAGE(1) VIEW-AS ALERT-BOX.
   RETURN.
END.

vhSocket:SET-READ-RESPONSE-PROCEDURE('getResponse').
RUN PostRequest.
WAIT-FOR READ-RESPONSE OF vhSocket.
vhSocket:DISCONNECT() NO-ERROR.
DELETE OBJECT vhSocket.
QUIT.
/*********************************************************/
PROCEDURE getResponse:

   DEFINE VARIABLE vcWebResp AS CHARACTER NO-UNDO.
   DEFINE VARIABLE lSucess AS LOGICAL NO-UNDO.
   DEFINE VARIABLE mResponse AS MEMPTR NO-UNDO.

   IF vhSocket:CONNECTED() = FALSE THEN do:
   MESSAGE 'Not Connected' VIEW-AS ALERT-BOX.
   RETURN.
   END.
   lSucess = TRUE.

   DO WHILE vhSocket:GET-BYTES-AVAILABLE() > 0:

   SET-SIZE(mResponse) = vhSocket:GET-BYTES-AVAILABLE() + 1.
   SET-BYTE-ORDER(mResponse) = BIG-ENDIAN.
   vhSocket:READ(mResponse,1,1,vhSocket:GET-BYTES-AVAILABLE()).
   vcWebResp = vcWebResp + GET-STRING(mResponse,1).
   END.
   SET-SIZE(mResponse) = 0.
   /*
   *PUT HERE THE CODE TO MANIPULATE THE ANSWER
   */

   MESSAGE  vcWebResp VIEW-AS ALERT-BOX.

END.
/*********************************************************/
PROCEDURE PostRequest:

DEFINE VARIABLE vcRequest      AS CHARACTER NO-UNDO.
DEFINE VARIABLE mRequest       AS MEMPTR NO-UNDO.

vcRequest =
'POST /wsa/wsa1 HTTP/1.0' + '~r~n' +
'Accept: */*' + '~r~n' +
'TE: trailers' + '~r~n' +
'Host: ' + vcHost + ':' + vcPort + '~r~n' +
'Cache-Control: no-cache' + '~r~n' +
'Connection: TE' + '~r~n' +
'Pragma: no-cache' + '~r~n' +
'SOAPAction: "urn:prgs:DocLiteral"' + '~r~n' +
'User-Agent: Progress 4GL Client' + '~r~n' +
'Content-Length: 379' + '~r~n' +
'Content-Type: text/xml; charset=UTF-8' + '~r~n' +
'' + '~r~n' +
'7'  + '~r~n'.


SET-SIZE(mRequest) = 0.
SET-SIZE(mRequest) = LENGTH(vcRequest) + 1.
SET-BYTE-ORDER(mRequest) = BIG-ENDIAN.
PUT-STRING(mRequest,1) = vcRequest .

vhSocket:WRITE(mRequest, 1, LENGTH(vcRequest)).
END PROCEDURE.

/*********************************************************/

This thread is closed