views:

33

answers:

0

Hello all and thanks for reading.

I am rather new to WF programming, so I apologize ahead of time if my question doesn't make sense.

I am attempting to code a custom workflow activity for use in SharePoint designer. So far I have gotten the designer to succesfully display my custom action, along with the dependency properties I have registered so far.

This custom action is going to be used to call web services, but I want the activity to work in a specific way. Rather than having the user know the URL of the service, along with the method name they would like to call, I want to dynamically update the designer UI with this data.

Ideally I'd call into the URL provided, retrieve the names of the methods the service exposes, and display them in a dropdown control for the user to select from.

I'd then append textboxes or another suitable control for the user to enter data for the corresponding properties after a method has been selected.

Right now the code I have looks as follows:

public sealed partial class CallWebService : Activity
{
    public CallWebService()
    {
        InitializeComponent();
    }

    public static DependencyProperty __ContextProperty = DependencyProperty.Register("__Context", typeof(WorkflowContext), typeof(CallWebService));

    [Description("Context")]
    [ValidationOption(ValidationOption.Required)]
    [Browsable(true)]
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
    public WorkflowContext __Context
    {
        get
        {
            return ((WorkflowContext)(base.GetValue(__ContextProperty)));
        }

        set
        {
            base.SetValue(__ContextProperty, value);
        }
    }

    public static DependencyProperty ServiceUrlProperty = DependencyProperty.Register("ServiceUrl", typeof(string), typeof(CallWebService), new PropertyMetadata();

    [Description("ServiceUrl")]
    [ValidationOption(ValidationOption.Required)]
    [Browsable(true)][Editor(typeof(TypeBrowserEditor), typeof(UITypeEditor))]
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
    public string ServiceUrl
    {
        get
        {
            return ((string)(base.GetValue(ServiceUrlProperty)));
        }

        set
        {
            base.SetValue(ServiceUrlProperty, value);
        }
    }

    public static DependencyProperty SOAPEnvProperty = DependencyProperty.Register("SOAPEnvelope", typeof(string), typeof(CallWebService));

    [Description("SOAPEnvelope")]
    [ValidationOption(ValidationOption.Required)]
    [Browsable(true)]
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
    public string SOAPEnvelope
    {
        get
        {
            return ((string)(base.GetValue(SOAPEnvProperty)));
        }

        set
        {
            base.SetValue(SOAPEnvProperty, value);
        }
    }



    public Guid workflowId = default(System.Guid);
    public SPWorkflowActivationProperties workflowProperties = new SPWorkflowActivationProperties();

    protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
    {
        ActivityExecutionStatus oStatus = ActivityExecutionStatus.Faulting;

        try
        {
            oStatus = ActivityExecutionStatus.Closed;
        }

        catch (Exception ex)
        {
            oStatus = ActivityExecutionStatus.Faulting;

            throw ex;
        }

        return oStatus;
    }
}

I'm not sure if I should be using dependency properties or not to store these values, since the user will be entering them anyway, however I'm still not clear as to whether or not the SharePoint designer controls can be bound to standard .NET properties or if they require a DependencyProperty.

Basically I need to tie into the ServiceURL property's value changed event handler so that I can validate the URL and retrieve the service's methods if they are avaliable.

Afterwards I need to append a new control to the UL which binds to another property that I can update with the avaliable methods, once they have been retrieved.

Does anyone have any idea how to do this?

Thank you for your time!