HttpLink class library reference
Below is a summary of all the HostLink Class Library Reference available for .NET in HostFront 5.0
Table 7: HostFront .NET HttpLink class library
Associated methods Associated properties
Attach (System.String,System.Uri,bool bUseCluster)
Attach (System.String,System.Uri)
Close()
Connect (System.String,System.String,System.Uri)
Connect (System.Uri)
Connect (System.Uri, System.Boolean)
Connect (System.String,System.String,System.Uri,System.Boolean bUseCluster)
Detach()
GetConnectionInfo()
HttpLink (HostFront.EAI.Emulation,HostFront.EAI.CGIModule)
HostLink()
PushKey (HostFront.EAI.Key,System.Int32)
PushKey (HostFront.EAI.Key,HostFront.EAI.ScreenIdentifierSystem.Int32)
PushKey (HostFront.EAI.Key,HostFront.EAI.ScreenIdentifier)
PushKey (HostFront.EAI.Key)
PushKey (System.Int32,System.Int32)
PushKey (System.Int32,HostFront.EAI.ScreenIdentifier,System.Int32)
PushKey (System.Int32,HostFront.EAI.ScreenIdentifier)
TimeOut
PushKey (System.Int32)
CGIModule
CGIVirtualFolder
ClusterCGIVirtualFolder Credentials
IsConnected
PreAuthenticate
Proxy
TimeOut
Methods
The following methods are associated with the HttpLink class.
Attach (System.String,System.Uri,bool bUseCluster)
Allows the object to "attach" to an already existing and detached session on the host. (See the Detach method).
Note
This method should be used for version prior to 3.6.0.
Prototype
public virtual System.Boolean Attach (System.String sessionID,System.Uri requestUri,System.Boolean bUseCluster)
Member of HostFront.EAI.HttpLink
Parameters
SessionID: The host session id to attach to (as returned by the Detach method).
RequestUri: A System. Uri containing the URI of the HostFront server or cluster service that handles the live connection to the host.
bUseCluster: True of use the cluster architecture (HFEE) or false for versions prior to 3.6.0. If set to True, the method resolves to the normal (System.String,System.Uri) method.
Return
Returns true if successful. False otherwise.
If False, then the ErrorMessage property can have the following values:
•  20 — The provided session ID is unknown, meaning that either the session has been disconnected (by the backend host or for any other reason) or that the provided session ID is a wrong one.
•  21 — The session exists but is already attached.
Attach (System.String,System.Uri)
Allows the object to "attach" to an already existing and detached session on the host (See the Detach method).
Prototype
public virtual System.Boolean Attach (System.String sessionID,System.Uri requestUri)
Member of HostFront.EAI.HttpLink
Parameters
SessionID: The host session id to attach to (as returned by the Detach method).
RequestUri: A System. Uri containing the URI of the cluster service that handles the live connection to the host
Return
Returns true if successful. False otherwise.
Close()
Closes the connection to HostFront server and terminates the session on the host.
Prototype
public virtual void Close ( )
Member of HostFront.EAI.HttpLink
Connect (System.String,System.String,System.Uri)
Creates an HTTP connection to the host by first logging into the cluster service.
Prototype
public virtual System.Boolean Connect (System.String username,System.String password,System.Uri requestUri)
Member of HostFront.EAI.HttpLink
Parameters
Username: The HostFront account username.
Password: The HostFront account password.
RequestUri: A System.Uri containing the URI of the cluster service.
Return
Returns true if successful. False otherwise.
Connect (System.Uri)
Creates an HTTP connection to the host by first logging into the cluster service using the Windows domain account of the current user on the machine running the integration component.
Prototype
public virtual System.Boolean Connect (System.Uri requestUri)
Member of HostFront.EAI.HttpLink
Parameters
RequestUri: A System.Uri containing the URI of the cluster service.
Return
Returns true if successful. False otherwise.
Connect (System.Uri, System.Boolean)
Creates an HTTP connection to the host by first logging into the cluster service using the impersonated Windows domain account of the calling user on the machine making the call.
Prototype
public virtual System.Boolean Connect ( System.Uri requestUri, System.Boolean bImpersonated )
Member of HostFront.EAI.HttpLink
Parameters
RequestUri : A System.Uri containing the URI of the cluster service.
bImpersonated : A Boolean value. When True, it indicates using Impersonation.
Return
Returns true if successful. False otherwise.
Example
The following example demonstrates how to use this Connect method with impersonation in a web service.
1. Impersonating in Web Service:
In the Web.config file (in the project of Web Service) add:
<authentication mode="Windows" />

