To host the WCF Gateway on a machine with AB Suite Developer installed, perform the following:
Select Start, expand Agile Business Suite 7.0, and then select Client Framework WCF Gateway Host.
This starts the WCF Gateway Service Host application and displays the following services in the Hosted Service pane:
Gateway – for connecting to the Runtime system
FileStoreGateway – for downloading and uploading files
Refer to the Agile Business Suite Installation and Configuration Guide for more information on the Client Framework WCF Gateway Host application.
When the gateways start, the Gateway Server Console and Service Host window displays the machine details and the endpoint addresses in the Trace Output pane.
To connect a client with this gateway, perform the following:
Create a client application that you want to connect to the gateway.
Note: You can create a console application, WPF application, Windows 8 apps, Windows Service application, or others as required.
As an example, we can use a WPF application to reference the Portable DataModels by using the Remote Access Layer API and connect to the WCF Gateway with the Remote.DotNET connection.
Add the following references to your project:
Your portable DataModels assembly generated from the AB Suite solution for the specified technology folder (for example, Sample.Remote.DataModels.Portable.dll)
The Gateway Service Interface assembly (Unisys.ABSuite.AccessLayer.GatewayServiceInterface.dll) that defines the Service Contract with the WCF Gateway.
The Remote Core assembly (Unisys.ABSuite.AccessLayer.Connector.Remote.Core.dll) that implements the Access Layer API for remote connections through the WCF Gateway.
The Connector assembly for establishing connections to the WCF Gateway from a Windows application, such as WPF (Unisys.ABSuite.AccessLayer.Connector.Remote.DotNet.dll).
In your Connection processing, create a Remote connection instance by using the ABSuite.AccessLayer.Remote.DotNet.Connection class, by passing an IspecFactory instance for your Portable DataModels.
ABSuite.AccessLayer.Connector.Remote.Core.Connection RemoteConnection = new ABSuite.AccessLayer.Connector.Remote.DotNet.Connection(new Sample.Remote.DataModels.Portable.Core.IspecFactory());
Note: In this example, we are using a WPF application that uses the full .NET Framework. Hence, we can employ the Connection class in the Unisys.ABSuite.AccessLayer.Connector.Remote.DotNet assembly. If you were developing a Windows 8 Store application, then you must use the Connector class in the Unisys.ABSuite.AccessLayer.Connector.Remote.Windows assembly.
Set up a ConnectionDetails object.
ConnectionDetails cDetails = new ConnectionDetails() { // The name or IP Address of the host machine the // WCF Gateway will connect to: Host = "localhost", // Is it an anonymous connection? IsAnonymous = true, // The name of the deployed runtime system (usually the // segment name) System = "Sample", // The name or IP Address of the machine where the WCF // Gateway is running GateWayAddress="localhost", // The location where the .NET DataModels can be found for // the WCF Gateway to use. // This must be a folder that is accessible by the WCF // Gateway process on the machine where the WCF Gateway is // running. DownLoadURI = @"C:\Gateway Applications\Sample\Access Layer API Deploy", // This is a list of assemblies that the WCF Gateway needs to // process the transactions for a particular application. In // this case, the .NET DataModels are specified DownLoadFiles = new string[] { "Sample.Remote.DataModels.dll" }, // Do we want to override any existing connections for the // same user? ForceLogin = true };
Once the ConnectionDetails is established, you can pass this to the Connect() method of your Remote Connector instance
TransmissionObject trObj = null; trObj = RemoteConnection.Connect(cDetails, null); if (trObj != null && (trObj.State == TransmissionReturnCode.Ok || trObj.State == TransmissionReturnCode.OkWithSwitch)) { CurrentIspecName = trObj.ObjectClassName; CurrentTO = trObj; SessionConnected = true; } else SessionConnected = false;
The Remote Connector establishes a full-duplex TCP/IP channel to the WCF Gateway and makes requests to the Gateway by using the Access Layer API Remote interface that exposes the same interface as the Direct Connect approach. The difference here is that the messages are being passed through an intermediary gateway by using a WCF endpoint.