result := SOAPCALL( [ recset, ] url, service, instructure, [ transform, ] DATASET(outstructure) | outstrucuture [,options [, UNORDERED | ORDERED( bool ) ] [, STABLE | UNSTABLE ] [, PARALLEL [ ( numthreads ) ] ] [, ALGORITHM( name )] [, PERSIST [ ( option ) ] ] ) ;
SOAPCALL( [ recset, ] url, service, instructure, [ transform, ] [ options ] [, UNORDERED | ORDERED( bool ) ] [, STABLE | UNSTABLE ] [, PARALLEL [ ( numthreads ) ] ] [, ALGORITHM( name )] [, PERSIST [ ( option ) ] ] ) ;
result | The attribute name for the resulting recordset or single record. |
recset | Optional. The input recordset. If omitted, the single input record must be defined by default values for each field in the instructure parameter. |
url | A string containing a pipe-delimited ( | ) list of URLs
that host the service to invoke (may append repository module
names). This is intended to provide a means for the client to
conduct a Federated search where the request is sent to each of
the target systems in the list. These URLs may contain standard
form usernames and passwords, if required. If calling an ESP Web
service, you can append the ver_=n.nn parameter to specify the
version of the service. For example: SOAPCALL('https://eclwatch.example.com:8010/Wsdfu/?ver_=1.22', 'DFUSearchData', instructure,DATASET(outsructure)); |
service | A string expression containing the name of the service to invoke. This may be in the form module.attribute if the service is on a Roxie platform. |
instructure | A RECORD structure containing the input field definitions from which the XML input to the SOAP service is constructed. The name of the tags in the XML are derived from the lowercase names of the fields in the input record; this can be overridden by placing an xpath on the field ( {xpath('tagname')} -- see the XPATH Support section of the RECORD Structure discussion). If the recset parameter is not present, each field definition must contain a default value that will constitute the single input record. If the recset parameter is present, each field definition must contain a default value unless a transform is also specified to supply that data values. |
transform | Optional. The TRANSFORM function to call to process the instructure data. This eliminates the need to define default values for all fields in the instructure RECORD structure. The transform function must take at least one parameter: a LEFT record of the same format as the input recset. The resulting record set format must be the same as the input instructure. |
DATASET (outstructure) | Specifies recordset result in the outstructure format. |
outstructure | A RECORD structure containing the output field definitions. If not used as a parameter to the DATASET keyword, this specifies a single record result. Each field definition in the RECORD structure must use an xpath attribute ( {xpath('tagname')} ) to eliminate case sensitivity issues. |
options | A comma-delimited list of optional specifications from the list below. |
UNORDERED | Optional. Specifies the output record order is not significant. |
ORDERED | Specifies the significance of the output record order. |
bool | When False, specifies the output record order is not significant. When True, specifies the default output record order. |
STABLE | Optional. Specifies the input record order is significant. |
UNSTABLE | Optional. Specifies the input record order is not significant. |
PARALLEL | Optional. Try to evaluate this activity in parallel. |
numthreads | Optional. Try to evaluate this activity using numthreads threads per node. |
ALGORITHM | Optional. Override the algorithm used for this activity. |
name | The algorithm to use for this activity. Must be from the list of supported algorithms for the SORT function's STABLE and UNSTABLE options. |
PERSIST | Optional. Use persistent connections. |
option | Optional. If omitted, it uses the default number of requests per connection. If TRUE, it enables persistent connections. If FALSE or 0, it disables persistent connections. If set to an integer, it enables persistent connections and sets the maximum number of requests each connection will be used for. |
Return: | SOAPCALL returns either a set of records, a single record, or nothing. |
SOAPCALL is a function or action that calls a SOAP (Simple Object Access Protocol) service.
Valid options are:
This form of SOAPCALL, the function, may take as input either a single record or a recordset, and both types of input can result in either a single record or a recordset.
The outstructure output record definition may contain an integer field with an XPATH of "_call_latency" to receive the time, in seconds, for the call which generated the row (from creating the socket to receiving the response). The latency is placed in every row the call returned, so if a call took 90 seconds and returned 11 rows then you will see 11 rows with 90 in the _call_latency field.
Example:
OutRec1 := RECORD
STRING500 OutData{XPATH('OutData')};
UNSIGNED4 Latency{XPATH('_call_latency')};
END;
ip := 'http://service.example.com:8022/';
ips := 'https://service.example.com:8022/';
svc := 'MyModule.SomeService';
ips_secret := 'secret:myConnectSecret';
/* assumes a secret named http-connect-myConnectSecret exists & contains:
/*
{
"url": "https://service.example.com:8022/",
"username": "username",
"password": "password"
}
*/
//1 rec in, 1 rec out
OneRec1 := SOAPCALL(ips,svc,{STRING500 InData := 'Some Input Data'},OutRec1);
//1 rec in, recordset out
ManyRec1 := SOAPCALL(ip,svc,{STRING500 InData := 'Some Input Data'},DATASET(OutRec1));
//recordset in, 1 rec out
OneRec2 := SOAPCALL(InputDataset,ip,svc,{STRING500 InData},OutRec1);
//recordset in, recordset out
ManyRec2 :=
SOAPCALL(InputDataset,ips_secret,svc,{STRING500 InData := 'Some In Data'},DATASET(OutRec1));
//TRANSFORM function usage example
namesRecord := RECORD
STRING20 surname;
STRING10 forename;
INTEGER2 age := 25;
END;
ds := DATASET('x',namesRecord,FLAT);
inRecord := RECORD
STRING name{xpath('Name')};
UNSIGNED6 id{XPATH('ADL')};
END;
outRecord := RECORD
STRING name{xpath('Name')};
UNSIGNED6 id{XPATH('ADL')};
REAL8 score;
END;
inRecord t(namesRecord l) := TRANSFORM
SELF.name := l.surname;
SELF.id := l.age;
END;
outRecord genDefault1() := TRANSFORM
SELF.name := FAILMESSAGE;
SELF.id := FAILCODE;
SELF.score := (REAL8)FAILMESSAGE('ip');
END;
outRecord genDefault2(namesRecord l) := TRANSFORM
SELF.name := l.surname;
SELF.id := l.age;
SELF.score := 0;
END;
OUTPUT(SOAPCALL(ip, svc,{ STRING20 surname := 'Halligan',STRING20 forename := 'Kevin';},
DATASET(outRecord), ONFAIL(genDefault1())));
OUTPUT(SOAPCALL(ds, ip, svc, inRecord, t(LEFT),DATASET(outRecord), ONFAIL(genDefault2(LEFT))));
OUTPUT(SOAPCALL(ds, ip, svc, inRecord, t(LEFT),DATASET(outRecord), ONFAIL(SKIP)));
OUTPUT(SOAPCALL(ds, ip, svc, inRecord, t(LEFT),DATASET(outRecord), ONFAIL(SKIP),PERSIST(12)));
//use 12 persistent connections
//Using HTTPHEADER to pass Authorization info
OUTPUT(SOAPCALL(ds, ip, svc, inRecord, t(LEFT),DATASET(outRecord), ONFAIL(SKIP),
HTTPHEADER('Authorization','Basic dXNlcm5hbWU6cGFzc3dvcmQ='),
HTTPHEADER('MyLiteral','FOO')));