Sample Host Simulator Request

The following example shows how to create a simple application that interfaces with the XML Select Web Service to request an air availability. In this example, the application is written in C#  and the Web Services toolkit is VisualStudio.NET. However, any Web Services-compatible development environments can be used.

  1. In the Web Services toolkit, create a new project named XWSSample.

  2. In C#, create a Windows Application project.

  3. Create a new Form.

  4. In the Form, create the following fields:

  5. A Submit button.

  6. Two small textboxes named tbUser and tbPassword.

  7. A large text box: tbResponse. Set the Multiline property to TRUE, and maximize the text box to fill most of the dialog box.

  8. Add a web reference for the XML Select Web Service.

  9. In VS.NET, right-click on References and select Add Web Reference.

    In VS.NET, adding a web reference automatically downloads the WSDL to your development environment and creates a SOAP proxy to the Web Service.

  10. Enter the address for the XML Select Web Service: http://testws.galileo.com/XmlSelect/XmlSelect.asmx

  11. When prompted, enter the user name and password, which will be provided by your Apollo or Galileo representative.

  12. If prompted to enter the user name and password again, enter the same values and leave the domain blank.

  13. The web page for the service displays. The left pane on this page provides a brief overview of the service interface.

  14. In VS.NET, the reference displays as WebReference1 in the Solution Explorer. The reference can be expanded to display the WSDL file that was imported from the XML Select Web Services site.

  15. Create an OnClick event for the Submit button.

  16. In VS.NET, double-click the Submit button to add an OnClick event.

  17. At the top of the code, add the following lines:

  18. using System.Xml;
    using
    System.Net;

  19. In the OnClick event code, located at the bottom of the file, enter the following lines:
    (For easier copying, see the code without annotations.)

Makes the XML transaction request for air availability (AirAvailabilty_6_2)

XmlDocument xmlRequest = new XmlDocument();

xmlRequest.LoadXml("<AirAvailability_6_2>
</AirAvailability_6_2>");

Specifies an unfiltered transaction response.

XmlDocument xmlFilter = new XmlDocument();

xmlFilter.LoadXml("<_></_>");

Specifies the Web Service and associated proxy.

WebReference1.XMLSelectWebService xws = new WebReference1.XMLSelectWebService();

Provides the user identification (network credentials).

Note: For Windows XP Professional, a CredentialCache object for basic authentication  may be required.

xws.Credentials = new System.Net.NetworkCredential(
tbUser.Text, tbPassword.Text);

Requests an XML response from the Web Service for the Simulator Host Access Profile. (Profiles are provided by Galileo).

xmlRequest and xmlFilter specifies the Document (root) XML element for the request and filter.

XmlElement xmlResponse = xws.SubmitXml("Simulator",
xmlRequest.DocumentElement, xmlFilter.DocumentElement);

Sets the response as an XML text string.

tbResponse.Text = xmlResponse.OuterXml;

  1. Compile and run the application.

  2. In VS.NET, press F5.

  3. When prompted, enter the user name and password again.

  4. Click Submit. The response displays in the tbResponse text box.