1

How can I kill or release session of hp service manager after retrieve data using wsdl call.

For Connection My code is here

      try
        {
            BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly);
            binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
            binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;
            EndpointAddress address = new EndpointAddress("*****");

            IncidentManagementClient IM = new IncidentManagementClient(binding, address);

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

            return IM;

        }

This code create session successfully but how can i release session after retrieve data from Service manager.

Please answer code in C#

Bilal Ahmed
  • 33
  • 1
  • 8

2 Answers2

0

Maybe wrap it in a using statement with the connection?

using(var client = new IncidentManagementClient ())
{

}

Since it disposes the connection at the end of the using statement

0

As in Kill some processes by .exe file name you can kill the sm process by the following:

foreach (var process in Process.GetProcessesByName("sm"))
{
    process.Kill();
}

But next time, the sm process will not be available and you have to start it. The web service will fail if you didn't started sm again.

Normally you should keep sm process running and don't care to kill it.

Omar
  • 11
  • 3