protected override WorkflowCreationContext OnGetCreationContext(object[] inputs, OperationContext operationContext, Guid instanceId, WorkflowHostingResponseContext responseContext) { WorkflowCreationContext creationContext = new WorkflowCreationContext(); creationContext.CreateOnly = true; if (operationContext.IncomingMessageHeaders.Action.EndsWith("Create")) { Dictionary<string, object> arguments = (Dictionary<string, object>)inputs[0]; if (arguments != null && arguments.Count > 0) { foreach (KeyValuePair<string, object> pair in arguments) { creationContext.WorkflowArguments.Add(pair.Key, pair.Value); } } responseContext.SendResponse(instanceId, null); } else if (operationContext.IncomingMessageHeaders.Action.EndsWith("CreateWithInstanceId")) { Dictionary<string, object> arguments = (Dictionary<string, object>)inputs[0]; if (arguments != null && arguments.Count > 0) { foreach (KeyValuePair<string, object> pair in arguments) { creationContext.WorkflowArguments.Add(pair.Key, pair.Value); } } } else { throw new InvalidOperationException("Invalid Action: " + operationContext.IncomingMessageHeaders.Action); } return creationContext; }
private GetResponseAsyncResult(WorkflowHostingResponseContext context, TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state) { this.context = context; if (context.responseWaitHandle.WaitAsync(handleEndWait, this, timeout)) { base.Complete(true); } }
protected override WorkflowCreationContext OnGetCreationContext(object[] inputs, OperationContext operationContext, Guid instanceId, WorkflowHostingResponseContext responseContext) { if(!operationContext.IncomingMessageHeaders.Action.EndsWith("Ask")) { throw new InvalidOperationException(); } EnterpriseWorkflowCreationContext workflowCreationContext = new EnterpriseWorkflowCreationContext(); string question = inputs[0] as string; string email = inputs[1] as string; workflowCreationContext.WorkflowArguments.Add("Question", question); workflowCreationContext.Email = email; responseContext.SendResponse(instanceId, null); return workflowCreationContext; }
/// <summary> /// Override to create a new<see cref="T:System.ServiceModel.Activities.WorkflowCreationContext" /> instance. /// </summary> /// <param name="inputs">The inputs to the service operation.</param> /// <param name="operationContext">Provides the execution context of the service operation invoked.</param> /// <param name="instanceId">The instance ID of the workflow instance being created.</param> /// <param name="responseContext">The <see cref="T:System.ServiceModel.Activities.WorkflowHostingEndpointResponseContext" /> object that can be used to send replies back to the message source for a request/reply contract.</param> /// <returns>A workflow creation context object.</returns> /// <exception cref="InvalidOperationException">Invalid Action: + operationContext.IncomingMessageHeaders.Action</exception> protected override WorkflowCreationContext OnGetCreationContext(object[] inputs, OperationContext operationContext, Guid instanceId, WorkflowHostingResponseContext responseContext) { var creationContext = new WorkflowCreationContext(); var action = operationContext.IncomingMessageHeaders.Action; if (action.EndsWith("Create")) { PopulateContextArguments(inputs, creationContext); responseContext.SendResponse(instanceId, null); } else if (action.EndsWith("CreateWithInstanceId")) { PopulateContextArguments(inputs, creationContext); } else { throw new InvalidOperationException("Invalid Action: " + action); } return creationContext; }
protected internal override Bookmark OnResolveBookmark(WorkflowOperationContext context, out BookmarkScope bookmarkScope, out object value) { CorrelationMessageProperty property; if (CorrelationMessageProperty.TryGet(context.OperationContext.IncomingMessageProperties, out property)) { bookmarkScope = new BookmarkScope(property.CorrelationKey.Value); } else { bookmarkScope = null; } WorkflowHostingResponseContext responseContext = new WorkflowHostingResponseContext(context); Bookmark bookmark = this.hostingEndpoint.OnResolveBookmark(context.Inputs, context.OperationContext, responseContext, out value); if (bookmark == null) { throw System.ServiceModel.Activities.FxTrace.Exception.AsError(WorkflowHostingEndpoint.CreateDispatchFaultException()); } return(bookmark); }
protected internal override Bookmark OnResolveBookmark(WorkflowOperationContext context, out BookmarkScope bookmarkScope, out object value) { CorrelationMessageProperty correlationMessageProperty; if (CorrelationMessageProperty.TryGet(context.OperationContext.IncomingMessageProperties, out correlationMessageProperty)) { bookmarkScope = new BookmarkScope(correlationMessageProperty.CorrelationKey.Value); } else { bookmarkScope = null; } WorkflowHostingResponseContext responseContext = new WorkflowHostingResponseContext(context); Fx.Assert(context.ServiceEndpoint is WorkflowHostingEndpoint, "serviceEnpoint must be of WorkflowHostingEndpoint type!"); Bookmark bookmark = ((WorkflowHostingEndpoint)context.ServiceEndpoint).OnResolveBookmark(context.Inputs, context.OperationContext, responseContext, out value); if (bookmark == null) { throw FxTrace.Exception.AsError(CreateDispatchFaultException()); } return(bookmark); }
protected internal virtual Bookmark OnResolveBookmark(object[] inputs, OperationContext operationContext, WorkflowHostingResponseContext responseContext, out object value) { value = null; return null; }
protected internal virtual WorkflowCreationContext OnGetCreationContext( object[] inputs, OperationContext operationContext, Guid instanceId, WorkflowHostingResponseContext responseContext) { return null; }
protected internal override Bookmark OnResolveBookmark(WorkflowOperationContext context, out BookmarkScope bookmarkScope, out object value) { CorrelationMessageProperty correlationMessageProperty; if (CorrelationMessageProperty.TryGet(context.OperationContext.IncomingMessageProperties, out correlationMessageProperty)) { bookmarkScope = new BookmarkScope(correlationMessageProperty.CorrelationKey.Value); } else { bookmarkScope = null; } WorkflowHostingResponseContext responseContext = new WorkflowHostingResponseContext(context); Fx.Assert(context.ServiceEndpoint is WorkflowHostingEndpoint, "serviceEnpoint must be of WorkflowHostingEndpoint type!"); Bookmark bookmark = ((WorkflowHostingEndpoint)context.ServiceEndpoint).OnResolveBookmark(context.Inputs, context.OperationContext, responseContext, out value); if (bookmark == null) { throw FxTrace.Exception.AsError(CreateDispatchFaultException()); } return bookmark; }
protected internal override Bookmark OnResolveBookmark(WorkflowOperationContext context, out BookmarkScope bookmarkScope, out object value) { CorrelationMessageProperty property; if (CorrelationMessageProperty.TryGet(context.OperationContext.IncomingMessageProperties, out property)) { bookmarkScope = new BookmarkScope(property.CorrelationKey.Value); } else { bookmarkScope = null; } WorkflowHostingResponseContext responseContext = new WorkflowHostingResponseContext(context); Bookmark bookmark = this.hostingEndpoint.OnResolveBookmark(context.Inputs, context.OperationContext, responseContext, out value); if (bookmark == null) { throw System.ServiceModel.Activities.FxTrace.Exception.AsError(WorkflowHostingEndpoint.CreateDispatchFaultException()); } return bookmark; }
protected internal virtual Bookmark OnResolveBookmark(object[] inputs, OperationContext operationContext, WorkflowHostingResponseContext responseContext, out object value) { value = null; return(null); }
protected internal virtual WorkflowCreationContext OnGetCreationContext(object[] inputs, OperationContext operationContext, Guid instanceId, WorkflowHostingResponseContext responseContext) { return(null); }
public static WorkflowHostingResponseContext.GetResponseAsyncResult Create(WorkflowHostingResponseContext context, TimeSpan timeout, AsyncCallback callback, object state) { return new WorkflowHostingResponseContext.GetResponseAsyncResult(context, timeout, callback, state); }
public static GetResponseAsyncResult Create(WorkflowHostingResponseContext context, TimeSpan timeout, AsyncCallback callback, object state) { return(new GetResponseAsyncResult(context, timeout, callback, state)); }
protected override System.Activities.Bookmark OnResolveBookmark(object[] inputs, OperationContext operationContext, WorkflowHostingResponseContext responseContext, out object value) { Bookmark bookmark = null; value = null; if (operationContext.IncomingMessageHeaders.Action.EndsWith("ResumeBookmark")) { //bookmark name supplied by client as input to IWorkflowCreation.ResumeBookmark bookmark = new Bookmark((string)inputs[1]); //value supplied by client as argument to IWorkflowCreation.ResumeBookmark value = (string) inputs[2]; } else { throw new NotImplementedException(operationContext.IncomingMessageHeaders.Action); } return bookmark; }