Highlighted
Absent Member.
Absent Member.
664 views

Service Manager - Closing Incident with C# and SOAP

Here is a snippet of code from a VS C# project that I have been working on. I am trying to create a program to close a ticket in HPSM. I've added all the required items to close this incident but am still unable to close it. Can anyone assist?

 

IncidentManagement is my Service Reference to the IncidentManagement.wsdl file.

 

 

BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly);

binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;

binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;

 

EndpointAddress address = new EndpointAddress("http://Server:Port/SM/7/ws");

 

IncidentManagement.IncidentManagementClient IM = new IncidentManagement.IncidentManagementClient(binding, address);

IM.ClientCredentials.UserName.UserName = "User";

IM.ClientCredentials.UserName.Password = "Pass";

 

IncidentManagement.CloseIncidentRequest request = new IncidentManagement.CloseIncidentRequest();

IncidentManagement.CloseIncidentResponse response = new IncidentManagement.CloseIncidentResponse();

request.model = new IncidentManagement.IncidentModelType();

request.model.keys = new IncidentManagement.IncidentKeysType();

request.model.instance = new IncidentManagement.IncidentInstanceType();

 

request.model.instance.IncidentID = new IncidentManagement.StringType();

request.model.instance.IncidentID.Value = "IM0000000";

request.model.instance.AssigneeName = new IncidentManagement.StringType();

request.model.instance.AssigneeName.Value = "ID";

request.model.instance.Service = new IncidentManagement.StringType();

request.model.instance.Service.Value = "Group";

request.model.instance.ClosureCode = new IncidentManagement.StringType();

request.model.instance.ClosureCode.Value = "Closed - Not Resolved";

request.model.instance.Resolution = new IncidentManagement.IncidentInstanceTypeResolution();

request.model.instance.Resolution.Resolution = new IncidentManagement.StringType[1];

request.model.instance.Resolution.Resolution[0] = new IncidentManagement.StringType();

request.model.instance.Resolution.Resolution[0].Value = "TEST";

request.model.instance.AffectedItem = new IncidentManagement.StringType();

request.model.instance.AffectedItem.Value = "CI";

request.model.instance.SolutionId = new IncidentManagement.StringType();

request.model.instance.SolutionId.Value = "KM00001";

try

{

request.model.keys.IncidentID = request.model.instance.IncidentID;

response = IM.CloseIncident(request);

}

catch (Exception ex)

{

MessageBox.Show(ex.Message);

}

}

 

0 Likes
1 Reply
Highlighted
Outstanding Contributor.. Outstanding Contributor..
Outstanding Contributor..

You've actually sent the SOAP call over to SM? What is the response/error you're receiving?

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.