You are here: Home News & Events Development Update Development Update September 2008 - 4GL Web Service Client
Document Actions

Development Update September 2008 - 4GL Web Service Client

Hydra4GL Version 4.31 and Lycia will support 4GL Web Service Functionalilty in the GUI clients.

4GL Web Service Client

Provides a means of invoking Web Services from 4GL application logic.

Features:

  • Supports both RPC/Encoding and Document/Literal binding styles
  • Support for SOAP 1.1 and SOAP 1.2
  • Support for Fire & Forget and Send & Receive transaction models
  • Support for MTOM and SwA


4GL Web Service Client

WebServicesLoad_500.gif

Decomposing WSDL

  • WSDL2FGL tool decomposes the WSDL from a service into 2 descriptions
  • A meta description used by the 4GL Web Service client.
  • A 4GL function stub that provides the necessary routines to invoke the methods details in the WSDL.


4GL Service Description

#-----------------------------------------------------------
# SERVICE NAME :  hello
#-----------------------------------------------------------
PORT NAME :  helloSOAP11port_http
PORT URL :  http://localhost:9080/axis2/services/hello
SOAP VERSION:  SOAP1.1
BINDING STYLE : document/literal
METHODS :
METHOD NAME : f1
INPUT PARAMETERS :
   param0 INTEGER
RETURN VALUES :
   return VARCHAR
#-----------------------------------------------------------
PORT NAME :  helloSOAP12port_http
PORT URL :  http://localhost:9080/axis2/services/hello
SOAP VERSION:  SOAP1.2
BINDING STYLE : document/literal
METHODS :
METHOD NAME : f1
INPUT PARAMETERS :
   param0 INTEGER
RETURN VALUES :
   return VARCHAR


Internal ‘meta’ description

  • Stored as XML in $QUERIXDIR/meta/wsclient
  • One meta file is created for each service

For each Service the metadata describes the available ports, operations and the bindings to those operations

Client Perception of Web Services

WebServicesXMLData_595.gif


Invoking Web Services from 4GL


Two sets of function calls allow the user to access web services from 4GL

  • fgl_ws_call()
    A set of request building functions
  • fgl_ws_create()
  • fgl_ws_setparameters()
  • fgl_ws_execute()
  • fgl_ws_getdata()
  • fgl_ws_close
  • fgl_ws_error()


fgl_ws_call()

An atomic invokation of a Web Service. Best suited to Fire & Forget methods, but also supports Send & Receive
Always returns the same number of parameters as the service being invoked
If any expected input parameters are not supplied, the values are substituted with NULL equivalents

fgl_ws_call()

Input parameters consist of Service Name, Port Name and Operation Name. Any input variables are supplied in addition to these

CALL fgl_ws_call(“hello”, # service
  “helloSOAP11port_http”, # port
“f1”,  # operation
  3)  # optional parameters

Request Building Functions

  • Suited to Send & Receive operations
  • Able to provide error diagnostics on failed execution

Request Lifecycle

  • The user creates a client instance using fgl_ws_create().
  • Input data is bound to the instance using fgl_ws_setparameters()
  • The client instance is invoked using fgl_ws_execute()
  • 4GL data is retrieved from the instance using fgl_ws_getdata()
  • The client instance is terminated using fgl_ws_close()
  • If the execution call fails, diagnostics can be received using fgl_ws_error()


Request Example

CALL fgl_ws_create(handle, p_service, p_port, operation)
CALL fgl_ws_setparameters(handle, my_short)
IF NOT fgl_ws_execute(handle) THEN
  DISPLAY fgl_ws_error(handle) 
END IF
CALL fgl_ws_getdata(handle)
  RETURNING my_record.*
CALL fgl_ws_close(handle)