• mwinkle.blog

    Orcas Beta 1 Samples (WF, WCF)


    Beta 1 samples have been posted.  In this release there are separate installs for WF and WCF (and the workflow services are in the WCF one, go figure!)


    From Laurence's blog:

    This is the only version of the new samples that works at this time. The version that comes with the VS Orcas Beta1 offline Help does not work.

    New samples in this release:

    WF Samples\Technologies\Rules And Conditions\Order Processing Policy

                WCF Technology Samples\Basic\Ajax

                WCF Technology Samples\Basic\Syndication

    WCF Technology Samples\Basic\WorkflowServices

    You can download the zip files through any of the samples.

    To setup and run the Orcas Beta1 samples:

    1. Setup:

    a. Check out the Setup Instructions for the Ajax, Syndication, and Workflow Services samples.

    i. Use the Setup scripts under the “OrcasSetup” dir in the downloaded WCF zip file. In contrast, the “Setup” dir includes the scripts necessary for the samples already released with WCF 3.0

    b. On Win2K3, if you see a plain text page when connecting to http://localhost/NetFx35Samples/service.svc, you need to run:

    “%SystemDrive%\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe” -i –enable

    "%WINDIR%\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" -i

    c. The WCF Samples setup script Setupvroot.bat will not run unless MSMQ is installed or the NetMsmqActivator service is disabled

    2. Ajax samples:

    a. For the Simple and Post Ajax service samples, you will need to completely refresh your session to be able to reload ClientPage.htm from one service to another as there is an issue with IE. Or simply rename ClientPage.htm in one of the samples

    3.  Workflow Services:

    a. WorkflowServiceUtility is a reference necessary to the CalculatorClient and DuplexWorkflowServices samples

    b. CalculatorClient is the client for both DurableService and StateMachineWorkflowService. Click on “C” to stop the session (it becomes red) before switching services

    c. The Conversations client is the window that has “Press enter to submit order”

    d. In DuplexWorkflowServices, only the ServiceHost and ClientHost projects need to be started

    Technorati Tags: , , ,
  • mwinkle.blog

    Hello World (WF Services) in Spanish


    I noticed on Matias' blog that Ezequiel posted a hello world tutorial in Spanish based on the March CTP.  

  • mwinkle.blog

    Dynamically Generating an Operation Contract in Orcas using WF


    This kicks off a set of posts where I'll be discussing some of the interesting features coming out in Orcas.

    I want to focus on this post on the Receive Activity, and a nice little feature in the designer that lets you create a contract on the fly, without having to drop into code and write a decorated interface.  This allows us to divide the world into two approaches:

    • One where I design my contract first, and then start creating a workflow to implement the operations on the contract.
    • Design my workflow first, and have it figure out the contract for me (this is what I will focus on in more detail)

    Designing a Contract First

    This is what most WCF folks will be familiar with:

    public interface IOrderProcessing

    bool SubmitOrder(Order order);

    Order[] GetOrders(int customerId);

    When I drop a receive activity onto a workflow, I can now import this contract:

    This will bring up a type chooser that lets me pick my service contract:

    This imports all of the details and we can see the the operation picker

    If we look at the activity properties we now see the parameters to the method.  The (ReturnValue) is the object that we need to return in the operation.  The order parameter is the message that is going to be passed when the method is called.  I can take that and bind that to values in my workflow or whatever I want to do with it.


    Designing a Workflow First

    The other approach we can take is to create the contract as we create the workflow.  That's right, we don't need to create the contract explicitly in code.  To do that, drop a receive activity onto the designer and double click.  Instead of selecting "Import Contract" select "Add Contract".  This will create a new contract with a basic operation.  By selecting the contract or the operation we can name it something a little nicer.

    By selecting the operation, I can customize all of its behavior.  I can create parameters to be passed in, I can set the types of those parameters (as well as the return type of the operation). 

    It's relevent to point out that I can select any type that would be valid in a WCF contract.  The drop down list displays the basic types, but by selecting "Browse Type" I am brought into a type picker where I can select custom types.  As you can see below I have created a "CancelOrder" operation that takes in an order, the reason and who authorized the cancellation.

    When I click ok, my activity has had new dependency properties added to it, as can be seen in the property grid for the activity.


    So what's happening here?

    In the workflow I created, I used a code separation workflow, so I have an .xoml file which contains the workflow definition.  Let's take a quick peek at how the receive activity is defined (note, some of the xml is truncated, if you view in an rss reader or copy and past you can see all the details, I'll work on updating the blog layout):

        <ns0:ReceiveActivity x:Name="receiveActivity2">
    <ns0:OperationInfo PrincipalPermissionRole="administrators" Name="CancelOrder" ContractName="MyContract">
    <ns0:OperationParameterInfo Attributes="Out, Retval" ParameterType="{x:Type p9:Boolean}" Name="(ReturnValue)" Position="-1" xmlns:p9="clr-namespace:System;Assembly=mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    <ns0:OperationParameterInfo Attributes="In" ParameterType="{x:Type p9:Order}" Name="order" Position="0" xmlns:p9="clr-namespace:WcfServiceLibrary1;Assembly=WcfServiceLibrary1, Version=, Culture=neutral, PublicKeyToken=null" />
    <ns0:OperationParameterInfo Attributes="In" ParameterType="{x:Type p9:String}" Name="reason" Position="1" xmlns:p9="clr-namespace:System;Assembly=mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    <ns0:OperationParameterInfo Attributes="In" ParameterType="{x:Type p9:String}" Name="authorizedBy" Position="2" xmlns:p9="clr-namespace:System;Assembly=mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

    Here you can see that within the metadata of the activity, we have the definition for the contract and the operation that I defined.  When we spin up a WorkflowServiceHost to host this workflow as a service, the host will inspect the metadata for the workflow, looking for all of the endpoints and will create them.  You can also see within the OperationInfo element that I am able to define the PrincipalPermissionRole defining the role of allowed callers, taking advantage of the static security checks which I will talk about in another post.  So, defined declaratively in the XAML is the contract for the operations.  I didn't need to write the interface or the contract explicitly, I was able to write a workflow, specifiy in the workflow how it will communicate and then let the WorkflowServiceHost figure out the nitty gritty details of how create the endpoints.  The other part here that is important to mention is that the config will play a part determining what the transport channel and other such details will be.  Within the config, when we set up an endpoint we need to specify the contract is "MyContract", or the name that we assigned when we created it.


    We talked about the way that we can implement contracts that already exist in a receive activity, as well as how we can use the designer to actually create our contract while we are designing the workflow.  The WorkflowServiceHost does the heavy lifting here in order to enable this little bit of nifty-ness.

  • mwinkle.blog

    So Many Cool Things Going On


    Just a quick summary:

    • Orcas Beta 1 is out
    • BPEL folks are looking for feedback
    •  labs.biztalk.net is live (Check out Clemens, Dennis and John's posts)
      • Maybe at MIX we can talk about how this might make things interesting?
      • I imagine that I will probably do more than a couple of samples based on this
    • I'll be at MIX next week and am looking forward to meeting up with anyone who is attending.  I'll be in the mashup's area and I'd love to see folks using WF to power some mashups.
  • mwinkle.blog

    Starting and Transacting


    Two quick links before I run back to my day job.

    • Paul posts a Web Workflow Starter Kit.  Check it out for a good sample on hosting in ASP.NET, managing workflow data, and doing a task that a lot of people immediately think of when they start thinking workflow.
    • Jason posts a really cool "Developer Meets Server" screencast showing how WCF transactions can be flowed in and down to the Transactional NTFS capabilities.  Run, don't walk, to check this thing out here.
  • mwinkle.blog

    Two Cool Technologies, One Great Solution


    My peer, David, has a great screencast posted on Channel9 that shows off a solution from FullArmor that incorporates WF and PowerShell and one really cool looking designer.

    On my list of cool things to check out when I have free time (currently June 2015) is PowerShell.  It's a great tool for devs to make their apps much more managable, by both devs and our dear friends, the IT Pro.  David has built some samples that build right on top of things to return collections of data in order to PowerShell enable them.

    Check it out here

Page 1 of 1 (6 items)