Problem with custom CallExternalMethodActivity
I have successfully implement a local service allowing me to pass parameers into the workflow. Now I want the workflow to return data. I have created a custom activity derived from CallExternalMethodActivity. I have followed the example as outlined athttp://windowssdk.msdn.microsoft.com/en-us/library/ms734768.aspx.
I then added the custom activity to my workflow. I attempted to then bind the data property under the Properties of the activity. It is here when I receive an error.
Could not bind property "ReturnData".
Object of type "System.Workflow.ComponentModel.ActivityBind" cannot be converted to type "System.Collections.Specialized.IOrderedDictionary".
NOTE: it still creates the property binding in the workflow code. It simply will not allow me to bind it to the activity.
What am I doing wrong? I also found this error in another example I located on the web. I have included the code for my custom activity.
Thanks
Bill
[ToolboxItemAttribute(typeof(System.Workflow.ComponentModel.Design.ActivityToolboxItem))]
public partial class SendDataActivity : CallExternalMethodActivity
{
#region Constructors
public SendDataActivity()
{
base.InterfaceType = typeof(IRequestService);
base.MethodName = "SendData";
}
#endregion Constructors
#region Properties
public static DependencyProperty returnDataProperty = DependencyProperty.Register("returnData", typeof(IOrderedDictionary), typeof(SendDataActivity));
[System.ComponentModel.BrowsableAttribute(false)]
[System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
public override System.Type InterfaceType
{
get
{
return base.InterfaceType;
}
set
{
throw new System.InvalidOperationException("Cannot set InterfaceType on a derived CallExternalMethodActivity.");
}
}
[System.ComponentModel.BrowsableAttribute(false)]
[System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
public override string MethodName
{
get
{
return base.MethodName;
}
set
{
throw new System.InvalidOperationException("Cannot set MethodName on a derived CallExternalMethodActivity.");
}
}
[Editor()]
[TypeConverter(typeof(ActivityBindTypeConverter))]
[System.Workflow.ComponentModel.Compiler.ValidationOptionAttribute(System.Workflow.ComponentModel.Compiler.ValidationOption.Required)]
public IOrderedDictionary ReturnData
{
get
{
return ((IOrderedDictionary)(this.GetValue(SendDataActivity.returnDataProperty)));
}
set
{
this.SetValue(SendDataActivity.returnDataProperty, value);
}
}
#endregion Properties
#region Overriden Methods
protected override void OnMethodInvoking(System.EventArgs e)
{
this.ParameterBindings["returnData"].Value = this.ReturnData;
base.OnMethodInvoking(e);
}
#endregion Overriden Methods
}

