SOAP-enabling Queries
Queries destined for use in Roxie are SOAP-enabled first. The required
ECL code to accomplish this is the STORED workflow service. Roxie queries
may be contained in the FUNCTION structure or may simply be an executable
query.
The ECL Key to SOAP
The ECL code requirement for SOAP-enabled input parameters is the
use of the STORED workflow service. Each SOAP parameter name must be the
STORED name for an ECL definition. The STORED workflow service creates a
data storage space in the workunit that the SOAP interface uses to
populate the “passed” data. The ECL code simply uses those STORED
definitions to determine whether data was passed from that “parameter” and
what that data is. The data type of the passed SOAP parameter is implied
by the STORED definition.
For the following code example, you must create two definitions with
STORED names duplicating the SOAP parameter name, like this:
STRING30 lname_value := '' : STORED('LastName');
STRING30 fname_value := '' : STORED('FirstName');
These default to blank and the STORED workflow service opens a space
in the workunit to store the value. The Enterprise Service Platform (ESP)
handles the SOAP interface chores by plugging in the appropriate values
into the storage space created by STORED. Therefore, the ECL code only
needs to use the definitions (in this case, Lname and Fname) to accomplish
the query. This makes the ECL side of the equation very simple.
Putting It All Together
Once you understand the requirements, a SOAP-enabled query would
look like this (contained in SOAPenabling.ECL):
IMPORT ProgrammersGuide.DeclareData AS ProgGuide;
EXPORT SOAPenabling() := FUNCTION
STRING30 lname_value := '' : STORED('LastName');
STRING30 fname_value := '' : STORED('FirstName');
IDX := ProgGuide.IDX__Person_LastName_FirstName;
Base := ProgGuide.Person.FilePlus;
Fetched := IF(fname_value = '',
FETCH(Base,IDX(LastName=lname_value),RIGHT.RecPos),
FETCH(Base,IDX(LastName=lname_value,
FirstName=fname_value),RIGHT.RecPos));
RETURN OUTPUT(CHOOSEN(Fetched,2000));
END;