<identity impersonate="true"/>
2. Setting of IIS:
At the virtual directory of the Web Service project, uncheck “Enable anonymous access” and check “Integrated Windows authentication”.
3. Setting of IE:
IE à Tools à Internet Options à Advanced à Security à check “Enable Integrated Windows Authentication (requires restart)”.
4. Code snippet of impersonation in Web Service :
[WebMethod] 
            public string TestHTTP2(string sServer) 
            { 
                  System.Security.Principal.WindowsImpersonationContext ctxt = null; 
                  try 
                  { 
                        //impersonating 
                        System.Security.Principal.WindowsIdentity identity =
         (System.Security.Principal.WindowsIdentity)User.Identity; 
                        ctxt = identity.Impersonate(); 
                        string s = WindowsIdentity.GetCurrent().Name; 
  

                        //sServer = Cluser Service ip 
                        UriBuilder builder = new UriBuilder(Uri.UriSchemeHttp, sServer, 80); 
                        HostFront.EAI.HttpLink hostFront = new
    HostFront.EAI.HttpLink(HostFront.EAI.Emulation.HFM3270,CGIModule.ISAPI);
                        //connect to HostFront by specifying impersonation 
                        hostFront.Connect(builder.Uri,true); 
                        if(hostFront.IsConnected) 
                        { 
                              return hostFront.ScreenToString(); 
                        } 
                        else 
                        { 
                              return hostFront.ErrorMessage; 
                        } 
                  } 
                  catch(Exception ex) 
                  { 
                        return ex.ToString(); 
                  } 
                  finally 
                  { 
                        ctxt.Undo(); 
                  } 
  
            } 

5. Code snippet of Client of Web Service:
EAI.Service1 ws = new EAI.Service1(); 
ws.Credentials = new System.Net.NetworkCredential(this.txtName.Text, 
                              this.txtPSW.Text); 
ws.PreAuthenticate = true; 
            
