Consultor Eletrônico



Kbase P131273: 4GL/ABL: How to invoke internal procedures of an Application Object that is deployed as a WebService
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   18/09/2009
Status: Verified

GOAL:

4GL/ABL: How to invoke internal procedures of an Application Object that is deployed as a WebService?

GOAL:

Web Services: Sample 4GL code to demonstrate basic SOAP request and response header handling.

GOAL:

Sample ABL code to invoke internal procedures of an application object using WebServices.

GOAL:

How to associate the WebServices client request and response callback procedure with the port type?

FACT(s) (Environment):

All Supported Operating Systems
OpenEdge 10.1x

FIX:

The following procedure demonstrates how to:
1. Invoke internal procedures of an Application Object that is deployed as a WebService.
2. Associate the WebServices client request and response callback procedure with the port type.
3. Invoke internal procedures of an application object using WebServices.
DEFINE VARIABLE hApplicationObjectWebService AS HANDLE NO-UNDO.
DEFINE VARIABLE hProcedureObjectWebService AS HANDLE NO-UNDO.
DEFINE VARIABLE hObjyshanshi AS HANDLE NO-UNDO.
DEFINE VARIABLE hyshanshi AS HANDLE NO-UNDO.
DEFINE VARIABLE hInternalProcedureHeader AS HANDLE NO-UNDO.
/* Create Web Service for the AppObject */
CREATE SERVER hApplicationObjectWebService.
hApplicationObjectWebService:CONNECT("-WSDL 'http://localhost:8080/wsa/wsa1/wsdl?targetURI=urn:tempuri-org' -Port Objyshanshi").
RUN Objyshanshi SET hObjyshanshi ON hApplicationObjectWebService.
/* Associate the request & response callbacks with the port type */
hObjyshanshi:SET-CALLBACK-PROCEDURE("REQUEST-HEADER", "ResponseHandlerProcedureProcedure").
hObjyshanshi:SET-CALLBACK-PROCEDURE("RESPONSE-HEADER", "ResponseHandlerProcedure").
RUN CreatePO_yshanshi IN hObjyshanshi.
/* Create Web Service for the Procedure Object */
CREATE SERVER hProcedureObjectWebService.
hProcedureObjectWebService:CONNECT("-WSDL 'http://localhost:8080/wsa/wsa1/wsdl?targetURI=urn:tempuri-org' -Port yshanshi ").
RUN yshanshi SET hyshanshi ON hProcedureObjectWebService.
/* Associate the request & response callbacks with the port type */
hyshanshi:SET-CALLBACK-PROCEDURE("REQUEST-HEADER", "ResponseHandlerProcedureProcedure").
hyshanshi:SET-CALLBACK-PROCEDURE("RESPONSE-HEADER", "ResponseHandlerProcedure").
/* Invoke the getFullName internal procedure */
DEFINE VARIABLE ipcFirstName AS CHARACTER NO-UNDO.
DEFINE VARIABLE ipcLastName AS CHARACTER NO-UNDO.
DEFINE VARIABLE opcFullName AS CHARACTER NO-UNDO.
RUN getFullName IN hyshanshi(INPUT 'Youssif', INPUT 'Shanshiry', OUTPUT opcFullName).
/* Invoke the getSum internal procedure */
DEFINE VARIABLE ipcFirstOperand AS INTEGER NO-UNDO.
DEFINE VARIABLE ipcSecondOperand AS INTEGER NO-UNDO.
DEFINE VARIABLE opiSumResult AS INTEGER NO-UNDO.
RUN getSum IN hyshanshi(INPUT 100, INPUT 300, OUTPUT opiSumResult).
/* Clean up and free resources */
RUN Release_yshanshi IN hyshanshi.
hApplicationObjectWebService:DISCONNECT().
hProcedureObjectWebService:DISCONNECT().
DELETE OBJECT hApplicationObjectWebService.
DELETE OBJECT hProcedureObjectWebService.
/* Process results returned by the WebServices calls */
MESSAGE
"Full Name:" "~t" opcFullName "~n"
"Sum Total:" "~t" opiSumResult "~n"
VIEW-AS ALERT-BOX INFO BUTTONS OK.
/**************** Internal Procedures ****************/
PROCEDURE ResponseHandlerProcedureProcedure:
DEFINE OUTPUT PARAMETER hSOAPHeader AS HANDLE.
DEFINE INPUT PARAMETER cOperationNS AS CHARACTER.
DEFINE INPUT PARAMETER cOperationLocalName AS CHARACTER.
DEFINE OUTPUT PARAMETER lDeleteOnDone AS LOGICAL.

.CASE cOperationLocalName :
WHEN "getFullName" THEN hSOAPHeader = hInternalProcedureHeader.
WHEN "getSum" THEN hSOAPHeader = hInternalProcedureHeader.
WHEN "Release_yshanshi" THEN
DO:
hSOAPHeader = hInternalProcedureHeader.
lDeleteOnDone = YES.
END.
END CASE.
END PROCEDURE.
PROCEDURE ResponseHandlerProcedure:
DEFINE INPUT PARAMETER hSOAPHeader AS HANDLE.
DEFINE INPUT PARAMETER cOperationNS AS CHARACTER.
DEFINE INPUT PARAMETER cOperationLocalName AS CHARACTER.
CASE cOperationLocalName :
WHEN "CreatePO_yshanshi" THEN hInternalProcedureHeader = hSOAPHeader.
OTHERWISE
DELETE OBJECT hSOAPHeader. /* Delete all unused soap headers */
END CASE.
END PROCEDURE..