Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
IncidentManagementClient IM = Connection.Connect();


My Logic here works fine.

 response = IM.RetrieveIncidentKeysList(request);
IM.Abort(); 
return response;


What I have tried:

After Getting response i want to kill or dispose or release session form Service manager application but they didn't work. can you help me.
Posted
Updated 5-Mar-18 9:01am

Normally you would close a connection with in your case "IM.Close()" IM.Abort() is used when for some reason the connection is faulted. Also it is better to use connections like this within a Try..Catch block
 
Share this answer
 
try
                {
                    
                    RetrieveIncidentKeysListResponse response = new 
                    RetrieveIncidentKeysListResponse();
                    RetrieveIncidentKeysListRequest request = new 
                    RetrieveIncidentKeysListRequest();
                    request.model = new IncidentModelType();
                    request.model.keys = new IncidentKeysType();
                    request.model.instance = new IncidentInstanceType(); 
                    request.model.instance.IMTicketStatus = new 
                    ServiceReference1.StringType();
                    request.model.instance.IMTicketStatus.Value = "Open";
                    request.model.instance.OutageFlag = new 
                    ServiceReference1.BooleanType();
                    request.model.instance.OutageFlag.Value = true;
                    request.model.instance.Domain = new ServiceReference1.StringType();
                    request.model.instance.Domain.Value = "MMnBB"; 

                    response = IM.RetrieveIncidentKeysList(request); 
                    return response;
                }
                catch (Exception ex)
                {
                    string Text3Write = "Problem Occurred With Incident Data Retrieval 
                    Based on DB rules";

                    using (StreamWriter sw = File.AppendText(path))
                    {
                        sw.WriteLine(Text3Write);
                        sw.WriteLine("Exception Occurred :" + ex.ToString());
                    }
                }


Here is my code in try and catch :) but IM.Close(); not working here they behave like abort(); i don't know why ?
 
Share this answer
 
Comments
mvdk72 6-Mar-18 3:39am    
Do you close the connection within the Try block? And if so what exception is generated? That could give you a clue on what is happening and maybe why
Bilal Ahmed 7-Mar-18 0:45am    
Problem Occurred With Incident Data Retrieval Based on DB rules
Exception Occurred :System.ServiceModel.Security.MessageSecurityException: The HTTP request is unauthorized with client authentication scheme 'Basic'. The authentication header received from the server was 'Basic realm="CASM"'. ---> System.Net.WebException: The remote server returned an error: (401) Unauthorized.
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
--- End of inner exception stack trace ---


This is Exception generated
mvdk72 8-Mar-18 3:29am    
You have a security issue apparently. Something is wrong in the binding between Client and Server. Client is not Authorized to request the data. So next step is to investigate the requirements on Server-side and make sure that client-side meets those demands (Could be a username/password or maybe a client certificate)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900