Learning
Documentation
Community
Open Exchange
Global Masters
Home / Class Reference / ENSLIB namespace / EnsLib.HTTP.Service
Private  Storage   

EnsLib.HTTP.Service


class EnsLib.HTTP.Service extends
Ens.BusinessService, %CSP.Page

Abstract base class for HTTP-based BusinessService classes. Can use a HTTP.InboundAdapter listener, or the standard CSP 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 Services exposed using the HTTP 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.)

Inventory


Parameters Properties Methods Queries Indices ForeignKeys Triggers
5 2 11


Summary


This is a Business Service class.

The associated Adapter class is EnsLib.HTTP.InboundAdapter.

Properties
%AlertStartTime %ConfigName %ConfigQueueName
%LastActionTime %LastHandledTime %LastReportedError
%OutsideCreated %PreserveSession %ProcessInputCalled
%QuitTask %RequestHeader %SessionId
%SuperSession %SuperSessionCreatedBeforeSession %WaitForNextCallInterval
%WarnedLatest %isShadow Adapter
AlertGracePeriod AlertGroups AlertOnError
ArchiveIO BusinessPartner CSPNoCharSetConvert
EnableStandardRequests GenerateSuperSessionID IOLogEntry
InactivityTimeout ThrottleDelay

Methods
%AddToSaveSet %ClassIsLatestVersion %ClassName %ConstructClone
%DispatchClassMethod %DispatchGetModified %DispatchGetProperty %DispatchMethod
%DispatchSetModified %DispatchSetMultidimProperty %DispatchSetProperty %Extends
%GetParameter %IsA %IsModified %New
%NormalizeObject %ObjectModified %OnClose %OnNew
%OriginalNamespace %PackageName %RemoveFromSaveSet %SerializeObject
%SetModified %SuperSessionSet %ValidateObject AdapterName
AssignOneSetting CloseIOLogEntry ConvertParameter Decrypt
Encrypt EnumerateSettingsClose EnumerateSettingsExecute EnumerateSettingsFetch
EscapeHTML EscapeURL ForceSessionId GenerateSuperSession
GetDeferredResponseToken GetProductionSettingValue GetProductionSettings GetPropertyConnections
GetSettings GetShadowInstance HyperEventCall HyperEventHead
Include InsertHiddenField InsertHiddenFields IsPrivate
Link NewIOLogEntry OnAdapterHTTPResponse OnError
OnErrorStream OnGenerateSuperSession OnGetConnections OnHTTPHeader
OnInit OnKeepalive OnMonitor OnPageError
OnPostHyperEvent OnPreHTTP OnPreHyperEvent OnProcessInput
OnProductionStart OnProductionStop OnTearDown Page
PopulateSuperSession QueueName QuoteJS RewriteURL
SaveIOLogEntry SendAlert SendDeferredResponse SendRequestAsync
SendRequestSync ShowError StartTimer StopTimer
ThrowError UnescapeHTML UnescapeURL findDataNotInQuery
restoreFormEncoded restoreMultipart

Subclasses
EnsLib.HTTP.GenericService EnsLib.REST.Service

Parameters


• parameter ADAPTER = "EnsLib.HTTP.InboundAdapter";
Name of the adapter class - override this to "" if you want to use only the regular HTTP mechanism and not the custom-port HTTP InboundAdapter.
• parameter PARSEBODYFORMVARS = 0;
Set this to make page parse form variables from the form body in case of a form POST
• parameter REMOVECSPATTRIBS = 0;
Set this to remove CSP Gateway inserted Content stream attributes (e.g. FileName, MimeSection)
• parameter SETTINGS = "EnableStandardRequests:Connection";
List of properties can be set as settings in the configuration file format is a comma separated list of property names
• parameter TOLOWERHEADERVARS = 1;
Set this to 0 to prevent normalizing of HTTP header variable names to lowercase

Properties


• property CSPNoCharSetConvert as %Boolean [ InitialExpression = 0 ];
When receiving via the CSP Gateway if the %response.ContentType=text/... or the %response.CharSet is specified then CSP will normally convert to the target charset when writing the response. This property is used to set the %response.NoCharSetConvert property.
The default is to have the CSP Gateway convert to the target charset.
For passthrough (generic) this might need to be checked so that the CSP Gateway does not convert.
If %response.NoCharSetConvert is set to true in custom code that will take precedence over this property being false.
• property EnableStandardRequests as %Boolean [ InitialExpression = 1 ];
Listen via the CSP WebServer in addition to listening on the HTTP.InboundAdapter's custom local port, if the Adapter is defined/

Note that SSLConfig only applies to the custom local port. To use SSL via the CSP WebServer, you must configure the WebServer separately.

If the Service is invoked via the CSP WebServer, the ?CfgItem= URL parameter may be used to distinguish between multiple configured same-class Services but the standard csp/namespace/classname URL must be used.


Methods


• 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 HTTP 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 HTTP call to the adapter pHTTPResponseStatus is the HTTP status that will be reported to the HTTP client pBodyLen is the response body size in bytes that will be reported to the HTTP client pResponseBodyStream is the stream or string whose contents will be returned as the HTTP 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

• classmethod OnErrorStream(pStatus As %Status, pInstance As EnsLib.HTTP.Service)
Control the type and content of error returned to the HTTP caller
• classmethod OnHTTPHeader(ByRef OutputBody As %Boolean) as %Status
Ensure no call to %response.WriteHTTPHeader() before OnPage(); ServerOnly and not Abstract to ensure $$$cMETHrunnable
• method OnInit() as %Status
This user callback method is called via initConfig() from %OnNew() or in the case of SOAP Services from OnPreSOAP()
• classmethod OnPageError(ByRef pStatus As %Status)
Event handler for any error that occurs on the page. If an error occurs and this method is defined it calls this method passing it the error code by reference. You may change the error code if wished, if you set it to $$$OK then it will cancel the error and the CSP error page will not be displayed.
• classmethod findDataNotInQuery(Output pDataPairs As %String) as %Status
Helper method to compare %request.Data with Query string parameters.
• classmethod restoreFormEncoded(pBody As %Stream.Object = "") as %Status
Put form urlencoded data back into the body since it is parsed in .Data array
• classmethod restoreMultipart(ByRef pBody As %Stream.Object = "", Output pBoundary As %String = "")
Put %request.MimeData into pBody if %request.MimeData contains at least one MPC Do not generate a boundary if not in the source.