//public string Process(int id) //{ // //Create DiscoveryClient // DiscoveryClient discoveryClient = new DiscoveryClient(new UdpDiscoveryEndpoint()); // //Create the search criteria for the specified scope // FindCriteria findCriteria = new FindCriteria(typeof(IBilling)); // //Add discovery scopes // //findCriteria.Scopes.Add(new Uri("http://www.contoso.com/insurance")); // //findCriteria.Scopes.Add(new Uri("ldap:///ou=insurance,o=contoso,c=us")); // //findCriteria.ScopeMatchBy = FindCriteria.ScopeMatchByExact; // //Find BillingService endpoint // FindResponse findResponse = discoveryClient.Find(findCriteria); // if (findResponse.Endpoints.Count == 0) // return ""; // //Pick the first discovered endpoint // EndpointAddress address = findResponse.Endpoints[0].Address; // //Create the target service client // ChannelFactory<IBilling> factory = new ChannelFactory<IBilling>(new BasicHttpBinding(), address); // IBilling client = factory.CreateChannel(); // //Call the Billing Service // string status = client.ProcessClaim(id, findResponse.Endpoints.Count, address.Uri.AbsoluteUri); // factory.Close(); // //return a new status of the processed claim // return status; //} //public string RentCar(int id) //{ // //Check if the destination endpoint has been announced (discovered) yet // if (String.IsNullOrEmpty(MvcApplication.CarRentalEndpoint)) // return "No rental car"; // //Create the target service client // ChannelFactory<ICarRental> factory = new ChannelFactory<ICarRental>(new BasicHttpBinding(), MvcApplication.CarRentalEndpoint); // ICarRental client = factory.CreateChannel(); // //Call the Car Rental Service // string status = client.FindRentalCar(id); // factory.Close(); // //return a new status of the processed claim // return status; //} //public string Billing(int id) //{ // // Create a Discovery Endpoint that points to the proxy service. // Uri probeEndpointAddress = new Uri("net.tcp://localhost:9001/Probe"); // DiscoveryEndpoint discoveryEndpoint = new DiscoveryEndpoint( // new NetTcpBinding(), new EndpointAddress(probeEndpointAddress)); // // Create DiscoveryClient using the previously created discoveryEndpoint // DiscoveryClient managedDiscoveryClient = new DiscoveryClient(discoveryEndpoint); // // Find IChapter6Discovery endpoints // FindResponse findResponse = managedDiscoveryClient.Find(new FindCriteria(typeof(IBilling))); // if (findResponse.Endpoints.Count == 0) return ""; // // Pick the first discovered endpoint // EndpointAddress address = findResponse.Endpoints[0].Address; // //Create the target service client // ChannelFactory<IBilling> factory = new ChannelFactory<IBilling>(new BasicHttpBinding(), address); // IBilling client = factory.CreateChannel(); // //Call the Billing Service // string status = client.ProcessClaim(id, findResponse.Endpoints.Count, address.Uri.AbsoluteUri); // factory.Close(); // //return a new status of the processed claim // return status; //} /// <summary> /// /// </summary> /// <param name="claim"></param> /// <returns></returns> public bool ProcessClaim(Claim claim) { bool isSuccess = false; using (Claims.Web.ProcessClaim.WF.ProcessClaimServiceClient client = new Claims.Web.ProcessClaim.WF.ProcessClaimServiceClient("BasicHttpBinding_IProcessClaimService")) { //Invoke ProcessClaim Operation isSuccess = (bool)client.ProcessClaim(claim); } return(isSuccess); }
//public string Process(int id) //{ // //Create DiscoveryClient // DiscoveryClient discoveryClient = new DiscoveryClient(new UdpDiscoveryEndpoint()); // //Create the search criteria for the specified scope // FindCriteria findCriteria = new FindCriteria(typeof(IBilling)); // //Add discovery scopes // //findCriteria.Scopes.Add(new Uri("http://www.contoso.com/insurance")); // //findCriteria.Scopes.Add(new Uri("ldap:///ou=insurance,o=contoso,c=us")); // //findCriteria.ScopeMatchBy = FindCriteria.ScopeMatchByExact; // //Find BillingService endpoint // FindResponse findResponse = discoveryClient.Find(findCriteria); // if (findResponse.Endpoints.Count == 0) // return ""; // //Pick the first discovered endpoint // EndpointAddress address = findResponse.Endpoints[0].Address; // //Create the target service client // ChannelFactory<IBilling> factory = new ChannelFactory<IBilling>(new BasicHttpBinding(), address); // IBilling client = factory.CreateChannel(); // //Call the Billing Service // string status = client.ProcessClaim(id, findResponse.Endpoints.Count, address.Uri.AbsoluteUri); // factory.Close(); // //return a new status of the processed claim // return status; //} //public string RentCar(int id) //{ // //Check if the destination endpoint has been announced (discovered) yet // if (String.IsNullOrEmpty(MvcApplication.CarRentalEndpoint)) // return "No rental car"; // //Create the target service client // ChannelFactory<ICarRental> factory = new ChannelFactory<ICarRental>(new BasicHttpBinding(), MvcApplication.CarRentalEndpoint); // ICarRental client = factory.CreateChannel(); // //Call the Car Rental Service // string status = client.FindRentalCar(id); // factory.Close(); // //return a new status of the processed claim // return status; //} //public string Billing(int id) //{ // // Create a Discovery Endpoint that points to the proxy service. // Uri probeEndpointAddress = new Uri("net.tcp://localhost:9001/Probe"); // DiscoveryEndpoint discoveryEndpoint = new DiscoveryEndpoint( // new NetTcpBinding(), new EndpointAddress(probeEndpointAddress)); // // Create DiscoveryClient using the previously created discoveryEndpoint // DiscoveryClient managedDiscoveryClient = new DiscoveryClient(discoveryEndpoint); // // Find IChapter6Discovery endpoints // FindResponse findResponse = managedDiscoveryClient.Find(new FindCriteria(typeof(IBilling))); // if (findResponse.Endpoints.Count == 0) return ""; // // Pick the first discovered endpoint // EndpointAddress address = findResponse.Endpoints[0].Address; // //Create the target service client // ChannelFactory<IBilling> factory = new ChannelFactory<IBilling>(new BasicHttpBinding(), address); // IBilling client = factory.CreateChannel(); // //Call the Billing Service // string status = client.ProcessClaim(id, findResponse.Endpoints.Count, address.Uri.AbsoluteUri); // factory.Close(); // //return a new status of the processed claim // return status; //} /// <summary> /// /// </summary> /// <param name="claim"></param> /// <returns></returns> public bool ProcessClaim(Claim claim) { bool isSuccess = false; using (Claims.Web.ProcessClaim.WF.ProcessClaimServiceClient client = new Claims.Web.ProcessClaim.WF.ProcessClaimServiceClient("BasicHttpBinding_IProcessClaimService")) { //Invoke ProcessClaim Operation isSuccess = (bool) client.ProcessClaim(claim); } return isSuccess; }