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

binding.BypassProxyOnLocal = false;
binding.Security.Mode = BasicHttpSecurityMode.Transport;
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.None;
binding.Security.Transport.Realm = "";
binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;
binding.Security.Message.AlgorithmSuite = System.ServiceModel.Security.SecurityAlgorithmSuite.Default;
binding.CloseTimeout = new TimeSpan(00, 01, 00);
binding.OpenTimeout = new TimeSpan(00, 01, 00);
binding.ReceiveTimeout = new TimeSpan(00, 10, 00);
binding.SendTimeout = new TimeSpan(00, 01, 00);
binding.ReaderQuotas.MaxDepth = 32;
binding.ReaderQuotas.MaxStringContentLength = 8192;
binding.ReaderQuotas.MaxArrayLength = 16384;
binding.ReaderQuotas.MaxBytesPerRead = 4096;
binding.ReaderQuotas.MaxNameTableCharCount = 16384;
string strXml =
@"<wsa:EndpointReference xmlns:wsa=""http://www.w3.org/2005/08/addressing"">
<wsa:Address>@server</wsa:Address>
<wsa:ReferenceParameters>
<wsse:Security s:mustUnderstand=""1""
xmlns:wsse=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd""
xmlns:s=""http://schemas.xmlsoap.org/soap/envelope/"">
<wsu:Timestamp wsu:Id=""Timestamp-02be6222-d34d-4c19-bb35-f4e98cc18534""
xmlns:wsu=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"">
<wsu:Created>@date_create</wsu:Created>
<wsu:Expires>@date_expire</wsu:Expires>
</wsu:Timestamp>
<wsse:UsernameToken>
<wsse:Username>@username</wsse:Username>
<wsse:Password
Type=""http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"">@password</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</wsa:ReferenceParameters>
</wsa:EndpointReference>";
DateTime dt = DateTime.Now.ToUniversalTime();
strXml = strXml.Replace("@server", ioEndPoint)
.Replace("@username", userName)
.Replace("@password", password)
.Replace("@date_create", dt.ToString("s"))
.Replace("@date_expire", dt.AddDays(1).ToString("s"));
XmlReader xr = XmlReader.Create(new StringReader(strXml));
EndpointAddress endpointFromXml =
EndpointAddress.ReadFrom(System.ServiceModel.Channels.AddressingVersion.WSAddressing10, xr);
IOService.OClient oClient = new IOService.OClient(binding, endpointFromXml);
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(
delegate
{
return true;
});
return oClient;
}
NOTE: The Timestamp and UsernameToken values are intentionally left blank here. They are set
dynamically by the C# code.
Modify the wsa:To value inserted in the previous step to specify the target system IP address
or hostname.
Compile and run.
93