public bool CallCCSTransport(string boxId, string endDestId) { logger.Debug("calling CallCCSTransport"); // Getting Service Objects from Spring IApplicationContext ctx = ContextRegistry.GetContext(); IRoutingService routing = (IRoutingService)ctx.GetObject("routingServiceObjectWSBinding"); IMaterialMgtService materialMgt = (IMaterialMgtService)ctx.GetObject("materialMgtServiceObjectWSBinding"); //IConveyorControlService ccsService = (IConveyorControlService)ctx.GetObject("CCSServiceObjectWSBinding"); ICCSMockService ccsService = (ICCSMockService)ctx.GetObject("ccsMockServiceObjectWSBinding"); //duplex Context c = new Context(); wmsdbEntities entities = c.GetWMSEntities(); var query = from b in entities.Boxes where b.id == boxId select b; var boxes = query.ToList(); Box box = boxes.First(); string nextDestId = ""; string transportMedium = ""; nextDestId = routing.GetNextDestination(boxId, endDestId); if (string.IsNullOrEmpty(nextDestId)) { logger.Debug("the box is at location or error"); return(true); // null if error, empty if the box is already at the location } transportMedium = routing.GetNextTransportMedium(boxId); /* * ////////////////// EVENT-DRIVEN asynch call * CCSMockServiceClient cl = new CCSMockServiceClient(); // init client * cl.TransportCompleted += new EventHandler<TransportCompletedEventArgs>(TransportCallback); // add event handler to TransportCallback * cl.TransportAsync(boxId, transportMedium, box.location_id, nextDestId); // call Transport asynchronously * ////////////////// asynch call test end); */ ///////////////// CHANNEL FACTORY asynch call //// ccsService.Transport(boxId, box.location_id, nextDestId); //IAsyncResult arTransport = ccsService.BeginTransport(boxId, transportMedium, box.location_id, nextDestId, TransportCallback, ccsService); ccsService.Move(boxId, transportMedium, box.location_id, nextDestId); logger.Debug(string.Format("ASYNCHRONOUS CCS MOCK CALL! box_id = {0}, transportMedium = {1}; currentLocation = {2}, nextDestination = {3}", boxId, transportMedium, box.location_id, nextDestId)); //System.Threading.Thread.Sleep(2000); return(true); }