Provides dynamically generated proxies for SOAP services configured on the process. Each configured service, endpoint, and operation becomes a property under this object at runtime.
Parameter names and result shapes are defined by the selected service operation's WSDL, so they cannot be expressed statically in this declaration. Service proxy creation lazily compiles the discovery XML schema and resolves configured credentials on first use. Use the generated autocomplete members for the configured service.
An operation is called as $Services.<service>.<endpoint>.<operation>(body, headers, options):
body: the request body, as an object or an XML string.
headers: values for SOAP headers defined by the service, matched by name. Optional.
options: call options. Optional.
url: overrides the endpoint URL defined in the WSDL.
timeout: the maximum time to wait for the reply, in seconds.
return: 'request' returns the generated request message without calling the service; 'response' returns the whole response message.
The call waits for the reply and returns the first element of the response body as an Xml node. SOAP faults and connection errors are thrown as script errors.
// OrderService is the configured service, OrderServiceSoap the endpoint and GetOrder the operationvarresult=$Services.OrderService.OrderServiceSoap.GetOrder({orderId:$Xml.Evaluate('OrderId')});
varresult=$Services.OrderService.OrderServiceSoap.GetOrder({orderId:$Xml.Evaluate('OrderId')});// response elements are usually in the service namespaceresult.AddNamespace('o','http://orders.example.com/');$Xml.SetValue('OrderStatus',result.Evaluate('o:GetOrderResult/o:Status'));result.SelectAll('o:GetOrderResult/o:Lines/o:Line',function(line){$Xml.AppendChild('Lines/Line',function(node){node.SetValue('Product',line.Evaluate('o:Product'));});});
try{varresult=$Services.OrderService.OrderServiceSoap.GetOrder({orderId:$Xml.Evaluate('OrderId')},{ClientInfo:{Application:'Emakin'}},{url:'https://orders-test.example.com/OrderService.asmx',timeout:30});}catch(e){console.warn('Order service call failed: '+e.message);throwe;}
Inspect the request message without calling the service¶