InfoConnect for Airlines
Integrate Web and Host Data

This sample program shows how to get data from a host program and enter it on a Web form. This includes the following tasks:

  • Navigate between Web pages.
  • Get a reference to a Web element.
  • Fill in fields, and submit a form on a Web page.

To build the custom application

  1. In InfoConnect, create a Web page document and set the URL as:
    http://docs.attachmate.com/reflection/prog-demo/enter-data.html
    
  2. Save the document as WebFormDemo.urlx, in the ..\Documents\Micro Focus\InfoConnect\ directory and then quit InfoConnect.
  3. In Visual Studio, create a new Console Application project and add references for the following InfoConnect assemblies. (Depending on your version of Visual Studio, these can be found either on the .NET tab or under Assemblies | Extensions.)
    Attachmate.Reflection
    Attachmate.Reflection.Framework
    Attachmate.Reflection.Emulation.IbmHosts
  4. Add the following statements:
    using Attachmate.Reflection.Web.Msie;
    using Attachmate.Reflection.Framework;
    using Attachmate.Reflection.UserInterface;
    using Attachmate.Reflection.Emulation.IbmHosts;
    
       
  5. Replace all the code in the Main method with the following code. This code creates a new IBM demo session and assigns an event handler for the NewScreenReady event. Then it opens the Web session and assigns an event handler for the DocumentCompleted event.
    Main method
    Copy Code
    Type your example code here. It will be automatically colorized when you switch to Preview or build the help system.
    
       
  6. Add the following variable to the Program class. We'll use this key value pair list to contain data that we'll retreive from the IBM demo program screen.
    Key Value Pair list variable
    Copy Code
    //Declare this key value pair list to contain data scraped from the screen
    private static List<KeyValuePair<string, string>> kvp;
    
           
  7. Add the following event handler for the NewScreenReady event to the Program class. This code opens a password box, and then navigates to a screen with the data we want to retreive. Then it gets the data and adds it to the key value pair list. 
    NewScreenReady event handler
    Copy Code
    Type your example code here. It will be automatically colorized when you switch to Preview or build the help system.
    
  8. Add the following code to handle the DocumentCompleted event to the Program class. If the Web form has focus, this waits until the key value pair list has some data, enters it into Web form, and submits the form. After the form is successfully submitted, the code returns to the form.
    Example Title
    Copy Code
    Type your example code here. It will be automatically colorized when you switch to Preview or build the help system.
    

 To run this sample

  1. Press F5 to run the sample.
  2. When prompted to enter a password, enter any text.        
  3. Verify that the data from the host screen is entered into the Web form.