Santosh Benjamin’s Weblog

October 23, 2008

VBUG Annual Conference 2008

Filed under: General — Tags: — santoshbenjamin @ 6:19 am

VBUG, a user group that I have been involved quite a bit with over the past few years is holding its 11th annual conference on Nov 4th and 5th. Check out their website for a full color brochure of the agenda and Craig Murphy has got a short summary of the topics on his blog as well.

Lots of good topics will be presented at the conference. By the way, (shameless plug coming next :-) ], guess who’s on the list of speakers? None other than yours truly. That’s right. I’m going to be speaking on “The Integration Landscape – BizTalk, WF and WCF“. Seeing as it comes right after the PDC, I’m hoping to present some info that will be hot off the PDC presses, let’s see how that works out.

The abstract for my session is below

Biztalk Server is Microsoft’s integration and BPM platform, WCF is the distributed communications platform for the future and WF has gained a lot of traction for implementing workflow based solutions. This raises interesting questions on whether the technologies are rivals or complementary. Do we have to choose? Can we use both together? If we do have to choose then what factors do we have to keep in mind when designing a solution? How can we leverage the WCF adapters in Biztalk 2006 R2 and where is Biztalk headed in future? In this session we will explore these issues and look at how we can leverage these technologies to build robust integration solutions. The session will include hands on demos of various integration points between Biztalk, WF and WCF. 

I’m currently at the Microsoft Services University at Redmond with a 109 MCS colleagues from all over the world and its been a great experience so far. I wont have much time to blog for the next couple of weeks and I will be going directly from this programme into the VBUG conference so its going to be really hectic but I’m looking forward to it.

If you are interested, i think spaces are still available so sign up at the site.

October 9, 2008

Service Oriented Modelling with DSL Tools

Filed under: Architecture, Factories, Tools — Tags: , , — santoshbenjamin @ 8:52 pm

I was sent a link to a mind blowing Channel 9 video on Service Oriented Modelling presented by Blair Shaw and Hatay Tuna. IMO, thats the most inspiring piece of kit i’ve seen so far. The work Hatay has put into it is fab. If you havent seen it , then do yourself a favor and take a look.

It demonstrates what can be done with the DSL tools and more importantly shows the kind of tooling that can be produced to support a proper SOA where services actually represent business capabilities rather than random little components dressed up with WSDL and pretty diagrams.

Key thing to remember though is that this is not a free tool. Its used by Microsoft Consulting Services as part of customer engagements. But even watching the video is highly educative on the steps to go from requirements and capabilities to service and technology models through to implementation and also highlights how it is possible to code-gen even WF activities to match the business process steps.

This is the kind of tool I dreamt of building in the past. (Yeah, i dream a lot :-)  . But seriously, while VS2005 had some of the basic foundations, we  didnt have the depth of tooling to make something like this possible and now we do. Of course MCS had the EFx software factory and eventually the DSL Tools matured to the extent where the Service Factory modeling edition could be delivered on it but this kit goes way beyond all that. The platfom its implemented on is VS2008/.NET 3.5, so I can well imagine what it could become on the VS2010/NET 4 platform.

Its only 30 mins or so and the quality of the video is very high (although the download is a bit heavy due to the quality).  Check it out. And while you’re there on Channel 9, take a look at the videos for VS 2010. There’s some really cool stuff there too.. Enjoy…

October 8, 2008

Creating Hosts with Powershell

Filed under: Biztalk, Biztalk Admin, Powershell — Tags: , , — santoshbenjamin @ 6:14 pm

[UPDATE]: The issue I had has now been solved. Please refer to the text below for the original issues as well as the solution

Context: Basically I was trying to write the powershell equivalent of the MSDN Article : Creating a Host using WMI

For the C# version of the sample here is the powershell equivalent
$putOptions = new-Object System.Management.PutOptions
$putOptions.Type = [System.Management.PutType]::CreateOnly;

[System.Management.ManagementClass]$objHostSettingClass = New-Object
System.Management.ManagementClass(“root\MicrosoftBizTalkServer”,”MSBTS_HostSetting”,$null)
[System.Management.ManagementObject]$objHostSetting = New-Object
System.Management.ManagementObject
$objHostSetting = $objHostSettingClass.CreateInstance()
$objHostSetting["Name"] = $hostName
$objHostSetting["HostType"] = $hostType
$objHostSetting["NTGroupName"] = $NTGroupName
$objHostSetting["AuthTrusted"] =$authTrusted
[System.Management.ManagementObject]($objHostSetting).Put(([System.Management.PutOptions]$putOptions));

This gives me the error
Exception calling “Put” with “1″ argument(s): “You cannot call a method on a
null-valued expression.”

If i try the VBscript version (PS equivalent) as shown below
 $objLocator = New-Object -ComObject “WbemScripting.SWbemLocator”
$objService = $objLocator.ConnectServer(“.”,”root/MicrosoftBizTalkServer”)
$objHostSetting = $objService.Get(“MSBTS_HostSetting”)
$objHS = $objHostSetting.SpawnInstance_
$objHS.HostName = $hostName
$objHS.HostType = $hostType
$objHS.NTGroupName = $NTGroupName
$objHS.AuthTrusted = $authTrusted
$objHS.Put(2)

Then i get an error saying : the property is read only (name, hosttype etc)

changing the assignment to the following

$objHS.Properties_.Item(“Name”).value = $hostName

does not work  either, saying

You cannot call a method on a null-valued expression.

SOLUTION

In the original post, I had said that I was going to try to solve the problem through Reflection and indeed that was the only way i could get it to work.

 

