dw.svc.ServiceDefinitionA service definition represents configuration that is shared across all Service instances.
This callback may declare multiple methods:
{
initServiceClient: function() {
// Create and return the internal service client object.
// This is usually optional, except in the case of SOAP services.
},
// svc is the call-specific Service instance. For example, it may be an HTTPService or FTPService.
// params are the arguments passed to the call method (if any).
createRequest: function(svc:Service, params) {
// Perform any required call-time configuration.
// Optionally return a Service-specific object
},
// svc is the call-specific Service instance.
// arg is the output of createRequest.
execute: function(svc:Service, arg:Object) {
// Execute the service call and return a result
// This method is not used by default for HTTP-related services unless executeOverride is set.
},
// Use the execute function if it is present. This is only required to use the functionality with HTTP services.
executeOverride: true,
// svc is the call-specific Service instance.
// response is the output of execute.
parseResponse: function(svc:Service, response: Object) {
// Process the response object as needed.
// The return value of this method will be the return value of the outer call method.
},
// svc is the call-specific Service instance.
// arg is the output of createRequest.
mockCall: function(svc:Service, arg:Object) {
// This method takes the place of the 'execute' phase when mocking is enabled.
// Note initServiceClient, createRequest, and parseResponse still invoked.
},
// svc is the call-specific Service instance.
// params are the arguments passed to the call method (if any).
mockFull: function(svc:Service, params) {
// This method takes the place of the entire service call when mocking is enabled.
// No other callbacks are invoked. The output of this method becomes the output of call.
}
}