protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) { if (executionContext == null) { throw new ArgumentNullException("executionContext"); } if (this.Fault == null) { throw new InvalidOperationException(SR.GetString(CultureInfo.CurrentCulture, "Error_PropertyNotSet", new object[] { FaultProperty.Name })); } WorkflowQueuingService service = executionContext.GetService <WorkflowQueuingService>(); base.RaiseEvent(SendingFaultEvent, this, EventArgs.Empty); WebServiceInputActivity activityByName = base.GetActivityByName(this.InputActivityName) as WebServiceInputActivity; IComparable queueName = new EventQueueName(activityByName.InterfaceType, activityByName.MethodName, activityByName.QualifiedName); IMethodResponseMessage message = null; WorkflowQueue workflowQueue = service.GetWorkflowQueue(queueName); if (workflowQueue.Count != 0) { message = workflowQueue.Dequeue() as IMethodResponseMessage; } message.SendException(this.Fault); return(ActivityExecutionStatus.Closed); }
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) { if (executionContext == null) { throw new ArgumentNullException("executionContext"); } if (this.Fault == null) { throw new InvalidOperationException(SR.GetString(CultureInfo.CurrentCulture, SR.Error_PropertyNotSet, FaultProperty.Name)); } WorkflowQueuingService queueService = executionContext.GetService <WorkflowQueuingService>(); // fire event this.RaiseEvent(WebServiceFaultActivity.SendingFaultEvent, this, EventArgs.Empty); WebServiceInputActivity webservicereceive = this.GetActivityByName(this.InputActivityName) as WebServiceInputActivity; IComparable queueId = new EventQueueName(webservicereceive.InterfaceType, webservicereceive.MethodName, webservicereceive.QualifiedName); Debug.Assert(queueService.Exists(queueId)); IMethodResponseMessage responseMessage = null; WorkflowQueue queue = queueService.GetWorkflowQueue(queueId); if (queue.Count != 0) { responseMessage = queue.Dequeue() as IMethodResponseMessage; } System.Diagnostics.Debug.Assert(responseMessage != null); // populate exception & reset the waiting thread responseMessage.SendException(this.Fault); return(ActivityExecutionStatus.Closed); }