| By Thomas Abraham | Article Rating: |
|
| August 19, 2008 10:15 AM EDT | Reads: |
4,960 |
- Create a BizTalk project to hold our artifacts
- Create XML Schemas to represent data structures
- Create XML Schemas to represent service operation messages
- Create simple orchestrations to carry out the service operations
- Publish the service as a Web Service using WCF
- Publish the service as a TCP endpoint
Step 1: Create a BizTalk project
I normally recommend creating separate BizTalk projects to hold maps, orchestrations, schemas, etc., but for this example we'll just create a single BizTalk project called BankAccountService. It will hold a number of XML Schema files and two orchestration files.
First, since assemblies for BizTalk are placed in the Global Assembly Cache (GAC), we need to create a strong-name key file:
- In Windows Explorer, create a folder to hold the service project files.
- From the Start menu, locate and expand the "Microsoft Visual Studio 2005" folder then expand the "Visual Studio Tools" folder and choose "Visual Studio 2005 Command Prompt."
- Change the current directory to the one that you created in Step 1 (cd "<folder path>").
- Create a new key file using the sn.exe utility (sn -k BankAccountService.snk).
Next, we can create the project and get started:
- Start up Visual Studio 2005
- From the File menu, choose New then choose Project. Locate and select "BizTalk Projects," "Empty BizTalk Server Project."
- Type "BankAccountService" into the Name textbox and specify the location for the service project files in the Location textbox (the folder created earlier).
- When you're comfortable with the selected settings, click the OK button to create a new solution file and the BankAccountService BizTalk project.
- Right-click the BankAccountService project in the Solution Explorer and choose Properties, then expand the "Configuration Properties," "Deployment" tree node.
- Select "All Configurations" from the Configuration drop-down at the top of the dialog box.
- Type "BankAccountService" into the "Application Name" textbox. When we deploy the application, this will create a new BizTalk application - a container for schemas, ports, orchestrations, etc. - for our service.
- Expand the "Common Properties," "Assembly" tree node and locate the "Assembly Key File" setting in the properties grid. Click the "..." button and browse to and select the BankAccountService.snk file that you created earlier. Click the Open button to select the key file. This will cause our assembly to be strong-named at compile-time.
- Finally, click OK to close the Properties dialog box. Build the solution with the Build menu, "Build Solution" menu item, and verify that the build was successful.
Step 2: Create XML Schemas to represent data structures
One of the big benefits of contract-first design is that it forces you to consider the data structures and patterns of interaction with the service right out of the gate. In our banking scenario, we will focus on the simple situations of putting money into an account or taking it out and retrieval of basic customer data. As in object-oriented design, we can readily identify a couple of entities relevant to our scenario: Customer and Account. In this case, these entities will be data structures defined in XSD as having no behavior, similar to "data transfer objects" in coding terms.
Let's go ahead and create our Account entity schema:
- With the BankAccountService solution open, right-click the BankAccountService project and choose the Add menu then "New Item..." Select the "Schema Files" tree node and then the "Schema" item in the right-hand pane. Type the name "Account.xsd" in the Name textbox then click the Add button to create the schema file.
- The new schema file opens automatically in the BizTalk Editor, an XML Schema editor. In most cases you will want to customize the target namespace, but for this example we will keep the default of "http://BankAccountService.Account."
- In the left-hand pane of the Editor, select the default root node called "Root." Press F2 to enter editing mode, and type the new node name "Account", then press Enter.
- Now let's add some data structures to the Account. Right-click the Account node and select the "Insert Schema Node," "Child Field Element" menu item. The new node appears already in edit mode, so just type the name "AccountNumber" and press Enter. We will keep the default data type of xs:string, which you can see in the Properties grid (right-click the AccountNumber node and select Properties).
- Repeat the steps in Step 4 to add another element called "AccountType."
That's enough for our very simple Account. Now let's create our Customer entity schema. Follow Steps 1-4 again using the file name "Customer.xsd," root node name "Customer," and child field elements "CustomerID" and "LastName."
For our demo, we don't need any more detail. You may be wondering why we're even creating these schemas for so few data elements. Imagine enhancing the service with a full implementation of customer and account retrieval. These operations would use these same entity schemas, but would add many additional data elements such as AccountName, Balance, MailingAddress, and so on. Eventually you'd fill out these skinny schemas into full-blown entities with dozens of data elements.
At this point we've defined the layout of elements Account and Customer, with the specific sequences of child elements nested within. This is represented in the XSD as an <xs:element> node with an <xs:complexType> node nested within. We would prefer to make these structure definitions into reusable types so that we can easily create new elements with the same structures. This is equivalent in code to creating a class called Account or Customer and then creating multiple strongly typed instances of it.
To convert our new Account definition to a reusable type:
- Select the Account node.
- In the Properties window you will find a list of properties that apply to the entire element. Locate the property named "Data Structure Type." By default it has no value.
- Enter the name "Account" in the "Data Structure Type" value and press Enter.
- Now, if you observe the schema definition you will find that the entire <xs:complexType> that defines the structure of Account is no longer nested, but is a peer to the <xs:element> node. The <xs:element> node now contains a "type" attribute that references the complex type (also called Account). The Account type is now easily reusable by other schemas.
Repeat these four steps to make the Customer type reusable. Finally, build the solution with the Build menu, "Build Solution" menu item, and verify that the build was successful.
Published August 19, 2008 Reads 4,960
Copyright © 2008 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Thomas Abraham
Thomas Abraham, MCPD, MCT, is an Enterprise Consultant with Minneapolis, MN-based management and technology consulting firm Digineer (www.digineer.com). Thomas maintains a blog at http://blogs.digineer.com/blogs/tabraham.
- The Top 150 Players in Cloud Computing
- Commercial vs Federal Cloud Computing
- Why IBM’s Server Chief Got Busted
- Industry Experts Discuss the State of Cloud Computing
- Cloud Expo New York Call for Papers Now Open
- Cloud Computing on Gartner's Top 10 List and SYS-CON Events' 2010 Calendar
- US Federal Government is Major Cloud Computing Innovator
- Google Wave
- Ulitzer.com Named Exclusive "New Media" Sponsor of Cloud Computing Conference & Expo
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- Adaptivity & Cloud Computing: Exclusive Q&A with CEO Tony Bishop
- 4th International Cloud Expo: Photo Album
- The Top 150 Players in Cloud Computing
- SYS-CON.TV: Cloud Computing Expo Power Panel
- Commercial vs Federal Cloud Computing
- Why IBM’s Server Chief Got Busted
- 1st Annual GovIT Expo: Letter from the Technical Chair
- Industry Experts Discuss the State of Cloud Computing
- Deputy CIO of the CIA to Keynote 1st Annual GovIT Expo
- SOA World Power Panel on SYS-CON.TV
- CIA was Headed to an Enterprise Cloud All Along: Jill Tummler Singer
- Cloud Expo New York Call for Papers Now Open
- 1st Annual Government IT Conference & Expo: Themes & Topics
- Stock in Focus: Dragon Capital
- The i-Technology Right Stuff
- Who Are The All-Time Heroes of i-Technology?
- Get the Message
- Where Are RIA Technologies Headed in 2008?
- i-Technology Viewpoint: Is Web 2.0 the Global SOA?
- i-Technology Viewpoint: Thinking Outside the VC Box
- ESB Myth Busters: 10 Enterprise Service Bus Myths Debunked
- i-Technology Viewpoint: When to Leave Your First IT Job
- SOA Web Services Edge Conference Coverage on SYS-CON.TV
- Five Reasons Why Web 2.0 Matters
- SYS-CON.TV's "SOA Web Services" and "Enterprise Open Source" Programs To Air in December
- SOA World Conference & Expo SYS-CON.TV Power Panel Live From Times Square









Cloud computing is a game changer. The cloud ...






