this.listBox1.Items.Add(ws.TestHTTP2(this.textBox1.Text)); 
Note
If your Web Service needs to access other resources on behalf of client, or "Access Denied" error message occurs, you might consider using a solution as follow in your Web Services with impersonation: http://support.microsoft.com/default.aspx?scid=kb;en-us;Q325791
Connect (System.String,System.String,System.Uri,System.Boolean bUseCluster)
Creates an HTTP connection to the host by first logging into the cluster service or a HostFront server.
Note
This method should be used with versions prior to 3.6.0
Prototype
public virtual System.Boolean Connect (System.String username,System.String password,System.Uri requestUri, System.Boolean bUseCluster)
Member of HostFront.EAI.HttpLink
Parameters
Username: The HostFront account username.
Password: The HostFront account password.
RequestUri: A System.Uri containing the URI of the cluster service or a HostFront server.
bUseCluster: True of use the cluster architecture (HFEE) or false for versions prior to 3.6.0. If set to True, the method resolves to the normal.
Connect(System.String,System.String,System.Uri) method.
Return
Returns true if successful. False otherwise.
If False, then the ErrorMessage property can have the following values:
•  20 — The session could not connect to the backend host. Check the event log on the HostFront server.
•  24 — The session did connect but was disconnected either by the backend host or by the HostFront server. Check the event log on the HostFront server.
Detach()
Closes the connection to HostFront server but does not terminate the session on the host.
Prototype
public virtual System.String Detach ( )
Member of HostFront.EAI.HttpLink
Return
Returns the HostFront session id of the connection. This value can later be used with Attach so the object can "attach" to an existing session on the host.
GetConnectionInfo()
Retrieves the connection information to the host.
Prototype
public virtual HostFront.EAI.ConnectionInfo GetConnectionInfo ( )
Member of HostFront.EAI.HttpLink
Return
The ConnectionInfo structure indicating the returned values.
HttpLink (HostFront.EAI.Emulation,HostFront.EAI.CGIModule)
Initializes a new instance of the HttpLink class with given the CGI type and the emulation type.
Prototype
public HttpLink(Emulation emul, CGIModule cgiModule)
Member of HostFront.EAI.HttpLink
Parameters
emul: The type of emulation run by the target HostFront service : HFA5250 or HFM3270. Versions prior to 3.6.0 should specify DEFAULT.
cgiModule: The type of CGI used : ISAPI (for IIS servers) or EXE.
HostLink()
Initializes a new instance of the HttpLink class.
PushKey (HostFront.EAI.Key,System.Int32)
Issues a key press command on the host. The final screen is obtained after a specified delay. Used mostly with 3270 emulation.
Prototype
Member of HostFront.EAI.HostLink
Parameters
key: The value of the key to execute on the host.
millisecondsDelay: The delay specified in milliseconds.
Return
Returns true if the specified time has not elapsed. Otherwise, false.
PushKey (HostFront.EAI.Key,HostFront.EAI.ScreenIdentifierSystem.Int32)
Issues a key press command on the host. Terminates when a screen field is equal to the screen identifier or when the specified time elapses.
Prototype
Member of HostFront.EAI.HostLink
Parameters
key: The value of the key to execute on the host.
id: The screen identifier.
millisecondsTimeout: The timeout specified in milliseconds. A value of 0 indicates an infinite wait.
Return
Returns true if the specified time has not elapsed. Otherwise, false.
PushKey (HostFront.EAI.Key,HostFront.EAI.ScreenIdentifier)
Issues a key press command on the host. Terminates when a screen field is equal to the screen identifier. Used mostly with 3270 emulation.
Prototype
Public override System.Boolean PushKey (HostFront.EAI.Key key,HostFront.EAI.ScreenIdentifier id)
Member of HostFront.EAI.HttpLink
Parameters
key: The value of the key to execute on the host.
id: The screen identifier.
Return
Indicates whether the operation was successful.
PushKey (HostFront.EAI.Key)
Issues a key press command on the host.
Prototype
public abstract virtual System.Boolean PushKey (HostFront.EAI.Key key)
Member of HostFront.EAI.HostLink
Parameters
key: The value of the key to execute on the host.
Return
Indicates whether the operation was successful. If successful, the received screen is the first sent by the HostFront server, regardless of whether additional screens are available.
PushKey (System.Int32,System.Int32)
Issues a key press command on the host. The final screen is obtained after a specified delay. Used mostly with 3270 emulation.
Prototype
Member of HostFront.EAI.HostLink
Parameters
key: The value of the key to execute on the host.
millisecondsDelay: The delay specified in milliseconds.
Return
Returns true if the specified time has not elapsed. Otherwise, false.
PushKey (System.Int32,HostFront.EAI.ScreenIdentifier,System.Int32)
Issues a key press command on the host. Terminates when a screen field is equal to the screen identifier or when the specified time elapses.
Prototype
Member of HostFront.EAI.HostLink
Parameters
key: The value of the key to execute on the host.
id: The screen identifier.
millisecondsTimeout: The timeout specified in milliseconds. A value of 0 indicates an infinite wait.
Return
Returns true if the specified time has not elapsed. Otherwise, false.
PushKey (System.Int32,HostFront.EAI.ScreenIdentifier)
Issues a key press command on the host. Terminates when a screen field is equal to the screen identifier. Used mostly with 3270 emulation. This is an abstract method.
Prototype
public abstract virtual System.Boolean PushKey System.Int32 key,HostFront.EAI.ScreenIdentifier id)
Member of HostFront.EAI.HostLink
Parameters
Key: The value of the key to execute on the host.
Id: The screen identifier.
Return
Returns true if successful, false otherwise.
PushKey (System.Int32)
Issues a key press command on the host. This is an abstract method.
Prototype
public abstract virtual System.Boolean PushKey (System.Int32 key)
Member of HostFront.EAI.HostLink
Parameters
Key: The value of the key to execute on the host.
Return
Returns true if successful, false otherwise. If successful, the received screen is the first sent by the HostFront server, regardless of whether additional screens are available.
SendTimeOut
Gets or sets the time-out value for the HTTP request.
Prototype
public int TimeOut [ get, set ]
Member of HostFront.EAI.HttpLink
Properties
The following properties are associated with the HttpLink class.
CGIModule
Gets the type of CGI module for Http requests.
Prototype
public CGIModule CGIModule [ get ]
Member of HostFront.EAI.HttpLink
CGIVirtualFolder
Gets or sets the name of Web server virtual folder that contains the CGIs used to access a HostFront service.
Default values are :
Emulation Default virtual folder
HFA – 5250 HFCGI_5250
HFM – 3270 HFCGI_3270
For version < 3.6.0 HFCGI
Prototype
public CGIModule CGIVirtualFolder [ get,set ]
Member of HostFront.EAI.HttpLink
ClusterCGIVirtualFolder
Gets or sets the name of Web server virtual folder that contains the CGIs used to access a cluster service.
The default value is: “HFCGI”
Prototype
public CGIModule ClusterCGIVirtualFolder [ get,set ]
Member of HostFront.EAI.HttpLink
Credentials
Gets or sets the credentials to submit to the proxy server for authentication.
Prototype
public System.Net. ICredentials Credentials [ get,set ]
Member of HostFront.EAI.HttpLink
IsConnected
Indicates whether the connection to the host is still valid.
Prototype
public bool IsConnected [ get]
Member of HostFront.EAI.HttpLink
PreAuthenticate
Indicates whether to preauthenticate the request.
Prototype
public System. Boolean PreAuthenticate [ get,set ]
Member of HostFront.EAI.HttpLink
Proxy
Gets or sets the proxy access for the HttpWebRequest class.
Prototype
public System.Net.IWebProxy Proxy [ get,set ]
Member of HostFront.EAI.HttpLink
TimeOut
Gets or sets the time-out value for the HTTP request.
Prototype
public int TimeOut [ get, set ]
Member of HostFront.EAI.HttpLink
HttpTrace class
This class displays the screen content within a window. It should only be used for debugging purposes. It implements all the HttpLink class functionality.