A Quick Start to A Quick Start to Developing Applications Developing Applications with with BiztalkBiztalk and VS.NETand VS.NET
Scott MatsumotoScott MatsumotoChief Technical OfficerChief Technical OfficerXtremesoft, Inc.Xtremesoft, Inc.
2Bizet and VS.Net QuickStart
Is Is BizetBizet a Requirement?a Requirement?
nn Officially Officially -- “Yes”“Yes”nn CoCo--installation is supported only on installation is supported only on BizetBizet
nn Anecdotal evidence from the field says “No”Anecdotal evidence from the field says “No”nn The MCS demo CD has BTS 2000 and VS.NETThe MCS demo CD has BTS 2000 and VS.NET
nn Anecdotal evidence from the field says “Yes”Anecdotal evidence from the field says “Yes”
nn Your mileage may varyYour mileage may vary
3Bizet and VS.Net QuickStart
Known IssuesKnown Issues
nn BTS Tracking Application fails because of “.BTS Tracking Application fails because of “.vbvb” ” mapping in IISmapping in IISnn Solution: Change Solution: Change connection.vbconnection.vb to to connection.vbsconnection.vbs
and fix all references in and fix all references in vbscriptsvbscripts\\
nn Orchestrations Don’t Compile (Orchestrations Don’t Compile (readme.htmreadme.htm))nn Solution: ToolsSolution: Tools\\OptionsOptions\\DebuggingDebugging\\JustJust--InIn--Time Time
and disable JIT debugging for “scripts”and disable JIT debugging for “scripts”
4Bizet and VS.Net QuickStart
I Know, It’s Only I Know, It’s Only InteropInterop, , But I Like ItBut I Like It
BizTalkBizTalknn Classic COM Classic COM
Programming APIsProgramming APIs
VS.NetVS.Netnn CLR CLR –– Managed CodeManaged Code
How do you spell R-C- W?
End of Formal Presentation
Questions?Questions?
6Bizet and VS.Net QuickStart
Who Who InteropsInterops with Whom?with Whom?
BizTalkBizTalknn COM Client COM Client InteropInteropnn Messaging CallingMessaging Calling
nn AICAICnn Custom PreCustom Pre--ProcessorProcessor
nn Orchestration CallingOrchestration Callingnn COM Component StencilCOM Component Stencil
.Net Framework.Net Frameworknn COM Server COM Server InteropInteropnn Call into MessagingCall into Messaging
nn Document SubmissionDocument Submissionnn AdminAdmin
nn Call into OrchestrationCall into Orchestrationnn Starting an OrchestrationStarting an Orchestration
7Bizet and VS.Net QuickStart
Scenario 1: Adding New Capabilities Scenario 1: Adding New Capabilities to an Existing Applicationto an Existing Application
nn You tell your boss You tell your boss -- “It’s just Visual Studio 7”“It’s just Visual Studio 7”
nn Write or rewrite BTM integration components Write or rewrite BTM integration components using VB (enhanced) or C#using VB (enhanced) or C#
nn Main difference is to build in use of Enterprise Main difference is to build in use of Enterprise Services (COM+)Services (COM+)
8Bizet and VS.Net QuickStart
Okay Okay –– So, It’s a CCW So, It’s a CCW IPipelineComponent
DemoCSAICs.SimpleAIC
9Bizet and VS.Net QuickStart
AIC SkeltonAIC Skeltonusing using System.EnterpriseServicesSystem.EnterpriseServices; ; using using System.Runtime.InteropServicesSystem.Runtime.InteropServices;;
using using Interop.MSCSCoreLibInterop.MSCSCoreLib;;using using Interop.PipeCompLibInterop.PipeCompLib;;
namespace namespace DemoCSAICsDemoCSAICs{{
[Guid(“11220B3A[Guid(“11220B3A--205B205B--3C8D3C8D--8AB58AB5--21ABD1397624")]21ABD1397624")]public class public class SimpleAICSimpleAIC : : ServicedComponentServicedComponent, , IPipelineComponentIPipelineComponent, …, …{{
intint IPipelineComponent.ExecuteIPipelineComponent.Execute(…)(…)
Runs as a configured component
Imported Commerce Server Core Components TypeLib
Imported Commerce Server Pipeline Component TypeLib
10Bizet and VS.Net QuickStart
Why Use Enterprise ServicesWhy Use Enterprise Services
nn Maximizes your flexibility for Maximizes your flexibility for inprocinproc vsvs outout--ofof--proc activationproc activationnn Tradeoff speed and fault isolationTradeoff speed and fault isolationnn Raw, configured components are almost as fast as Raw, configured components are almost as fast as
classic COMclassic COM
nn .Net requires the support for services to be .Net requires the support for services to be compiled incompiled in
11Bizet and VS.Net QuickStart
Assembly InformationAssembly Information
nn Use the Assembly to specific COM+ Use the Assembly to specific COM+ Application parametersApplication parameters
nn Use Use regsvcsregsvcs to register (create) the COM+ to register (create) the COM+ Application and componentsApplication and components
[assembly: [assembly: AssemblyDelaySign(falseAssemblyDelaySign(false)])][assembly: [assembly: AssemblyKeyFile(@"..AssemblyKeyFile(@"..\\....\\AICSign.snkAICSign.snk")]")][assembly: [assembly: AssemblyKeyNameAssemblyKeyName("")]("")]
[assembly: [assembly: ApplicationName("InteropingAICsApplicationName("InteropingAICs")]")][assembly: ApplicationID(“F5FDEC23[assembly: ApplicationID(“F5FDEC23--4A124A12--6D846D84--71647164--23145ECF526B")]23145ECF526B")][assembly: [assembly: Description(“CDescription(“C# Pipeline Component # Pipeline Component AICsAICs")]")]
COM+ requires strong naming
COM+ Setup Information
12Bizet and VS.Net QuickStart
One Fine One Fine LookinLookin’ COM+ App’ COM+ App
13Bizet and VS.Net QuickStart
Usage in BTMUsage in BTM
14Bizet and VS.Net QuickStart
GotchasGotchas
nn Be wary of Be wary of inetinfoinetinfonn it likes to hold on to your component it likes to hold on to your component dllsdlls (for the (for the
property pages) after you add them to BizTalkproperty pages) after you add them to BizTalk
nn COM Implemented CategoriesCOM Implemented Categoriesnn AICsAICs just workjust worknn PreProcessorPreProcessor components must be “dinked”components must be “dinked”
15Bizet and VS.Net QuickStart
Calling A Web Service from Calling A Web Service from OrchestrationOrchestration
Assembly
using System.EnterpriseServices;using System.Runtime.InteropServices;
class CallWS : ServicedComponent
DocSubmission ds = new DocSubmission();
ds.InvokeSked( "sked:///foo.skx" );
DocSubmission.CS
WSFlange.CS
16Bizet and VS.Net QuickStart
Scenario 2: Implementing the Front Scenario 2: Implementing the Front End Using ASP.NETEnd Using ASP.NET
nn You tell your boss You tell your boss –– “We’ll get better Web site “We’ll get better Web site performance” (the upgrade line didn’t work)performance” (the upgrade line didn’t work)
nn You’ve finally decided that You’ve finally decided that VARIANTsVARIANTs are evilare evil
nn You want all the benefits of Early BindingYou want all the benefits of Early Binding
17Bizet and VS.Net QuickStart
This Is A True RCWThis Is A True RCW
18Bizet and VS.Net QuickStart
Import the Import the TypeLibTypeLib Into the .NET Into the .NET AssembyAssemby
nn VS.NETVS.NETnn From the From the ProjectProject menu, select menu, select ReferencesReferences. . nn Select the Select the COMCOM tab. tab. nn Select the type library from the Select the type library from the Available Available
ReferencesReferences list, or browse for the TLB file. list, or browse for the TLB file.
nn Type Library Importer Type Library Importer nn c:c:\\>>tlbimptlbimp csiapi.tlbcsiapi.tlbnn Type library imported to Type library imported to BTSInterchangeLib.dllBTSInterchangeLib.dll
19Bizet and VS.Net QuickStart
ASP.NET ExampleASP.NET Exampleusing using BTSInterchangeLibBTSInterchangeLib;;……
public string public string SubmitSync(BIZTALK_OPENNESS_TYPESubmitSync(BIZTALK_OPENNESS_TYPE …)…){{
Interchange Interchange interchangeinterchange = new = new InterchangeClassInterchangeClass();();trytry{{
interchange.SubmitSyncinterchange.SubmitSync(…);(…);}}catch (Exception e)catch (Exception e)}}finallyfinally{{
Marshal.ReleaseComObject(interchangeMarshal.ReleaseComObject(interchange););}}
Invoke BizTalk Invoke BizTalk Interchange RCW Interchange RCW SubmitSyncSubmitSync methodmethod
CoCICoCI BizTalkBizTalk
pUnkpUnk-->Release();>Release();
20Bizet and VS.Net QuickStart
Just Below the SurfaceJust Below the Surface
nn BizTalkConfigBizTalkConfig objects return late bound ADO objects return late bound ADO record setsrecord sets
nn IDL for the COM IDL for the COM TypelibTypelib::
interface interface IBizTalkConfigIBizTalkConfig : : IDispatchIDispatch {{……[id(0x00000008), [id(0x00000008), propgetpropget, , helpstring("Returnshelpstring("Returns a set of messaging port objects.")]a set of messaging port objects.")]
HRESULT HRESULT Ports([outPorts([out, , retvalretval] ] IDispatchIDispatch** ** ppPortsDispppPortsDisp););
21Bizet and VS.Net QuickStart
Converting An ADO Converting An ADO RecordSetRecordSet to an to an ADO.NET ADO.NET DataSetDataSet
BTSObjectModelLib.BizTalkConfigBTSObjectModelLib.BizTalkConfig configconfig;;ADODB._RecordsetADODB._Recordset adoRSadoRS;;OleDbDataAdapterOleDbDataAdapter oledboledb;;
DataSetDataSet ports = new ports = new DataSetDataSet();();configconfig = new = new BTSObjectModelLib.BizTalkConfigClassBTSObjectModelLib.BizTalkConfigClass();();trytry{{
oledboledb = new = new OleDbDataAdapterOleDbDataAdapter();();adoRSadoRS = (= (ADODB._Recordset)BTConfig.PortsADODB._Recordset)BTConfig.Ports;;oledb.Fill(portsoledb.Fill(ports, , adoRSadoRS, “Ports");, “Ports");
}}catch(Exceptioncatch(Exception e)e){{
……}}finallyfinally{{
Marshal.ReleaseComObject(configMarshal.ReleaseComObject(config););}}
The returned data setThe returned data set
Make a copyMake a copy
QI for the ADO QI for the ADO Record Set from BTSRecord Set from BTS
22Bizet and VS.Net QuickStart
Working With OrchestrationsWorking With Orchestrations
nn Need to do the equivalent of Need to do the equivalent of CoGetObjectCoGetObject and and QueryInterfaceQueryInterface for the XLANG objectsfor the XLANG objects
nn TypeLibsTypeLibsnn SYSMGRLibSYSMGRLib –– SkedsMgr.dllSkedsMgr.dllnn COMRUNTIME COMRUNTIME –– SkedCore.dllSkedCore.dll
23Bizet and VS.Net QuickStart
Sample Sample SkedSkedNo Instantiation component reference
24Bizet and VS.Net QuickStart
Activating A Activating A SkedSked (Simple)(Simple)Object Object skedsked = null;= null;
skedsked = = Marshal.BindToMoniker(skedMonikerMarshal.BindToMoniker(skedMoniker););skedTypeskedType = = sked.GetTypesked.GetType();();
COMRUNTIME.IWFWorkflowInstanceCOMRUNTIME.IWFWorkflowInstance pSchedulepSchedule = = ((COMRUNTIME.IWFWorkflowInstanceCOMRUNTIME.IWFWorkflowInstance) ) skedsked;;
Object Object ActionPortActionPort = = pSchedule.get_PortpSchedule.get_Port( "( "AXSObjectPortAXSObjectPort" );" );ABT…ABT…Lib.IABTAlertNumActSkedsSkedLib.IABTAlertNumActSkedsSked piSkedpiSked = =
(ABT…(ABT…Lib.IABTAlertNumActSkedsSkedLib.IABTAlertNumActSkedsSked) ) ActionPortActionPort;;
piSked.SetObjectReferencepiSked.SetObjectReference(…);(…);
CoGetObjectCoGetObject of the of the skedsked monikermoniker
QI for the QI for the skedskedinstanceinstance
Get the initial Get the initial SkedSked Port Port and QI for the interface and QI for the interface it implementsit implements
Pass in the initial valuesPass in the initial values
25Bizet and VS.Net QuickStart
Implementing A Web Service Using Implementing A Web Service Using BizetBizet
nn We just did itWe just did it
nn Doing Business Transactions (Loosely Coupled, Doing Business Transactions (Loosely Coupled, Correlated Web Services Requests) is another Correlated Web Services Requests) is another topictopic
26Bizet and VS.Net QuickStart
Help Is ComingHelp Is Coming
nn Don’t ask me for my sample codeDon’t ask me for my sample code
nn Toolkit containing samples and helper classes Toolkit containing samples and helper classes from Microsoftfrom Microsoft
nn ETA ETA –– Sometime next weekSometime next week
nn Bug Mike Bug Mike –– not menot me
End of Formal Presentation
Questions?Questions?