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

//get the security node
XmlNode securityNode = headersNode.ChildNodes[1];
//change the timestamp token
securityNode.FirstChild.FirstChild.InnerText =
String.Format("{0:s}", DateTime.Now);
securityNode.FirstChild.LastChild.InnerText =
String.Format("{0:s}", DateTime.Now.AddMinutes(30));
//change the username token with username and password
securityNode.LastChild.FirstChild.InnerText = "administrator";
securityNode.LastChild.ChildNodes[1].InnerText = "password";
//save the timestamp token and the username token
xmlDoc.Save(
AppDomain.CurrentDomain.SetupInformation.ConfigurationFile);
//create object from the service proxy
IOService.OClient wcfClient = new IOService.OClient();
//Trust the certificate
ServicePointManager.ServerCertificateValidationCallback =
new RemoteCertificateValidationCallback(
delegate
{
return true;
});
//call the IO API and write the returned version
Console.WriteLine("The version: " + wcfClient.getVersion());
//call the IO API and write the returned template nnames
Console.WriteLine("The templates:");
IOService.TemplateInfo[] template = wcfClient.listTemplates();
for (int i = 0; i < template.Length; i++)
{
Console.WriteLine(template[i].name);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Open the app.config file and find the endpoint tag inside client tag:
<endpoint address=" "
binding="basicHttpBinding"
bindingConfiguration="IOSoapBinding"
contract="IOService.IO" name="IOSoapServicePort" >
// Paste the configurations in the following step here
</endpoint>
Insert this content inside the endpoint tag from the previous step:
<headers>
<wsa:Action xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
<wsa:To>https://127.0.0.1:51443/hpio/controller/soap/v3</wsa:To>
</wsa:Action>
<wsse:Security s:mustUnderstand="1"
xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsu:Timestamp xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsu:Created></wsu:Created>
<wsu:Expires></wsu:Expires>
</wsu:Timestamp>
<wsse:UsernameToken
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username></wsse:Username>
<wsse:Password
Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"></wsse:Password>
<wsse:Nonce></wsse:Nonce>
</wsse:UsernameToken>
57