Hi to all.
I have not a good experience in consuming web services.
I have a quite good basis in 4GL.
I use Progress 10.2.b version in Unix Environment.
Reading some articles in www.progress.com and in this useful site, i was able to create a custom demo.p that consume a web service.
In this program , I invoke a web service that everyone can find and use for test on web. http://www.webservicex.net/stockquote.asmx?WSDL
Now i need to 'consume' a web service written in PHP Language of an external software house.
Is this below the only manner to invoke a web service in Progress ???
In WSDL file there are parts of it that refers to :
Stock Quote Soap (I used it as port type name in demo.p listed below)
Stock Quote Http Get (when and how to use that port ???)
Stock Quote Http Post (when and how to use that port ???)
If I used Http Get and Post port , how do i need to modify my demo.p program ???
Surely i am doing little bit confusion...please forgive me !!!
I post my demo.p ..program
DEF VAR Parametro1 AS CHAR INIT 'GE'.
DEF VAR Parametro2 ASCHAR FORMAT 'X(500)' INIT''.
DEF VAR LccResult AS LONGCHAR.
DEFINE VARIABLE hWebService AS HANDLE.
DEFINE VARIABLE hPortType AS HANDLE.
DEF TEMP-TABLE Stock
FIELD Symbol AS CHAR
FIELD Name AS CHAR
INDEX i1 Symbol.
CREATE SERVER hWebService.
/*-----------------------*/
/* WSDL Schema Location */
/*-----------------------*/
hWebService:CONNECT("-WSDL 'http://www.webservicex.net/stockquote.asmx?WSDL ' ") NO-ERROR.
IF NOT hWebService:CONNECTED() THEN
DO:
DEFINE VARIABLE errmsg AS CHARACTER NO-UNDO INIT "SERVER NOT CONNECTED~n".
DEFINE VARIABLE i AS INTEGER NO-UNDO.
DO i = 1 TO ERROR-STATUS:NUM-MESSAGES:
errmsg = errmsg + ERROR-STATUS:GET-MESSAGE(i) + '~n'.
END.
MESSAGE errmsg VIEW-AS ALERT-BOX ERROR.
STOP.
END.
/*-----------------------------------------------------------------------------------*/
/*Es. RUN <portTypeName> SET hPortType ON SERVER hWebService.*/
/*------------------------------------------------------------------------------------*/
RUN StockQuoteSoap SET hPortType ONSERVER hWebService.
/*------------------------------*/
/* Invocazione del Metodo */
/*------------------------------*/
RUN GetQuote IN hPortType (INPUT Parametro1, OUTPUT Parametro2) NO-ERROR.
IF ERROR-STATUS:ERROR THEN
MESSAGE'Error: ' + ERROR-STATUS:GET-MESSAGE(1) VIEW-AS ALERT-BOX.
ELSE
MESSAGE'Result: ' + TRIM(parametro2)/***return-value***/VIEW-AS ALERT-BOX.
ASSIGN LccResult = Parametro2.
.......other instructions to read result with READ-XML method and import data in a tt-table...
I have not a good experience in consuming web services.
I have a quite good basis in 4GL.
I use Progress 10.2.b version in Unix Environment.
Reading some articles in www.progress.com and in this useful site, i was able to create a custom demo.p that consume a web service.
In this program , I invoke a web service that everyone can find and use for test on web. http://www.webservicex.net/stockquote.asmx?WSDL
Now i need to 'consume' a web service written in PHP Language of an external software house.
Is this below the only manner to invoke a web service in Progress ???
In WSDL file there are parts of it that refers to :
Stock Quote Soap (I used it as port type name in demo.p listed below)
Stock Quote Http Get (when and how to use that port ???)
Stock Quote Http Post (when and how to use that port ???)
If I used Http Get and Post port , how do i need to modify my demo.p program ???
Surely i am doing little bit confusion...please forgive me !!!
I post my demo.p ..program
DEF VAR Parametro1 AS CHAR INIT 'GE'.
DEF VAR Parametro2 ASCHAR FORMAT 'X(500)' INIT''.
DEF VAR LccResult AS LONGCHAR.
DEFINE VARIABLE hWebService AS HANDLE.
DEFINE VARIABLE hPortType AS HANDLE.
DEF TEMP-TABLE Stock
FIELD Symbol AS CHAR
FIELD Name AS CHAR
INDEX i1 Symbol.
CREATE SERVER hWebService.
/*-----------------------*/
/* WSDL Schema Location */
/*-----------------------*/
hWebService:CONNECT("-WSDL 'http://www.webservicex.net/stockquote.asmx?WSDL ' ") NO-ERROR.
IF NOT hWebService:CONNECTED() THEN
DO:
DEFINE VARIABLE errmsg AS CHARACTER NO-UNDO INIT "SERVER NOT CONNECTED~n".
DEFINE VARIABLE i AS INTEGER NO-UNDO.
DO i = 1 TO ERROR-STATUS:NUM-MESSAGES:
errmsg = errmsg + ERROR-STATUS:GET-MESSAGE(i) + '~n'.
END.
MESSAGE errmsg VIEW-AS ALERT-BOX ERROR.
STOP.
END.
/*-----------------------------------------------------------------------------------*/
/*Es. RUN <portTypeName> SET hPortType ON SERVER hWebService.*/
/*------------------------------------------------------------------------------------*/
RUN StockQuoteSoap SET hPortType ONSERVER hWebService.
/*------------------------------*/
/* Invocazione del Metodo */
/*------------------------------*/
RUN GetQuote IN hPortType (INPUT Parametro1, OUTPUT Parametro2) NO-ERROR.
IF ERROR-STATUS:ERROR THEN
MESSAGE'Error: ' + ERROR-STATUS:GET-MESSAGE(1) VIEW-AS ALERT-BOX.
ELSE
MESSAGE'Result: ' + TRIM(parametro2)/***return-value***/VIEW-AS ALERT-BOX.
ASSIGN LccResult = Parametro2.
.......other instructions to read result with READ-XML method and import data in a tt-table...