CheckScoreWorkflow Sample Appears to Return Wrong Answer
The CheckScoreWorkflow sample application from the .NET Services SDK (March 2009 CTP) is one of the simplest of the .NET Workflow Service samples and a good introductory sample for users not having experience with Workflow and the .NET Service Bus.
Update 5/24/2009: Found more (minor) typos in the Readme.htm file. See near the end of this post.
CheckScoreWorkflow.sln consists of three projects:
- CheckScoreWorkflow, a SequentialWorkflowProject class library which contains the CheckScoreWorkflow.xoml and CheckScoreWorkflow.rules files
- NotificationService, a console project which obtains an authentication token and receives notifications from the workflow via the NetEventRelay binding
- CheckScoreWorkflowDriver, a console project that obtains an authentication token, programmatically creates the workflow in the specified .NET Services solution, creates an instance of the workflow, starts the instance, and sends the student’s score to the workflow
Step 4 of the Readme.htm file’s “Run the workflow driver application” topic reads:
In this sample, the score element in the message is 78 which is greater than 50. Therefore, a passed message is going to be sent to the notification service. [Emphasis added.]
However, the score passed by the CheckScoreWorkflowDriver project’s Main() method is 45, not 78, so the resulting message is “Student passed = false,” as shown below:
The “Expected Output, Notification Service Output” section correctly shows:
>NotificationService.exe
Please enter your solution name: <SolutionName>
Please enter your solution password: ******
Service address: sb://<SolutionName>.servicebus.windows.net/Notify/
Press [Enter] to exit
Student passed = false.
Unfortunately, I didn’t read that far and spent a couple of hours attempting to track the “error.”
Changing
"<Test><StudentName>Charles</StudentName><Score>45</Score></Test>"
to
"<Test><StudentName>Charles</StudentName><Score>78</Score></Test>"
produces “Student passed = true”
There’s also a non-fatal typo in the FailureNotification IfElse condition name as shown below:
Update 5/24/2009: Found more (minor) typos in the Readme.htm file’s “Sample Description” section:
1. Notification Service
The notification service is a WCF Service listening to a Service Bus event using the netEventRelay binding. The contract is defined in NotificationContract.cs and the name space is http://samples.windows.net/notification/. The service is defined in NotifyService.cs. The service is listening the URI sb://<SolutionName>.servicebus.windows.net/Notify/
The contract is defined in NotifyContract.cs.
Comment: “[T]he name space is http://samples.windows.net/notification/.” is ambiguous; that’s the service’s namespace. The NotificationService project’s namespace is Notify.
In the same section:
2. CheckScoreWorkflowDriver
This is the console application that is creating, managing and communicating with the CheckScoreWorkflow. The application will send an http message to the CheckScoreWorkflow and displays the return response. The message will contain a student Id and a score.
The message contains a student name and the (wrong) score.
In the same section:
3. CheckScoreWorkflow
- 4. SuccessNotification: send a message to the NotificationService via the Service Bus indicating success (score>=50)
The ScoreGreaterThan50 IfElseBranchExpression expression is int.Parse(((Microsoft.Workflow.Activities.CloudXPathRead)this.GetActivityByName("ReadScore")).OutReadValue) > 50. Score =50 fails.
The samples folks should consider engaging a professional proofreader or editor for the next CTP.
Philip Richardson, a lead program manager for .NET Services, posted Utilizing the Service Bus in Windows Azure on 5/23/2009. His tutorial focuses on two basic scenarios:
- Service Bus Client in a Windows Azure Web or Worker Role
- Service Bus Listener in a Windows Azure Worker Role,
uses the NetTcpRelayBinding and isn’t directly related to .NET Workflow Services.
Question: Has anyone been able to get the WatchdogWorkflow.sln sample to work? All my attempts with sb://ChatRooms.servicebus.windows.net/watchdog/MulticastService/ have failed so far. Please reply in a comment or to roger_jennings@compuserve.com.
0 comments:
Post a Comment