HP CloudSystem Matrix/Matrix Operating Environment 7.2 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 Accessing WSDL
(page 23))
Enter a service name (e.g., “IOService”) as the Namespace value
Add these namespaces:
using System.ServiceModel;
using System.Net;
using System.Net.Security;
using System.Xml;
Add this code to create an IO client and to retrieve the IO version:
//get version of IO Service
void GetIoVersion()
{
IOService.OClient ioClient = GetIOServiceClient("add user name here", "add password here", "add io service
end point here e.g. https://ioServer:55443/hpio/chargeback/soap/v1");
string version = ioClient.getVersion();
}
//GetIOServiceClient function is used initialize and create client object to IO service
public IOService.OClient GetIOServiceClient(string userName, string password, string ioEndPoint)
{
BasicHttpBinding binding = new BasicHttpBinding();
binding.MaxBufferSize = 999999999;
binding.MaxBufferPoolSize = 524288;
binding.MaxReceivedMessageSize = 999999999;
binding.Name = "IOSoapBinding";
binding.AllowCookies = false;
binding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;
binding.TransferMode = TransferMode.Buffered;
binding.TextEncoding = System.Text.Encoding.UTF8;
binding.MessageEncoding = WSMessageEncoding.Text;
binding.UseDefaultWebProxy = true;
92 Sample VisualStudio/.NET/C# Client