Thursday, July 28, 2005

Going for a walkabout with - VB6, COM, COM+, Transactions and Indigo (Part 5 o f X)

To start off with a few examples, I’m going to be hosting the sample where I enable an COM+ Interface as a WAS/IIS hosted Indigo service.

To kick this off, you have to create a Virtual directory in IIS, which I have simply called “WAS_Hosted_Market”.

To Indigo Service enable an interface, you have to use the COMSvcConfig tool. While the tool does give you to enable all of the COM+ interfaces in one go, with a wildcard asterisk (“*”), I don’t think this is a good option to use, as you need to be explicit about what Interfaces you want to expose at the service boundary and determine which Interface (if any) are relevant. For example, the use of the wildcard asterisk (“*”) may attempt to expose system interfaces etc…. or others aspects that are not allowed .

For the sake of simplicity and just to get the ball running, I am going to use the “_COrders” interface that is in the “Market.COrders” component, which has only an “Add” method. In my opinion, in a real world application, I don’t think this would be a good method to exposed as an Indigo service operation at a Service Boundary, due to it being very CRUD like and also somewhat fine grained. I will use it for now due to its method signature, where all of the parameters are explicitly passed “ByVal”. This is important to note, as by default VB6 would implicitly pass values “ByRef” and therefore in a SO world, the implicit or explicit passing of Objects “ByRef” may not desirable or allowed.

To add the Interface, is as simple as the following (note that I have configure the COM+ app to be activated as a library application):

comsvcconfig /add application:market /interface:Market.COrders,_COrders /hosting:was /Webdirectory:root/WAS_Hosted_Market /MEX

and hey presto, you have 2 new files in the WAS_Hosted_Market virtual directory and  you will see that the following files were added, a web.config and a <class ID for COM+ interface explosed>.SVC. 

Since the MEX switch was used, you can browse to the service from your browser. The metadata publishing can be controlled/configured from the Web.Config, in the following section

<
behaviors>
      <behavior configurationName="ComServiceMexBehavior">
        <metadataPublishing enableGetWsdl="true" enableHelpPage="true"
          enableMetadataExchange="true" />
      </behavior>
</behaviors>

So when you browse to the file with the .SVC extension, e.g. http://localhost/WAS_Hosted_Market/23DF9857-7126-11D1-BDB2-00600807E871.svc/23DF9856-7126-11D1-BDB2-00600807E871, you will end up with the stanard help page.

And then to create a types proxy for the service  is simply a matter of using the SVCUtil and pointing it at the URI for the service.

VOILA!! a VB6 COM+ implementation consuming/producing WS-* on the wire, with ZERO code changes

Also, there are a few things I should call out:

– Because this example used the WAS inproc option (i.e. the COM+ applications activitaion is set to Library), the IIS 6 worker process  will be trying to load the typelib for the COM object and will fail due to the fact that it is running under the security context of a “Network Service”. So, you may have to give the “Network Service” account read permissions to the directory that contains the TLB.
– You can confirm that the VB code is running under the W3WP process in IIS, by looking in the component services manager and looking under running processes
– For an ES interface, the steps are almost the same, with the only additional step being that the assembly has to be in the GAC
– While the default binding is setup for you, i.e. WSProfile, you can use any standard (out of the box) binding or use a custom one. I haven’t tried all of them yet, but haven’t found one that breaks yet.
– SVCUtil only consumes MEX over HTTP at the moment, so that transport will have to be enabled.
– all of this is based on the Release Canidate of Beta 1. I haven’t gotton around to installing Beta 1 yet (opps)
– When you look at the default binding setup for you, it is configured to not allow Transaction context to flow, but this simple to change and is a matter of being explicit about what gets exposed

Overall pretty cool stuff and without any changes to the VB/COM implementation.
 

 – Paul

 

 

 


 |  |  |  |  |  |  |  | 
Thursday, July 28, 2005 4:19:23 PM UTC | # | Disclaimer | Comments [0] | Tracked by:
"re:Microsoft's - Connected Systems Division (CSD)" (红外热像仪) [Trackback]
"re:Microsoft's - Connected Systems Division (CSD)" (红外热像仪) [Trackback]
"Optimising Transactions that involve the DTC and only one DB?" (Paul Fallon's B... [Trackback]
"Followup to Irish Developer Network Event - Indigo for the COM, COM+ and MSMQ D... [Trackback]
"sissy maid training" (online) [Trackback]
"inca kola" (title) [Trackback]
"dorney park" (title) [Trackback]
"sewyn" (title) [Trackback]
"v.erasq.info" (v.erasq.info) [Trackback]
"edd.eradn.info" (edd.eradn.info) [Trackback]
"04b.dopazas" (04b.dopazas) [Trackback]
"9a2.hoperty" (9a2.hoperty) [Trackback]
"034.tisadof" (034.tisadof) [Trackback]
"b93.typodol.cn" (b93.typodol.cn) [Trackback]
"4c3.daybabla.cn" (4c3.daybabla.cn) [Trackback]
"bf2.nilash.cn" (bf2.nilash.cn) [Trackback]
"1c4.dopacitre.cn" (1c4.dopacitre.cn) [Trackback]
"69d.hoosew.cn" (69d.hoosew.cn) [Trackback]
"molonline" (molonline) [Trackback]
"zabl.html" (zabl.html) [Trackback]
"laac.html" (laac.html) [Trackback]
"eaaf.html" (eaaf.html) [Trackback]
"eaaq.html" (eaaq.html) [Trackback]
Comments are closed.