10.07.2015 Views

Using TCP Adapters with Ensemble - InterSystems Documentation

Using TCP Adapters with Ensemble - InterSystems Documentation

Using TCP Adapters with Ensemble - InterSystems Documentation

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Sample Business Service Class CodeReturning an error status from OnConnect() causes the new connection to fail and be disconnected. If an untrappedexception occurs <strong>with</strong>in OnConnect(), the adapter catches it and continues as if OnConnect() were not implemented.4. Compile your new business service class. Compiling also saves it.5. After creating and compiling the business service class in Studio, add an instance of the business service to the productionand configure it using the Management Portal. See the appendix “Common Tasks in the Management Portal.”When you configure the adapter, you specify a value for the AllowedIPAddresses settings, along other settings. Notethat AllowedIPAddresses provides a way to enable the adapter to initiate the connection; see “Adapter Settings.”6.4 Sample Business Service Class CodeThe following is an example of a business service class that references the EnsLib.<strong>TCP</strong>.TextLineInboundAdapter.Class Test<strong>TCP</strong>TextLine.Authorization<strong>TCP</strong>ServiceExtends Ens.BusinessService [ ProcedureBlock ]{/// Name of the adapter classParameter ADAPTER = "EnsLib.<strong>TCP</strong>.TextLineInboundAdapter";Method OnProcessInput(pInput As Ens.StringContainer,pOutput As Ens.StringContainer) As %Status{set $ZT = "EXCEPTION"set st = $$$OKdo {if ('$isobject($get(pInput))) { quit }// Input must have the following format: 'PatientCode:ProcedureCode'set tSubject = pInput.StringValue$$$TRACE("received line "_tSubject)set req = ##class(Test<strong>TCP</strong>TextLine.AuthorizationRequest).%New()set req.PatientCode = $piece(tSubject,":",1)set req.ProcedureCode = $piece(tSubject,":",2)set st = ..SendRequestSync("AuthorizationProcess", req, .resp)quit:$$$ISERR(st)set pOutput=##class(Ens.StringContainer).%New(resp.AuthorizationFlag_":"_resp.AuthorizationCode)} while (0)EXIT//do ..Adapter.Disconnect()quit stEXCEPTIONset $ZT = ""set st = $$$EnsSystemErrorgoto EXIT}}6.5 Adapter SettingsThis topic describes the settings that are specific to the EnsLib.<strong>TCP</strong>.TextLineInboundAdapter associated <strong>with</strong> the businessservice. For settings not listed here, see “Business Service Settings” in the chapter “Configuration” in Managing<strong>Ensemble</strong> Productions.<strong>Using</strong> <strong>TCP</strong> <strong>Adapters</strong> <strong>with</strong> <strong>Ensemble</strong> 39

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!