In the code (for the C#/PS equivalent) shown above , it appears that the line [$objHostSetting.Put($options)] is the offender. Although $objHostSetting gets initialised correctly and all properties get set, the Put method cannot be called on it. At the time of invocation it seems that PS thinks its null.

 

It was a very painful process (for a PS newbie) and the reflection equivalent isn’t an exact translation of the C# either. The Invoke() method requires an object[] in C# but in PS you just pass the actual object and it will work

 

PS Script 

function bts-host-create([string]$hostName, [int]$hostType, [string]$NTGroupName, [bool]$authTrusted)

{

       $putOptions = new-Object System.Management.PutOptions

       $putOptions.Type = [System.Management.PutType]::CreateOnly;

      

       [System.Management.ManagementClass]$objHostSettingClass = New-Object System.Management.ManagementClass(“root\MicrosoftBizTalkServer”,”MSBTS_HostSetting”,$null)

       [System.Management.ManagementObject]$objHostSetting = New-Object System.Management.ManagementObject

       $objHostSetting = $objHostSettingClass.CreateInstance()

      

      

       $objHostSetting["Name"] = $hostName

       $objHostSetting["HostType"] = $hostType

       $objHostSetting["NTGroupName"] = $NTGroupName

       $objHostSetting["AuthTrusted"] =$authTrusted

      

       [Type[]] $targetTypes = New-Object System.Type[] 1

       $targetTypes[0] = $putOptions.GetType()

 

       $sysMgmtAssemblyName = “System.Management”

       $sysMgmtAssembly = [System.Reflection.Assembly]::LoadWithPartialName($sysMgmtAssemblyName)

       $objHostSettingType = $sysMgmtAssembly.GetType(“System.Management.ManagementObject”)

      

       [Reflection.MethodInfo] $methodInfo = $objHostSettingType.GetMethod(“Put”,$targetTypes)

       $methodInfo.Invoke($objHostSetting,$putOptions)

      

       Write-Host “Successfully created host named:  $hostName”

      

 

}

Here’s the C# code

public static void CreateHostThroughReflection(string HostName, int HostType, string NTGroupName, bool AuthTrusted)

        {

            try

            {

                PutOptions options = new PutOptions();

                options.Type = PutType.CreateOnly;

 

                //create a ManagementClass object and spawn a ManagementObject instance

                ManagementClass objHostSettingClass = new ManagementClass(“root\\MicrosoftBizTalkServer”, “MSBTS_HostSetting”, null);

                ManagementObject objHostSetting = objHostSettingClass.CreateInstance();

 

                //set the properties for the Managementobject

                objHostSetting["Name"] = HostName;

                objHostSetting["HostType"] = HostType;

                objHostSetting["NTGroupName"] = NTGroupName;

                objHostSetting["AuthTrusted"] = AuthTrusted;

 

                Type[] targetTypes = new Type[1];

                targetTypes[0]= typeof(PutOptions);

 

                object[] parameters = new object[1];

                parameters[0] = options;

               

                Type objType = objHostSetting.GetType();

                MethodInfo mi = objType.GetMethod(“Put”,targetTypes);

                mi.Invoke(objHostSetting, parameters);

 

                //create the Managementobject

                //objHostSetting.Put(options);

                System.Console.WriteLine(“Host – ” + HostName + ” – has been created successfully”);

            }

            catch (ManagementException mex)

            {

                Console.WriteLine(“Management Exception ” + mex.Message);

            }

            catch (Exception excep)

            {

                System.Console.WriteLine(“CreateHost – ” + HostName + ” – failed: ” + excep.Message);

            }

        }

Notice that the “Invoke” is different in the PS and the C#. Also notice how convoluted the PS is when trying to do a simple object.GetType() , but i guess PS wasnt meant for this sort of thing anyway, so we cant complain.

Hope this helps someone. Do let me know if it does. Use the code for whatever you want but i dont provide support  :-)

WSCF Blue is now open

Filed under: Factories, Tools — Tags: , — santoshbenjamin @ 11:44 am

Christian Weyer has now announced that WSCF-Blue the code name for the  next version of WSCF – Web Services Contract First is now an open project on CodePlex and is looking for people to participate and take the lead on driving the tool forwards.

In case you havent come across it so far, WSCF is a really cool add-in which has a wizard that allows you to build a WSDL from a set of XSDs and then generate the ASMX for it. it also has a very good Data-Contract (pre WCF) code generator which i found to be much better than XSD.exe or XSDObjectGen and the data contract tool can be used over any XSD independently of the WSDLs.  It can also generate client side proxies. Overall the quality of the code it generates is very high. One of the key aims of WSCF Blue is to bring it into the WCF world.

I used WSCF extensively for ASMX services in my previous job as all our implementations were WSDL first. In fact we supplied clients with those WSDLs and then published Biztalk schema webservices and when taking care to use the “Bare” format in BTS, the clients didnt notice the difference at all when the implementations were ready.

In the forums, it appeared that people were clamoring for it to be open sourced  as the good folk at thinktecture havent had time to do as much with it as they had planned. I think its really good that they have opened it up now. The tool has great potential.

Some of the areas i think it can be extended are

  • Making it a full fledged GAT package
  • Linking it with the ServiceFactory – particularly as the SF lacks a WSDL import facility (although you can use prebuilt XSDs when defining your contracts)
  • maybe even linking into BizTalk :-)

I’m in but i cant lead it unfortunately as i have too many irons in the fire right now.

So if there are any takers for a lead role on this or to contribute please contact Christian Weyer.

[UPDATE]: Edward Bakker has now taken up the lead role on the project.

Blog at WordPress.com.