HP CloudSystem Matrix/Matrix Operating Environment 7.0 Integration Interfaces API and CLI Operations Reference Guide

8 Sample VisualStudio/.NET/C# Client
The Web Service Interfaces may be accessed from a .NET client program by using Microsoft
VisualStudi to create C# language bindings from the WSDL:
In VisualStudio®, create (for example) a consoled application
Add a Service Reference, and enter the IO web service endpoint URL (See the Accessing
WSDL section)
Enter a service name (e.g., “IOService”) as the Namespace value
Add these namespaces:
using System.Net;
using System.Net.Security;
using System.Xml;
Add this code:
try
{
//Open the config file to set the timestamp token and username token
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(
AppDomain.CurrentDomain.SetupInformation.ConfigurationFile);
//Get the configuration node
XmlNode appSettingsNode =
xmlDoc.SelectSingleNode("configuration");
//get the service model node
XmlNode servicemodelNode = appSettingsNode.LastChild;
//Get the client node
XmlNode clientNode = servicemodelNode.LastChild;
//get the endpoint node
XmlNode endpointNode = clientNode.LastChild;
//get the headers node
XmlNode headersNode = endpointNode.LastChild;
56 Sample VisualStudio/.NET/C# Client