Skip to main content


class EnsLib.SOAP.Service extends Ens.Helper.Service.SyncResponseHandler.HTTP, Ens.BusinessService, %SOAP.WebService

Abstract base class for WebService-based BusinessService classes. Can use a SOAP.InboundAdapter listener, or the standard SOAP Service mechanism, or both. In order for the CSP mechanism to work, Web Services derived from this class must be configured either with their configuration name the same as their class name, or the invoking URL must include ?CfgItem= giving the config item name, or using a CSP application with a DispatchClass configured and the config item name as the next URL piece after the application name. (Configured Web Services exposed using the SOAP Inbound Adapter may also be invoked with this URL parameter but because each configured Inbound Adapter listens on its own TCP/IP port this parameter is just a safety check for them.)

Property Inventory

Method Inventory


parameter ADAPTER = EnsLib.SOAP.InboundAdapter;
Name of the adapter class - override this to "" if you want to use only the regular SOAP mechanism and not the custom-port InboundAdapter.
parameter LOCATION;
Default URL for invoking the WebService. The URL may be absolute or relative to the WSDL request URL. Override this parameter in your subclass. Example: "http://localhost/csp/MyEnsemble/MyProduction/MyWebService.cls";
parameter NAMESPACE =;
SOAP Namespace for the WebService Override this parameter in your subclass with the unique namespace URI of your organization.
parameter SERVICENAME = MyEnsembleRequestWebService;
The SOAP name of this service. Override this parameter in the subclass.
parameter SETTINGS = -AlertGracePeriod,SupportDelayedSyncRequest:DelayedResponseSupport,OverrideClientResponseWaitTimeout:DelayedResponseSupport,GatewayTimeout:DelayedResponseSupport;
Can't do grace period without an OnTask loop
parameter SOAPSESSION = 0;
Enables session capability on this Service. Also affects license consumption.
parameter USEBOTH = 0;
Override this setting to allow your subclass to accept WebService requests on both the custom-port InboundAdapter and the regular SOAP mechanism. This parameter is ignored and the regular SOAP mechanism is enabled if the ADAPTER parameter is empty in your subclass.


property SOAPInvoked as %Boolean [ InitialExpression = 0 ];
Property methods: SOAPInvokedDisplayToLogical(), SOAPInvokedGet(), SOAPInvokedIsValid(), SOAPInvokedLogicalToDisplay(), SOAPInvokedNormalize(), SOAPInvokedSet()


method %OnNew(pConfigName As %String) as %Status
initialize Business Host object
abstract method OnAdapterHTTPResponse(ByRef pStatus As %Status, ByRef pHTTPResponseStatus As %String, ByRef pBodyLen As %Integer, ByRef pResponseBodyStream As %Stream.Object, ByRef pMainResponseHeader As %String, ByRef pHeaderExtra As %String)
Callback for allowing Service to override and control construction of the HTTP response if invoked via the SOAP Inbound Adapter Override this method in your Service class to customize the HTTP response

Each argument may be overridden to change a particular aspect of the HTTP response pStatus is the status code that resulted from the SOAP call to the adapter pHTTPResponseStatus is the HTTP status that will be reported to the SOAP client pBodyLen is the response body size in bytes that will be reported to the SOAP client pResponseBodyStream is the stream or string whose contents will be returned as the SOAP response message body pMainResponseHeader if returned with content will be used verbatim as the HTTP header pHeaderExtra if returned will be used to override the standard no-cache header declarations or append to pMainResponseHeader

method OnAuthorize(pAction, pRequest As %CSP.Request) as %Status
Override to add customized authorization behavior
classmethod ReturnFault(fault As %SOAP.Fault)
Inherited description: Return the SOAP fault in %SOAP.Fault as the result of this web method call. The ReturnFault method should only be called from the implementation of the WebMethod. This method will not return to its caller. It will act as a Quit from the Web Method with the %SOAP.Fault as the return value.

You can generate a SOAP fault from a web method as in the following example:

  Set fault=##class(%SOAP.Fault).%New()
  Set fault.faultcode=$$$FAULTServer
  Set fault.faultstring="Processing Error"
  Set fault.detail="<e:myError xmlns:e=""some-URI"">app didn't work</e:myError>"
  Do ..ReturnFault(fault) ; will not return
classmethod ReturnMethodStatusFault(pStatus As %Status)
Return a fault based on status code to the client
classmethod ReturnStatusFault(pCode As %String, pStatus As %Status)
Return a fault based on status code to the client
classmethod statusReturn(pCode As %String, pStatus As %Status)
Return a fault based on status code to the client - only for use outside %SOAP.Service.Process()/ProcessHTML()

Inherited Members

Inherited Properties

Inherited Methods


FeedbackOpens in a new tab