Skip to main content

EMS.Connection.Initiator

EMS.Connection.Initiator creates a connection to a Responder web service.
To create this class call %New with a EMS.Connection.Endpoint argument which specifies the wbe sevice endpoint.

Usage example:
   // The responder must have EMS.Connection.Parameters created and saved first.
   // The responder parameter are used to return the policy for RegisterInit.
   // See EMS.Connection.Responder class for details
   // On responder:
   Set parameters=##class(EMS.Connection.Parameters).%New()
   Set parameter.IsInitiator=0
   Set parameters.Application"..."  ; it is "EMS" for EMS
   Set parameters.Identifier=parameters.Application
   Set endpoint=##class(EMS.Connection.Endpoint).%New()
   Set endpoint.Host=responderHost
   Set endpoint.Port=responderPort
   Set endpoint.Prefix=responderPrefix
   Set endpoint.CSPApplication=....
   Set parameters.Endpoint=endpoint
   Set policy=##class(EMS.Connection.Policy.x).%New()  ; where x is SSL, X509 or Username
   ... fill in properties of policy
   Set parameters.Policy=policy
   Set status=parameters.%Save()
   
 ---------------------------------------------------
   // On Initiator:
   // Create EMS.Connection.Initiator object
   Set endpoint=##class(EMS.Connection.Endpoint).%New()
   Set endpoint.Host=host
   Set endpoint.Port=port
   Set endpoint.Prefix=prefix
   Set endpoint.CSPApplication=...  ; regirtration CSP application
   Set application="..."  ; it is "EMS" for EMS
   Set initiator=##class(EMS.Connection.Initiator).%New(application,endpoint)
   // Make web service call to responder's connection service to discover policy
   Set error=initiator.GetConnectionParameters(.parameters)
   // parameters is now connection parameters for responder service

   // Now ask the user for policy data and add to instance connection parameters
   // Need to create instanceData which is a subclass of EMS.Connection.Data that
   // will hold your application dependent data in addition to instance connection parameters.
   Set sc=initiator.RequestConnection(instanceData,responderConnectionParameters)

   // If successful, the responder will call ConnectionEstablish method on the responder side
   // not as WebMethod.  After this your connection is established as a 2-way connection.
This class is created for use by EMS. However, it is written with enough generality to be useful for other applications. The Application property specifies the application.

This class is used internally by Caché. You should not make direct use of it within your applications. There is no guarantee made about either the behavior or future operation of this class.

Inherited Members

Inherited Methods

FeedbackOpens in a new tab