Wednesday, 12 October 2011

Delivery Notification in BizTalk Orchestration

         The Biztalk engine has the notion of publishing system level (positive) Acknowledgments (ACK’s) which indicate a successful message transmission and Negative Acknowledgments (NACK’s) which indicate the suspension of a message.

         Orchestrations can use delivery notification to subscribe to these acknowledgments for the messages that they send

         These are extremely powerful and can be used for handling the outcomes of asynchronous operations in the engine.

         For example, consider the scenario whereby an Orchestration transmits a one-way message over HTTP, the Orchestration will publish the message to the Message Box which will route it to the appropriate send port. The transmission of the message is completely decoupled from the Orchestration publishing to the Message Box, so the Orchestration has no notion of whether the transmission actually succeeded or not, instead the Orchestration only knows whether the message was successfully published to the Message Box. Perhaps the back end web server was down which caused the message to be suspended by the Biztalk engine. The Orchestration would have no way to determine the message was never delivered without some higher level message exchange in the form of a business Acknowledgment. Enter ACK’s and NACK’s.

         If an Orchestration port is marked with Delivery Notification = Transmitted, and the Send shape in the Orchestration is in a synchronized scope, the Orchestration will wait until it either receives an ACK or a NACK for the message that was transmitted.

         In the case that the message was successfully transmitted, the engine will publish an ACK ensuring that it is routed back to that Orchestration instance, once the Orchestration receives the ACK it will leave the scope and continue processing.

         If however the transmission failed and the message was suspended, the engine will publish a NACK which again will be routed back to the Orchestration instance, the Orchestration will throw a DeliveryFailureException which can of course be caught and handled as appropriate in the Orchestration.

         The system context property “AckRequired” is written on the message that was sent and it is set to true.  All these settings are happening in the background we need not to worry.

Both ACK’s and NACK’s have the following system context properties promoted which can therefore be used in filter expressions for routing:

         AckType: set to ACK or NACK
         AckID: set to the message ID of the message that this ACK/NACK is for
         AckOwnerID: set to the instance ID that this ACK/NACK is for
         CorrelationToken: flowed from the message to the ACK/NACK
         AckSendPortName: the name of the send port that this message was being sent over
         AckOutboundTransportLocation: the outbound url that this message was being sent over
         AckReceivePortName: the name of the receive port that the message was received over
         AckInboundTransportLocation: the inbound url that the message was received over

         The publication of ACK’s/NACK’s is a little bit special in that if there are no active subscriptions for them, the ACK/NACK will be discarded. The ACK/NACK is published atomically with the appropriate message, for example, the suspension of a message and the publication of its NACK are in the same transaction within the engine, similarly the publication of an ACK is performed in the same transaction as the deletion of the message from the application queue. Further the engine does not suspend ACK’s/NACK’s.

         When a message is sent through a send port with Delivery Notification set to transmitted, a correlation set is initialized.  A correlation token is assigned to the outbound message.  A subscription is started based on this correlation token.  This token is stored in the context property of the ACK/NACK and promoted.  When the ACK/NACK is returned, it is routed back to the calling Orchestration.  You get all this just by setting a little property to “Transmitted”!

Monday, 26 September 2011

Creating Dynamic Port In BizTalk Orchestration

  1. Create a new port on orchestration port surface,
    1. Define the name of port
    2. Port Type
    3. Define Port Binding
                                                               i.      Port direction communication: select “I will be sending message on this port”
                                                             ii.      Port Binding : “Dynamic”
                                                            iii.      Send Pipeline : “Passthrough/XML Transmit”

Click next and  Finish.

  1. Add Expression shape to the Orchestration.

Then you can define the address and other properties of  Dynamic Port as show below.

DynamicPortOut(Microsoft.XLANGs.BaseTypes.Address) = "net.tcp://localhost:8001/netTcp";

DynamicPortOut(Microsoft.XLANGs.BaseTypes.TransportType) = "WCF-NetTcp";

The address could be anything like Folder Location/Http URI/Service URI/ SQMQ

3. Now you can test your Dynamic Port created.

Thursday, 22 September 2011

Creating MultiPart MessageTpe in BizTalk

MultiPart Message: is Message with multipart part in it. Example we can have one message input to “Receive Shape” of orchestration and which indeed has multiple message.

Here we have InputMsg as multipart message.It’s Message Type is “MulitpartMsg.MutipartType_1”. Which has three types of message (Num1, Num2, Num3) in it all are defined as type int.The int type is for this sample only you can define it as any DataType or schema.


The receive shape (Receive_1) has message “InputMsg” which is of type Multi-Part message types.

Then I published this Orchestration as Web service using “BizTalk Web Publishing Wizard”.The Published WebService when opened in Browser.Shows Multipart-Message as input parameter to method “Operation_1”

Then I have created a test application to test my Webservice. I added web service as web reference to my application & then called method Operation_1 (Num1, Num2, Num3) and passed multipart message parameter value and got the desired output.
//Create an instance of the proxy  
            MultipartMsg_Service_Port_1 wsProxy = new MultipartMsg_Service_Port_1();
            Int32 intSum;
            //Call the numeric operation
            intSum = wsProxy.Operation_1(10, 10, 20);

Monday, 19 September 2011

Downloading & Installing AdventureWork sample database

1.                  Download AdventureWorksDB file from Microsoft link

2.                  run and install  the .MSI file on your system , Make sure after installing AdventureWorkDB the following files exists in folder location “C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data”
a.       AdventureWorks_Data.mdf
b.      AdventureWorks_Log.ldf

3.                  Once the installation is completed then we need to attach AdventureWorksDB to SQL server.

a.       Right Click on Database,Click Attach 

b.      On Attach database screen,click Add

c.       On Locate database file, Go to folder location “C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data” and select “AdventureWorks_Data.mdf” file.Click Ok.

d.      And your AdventureWorksDB added successfully.

Friday, 9 September 2011

Sharepoint/Moss : Formatting the Data View

Formatting the Data View

The default data view that we are presented with uses uninspiring black serif text on a white background. We can jazz up our data view using two different methods:

Direct Formatting

It is possible to apply formatting directly to our data view by highlighting the cells that we wish to format and then using the formatting tools. This can be a good option if we only want to format a single data view but is not the best approach if we would like to apply our formatting on a site-wide basis.

CSS Formatting

A more manageable way to apply formatting to our data views is to make the changes across the entire site by editing our style sheet.
When we click in the cell that has the Price heading in it, notice that a tag appears above it, telling us that this cell is referred to as That is to say that it is a table heading (th) element that is being rendered using the ms-vh class (which I assume stands for Microsoft View Heading). Similarly, if we click in any of the cells further down the data view, we see that they are referred to as (standing for Microsoft View Body). This reference is used to specify the format of the cells in our table that display the actual data.
In addition, there is an ms-alternating class that renders every other row with a different background color.
To allow us to edit our styles, we must fi rst create a new blank style sheet, which we will call share.css:
  1. Select File | New | CSS.
  2. Go to File | Save.
  3. Give the fi le the name share.
  4. Save the fi le as CSS Files fi le type.
  5. Click Save.
The next step is to attach our style sheet to our site so that our pages can refer the styles that we will create within the style sheet:
  1. Open the Apply Styles task pane.
  2. Click Attach Style Sheet.
  3. Click Browse.
  4. Browse to share.css and click it.
  5. Click Open.
  6. Under Attach to, check All HTML pages.
  7. Click OK.
  8. Click Close on the information dialog.

We will then make our style sheet ready to use by defi ning some styles. Adding the following code to the style sheet will change the ms-vh and ms-vb classes so that they are formatted in a more inspiring manner:, {
       font-family:gill sans, gill sans mt, arial, sans-serif;
} {
} {
Notice how the fi rst line of our style sheet refers both ms-vh and ms-vb, with a comma separating them. This allows us to specify the font face in one place rather than needing to enter it separately into each class. Grouping styles in this way not only saves time when creating our site but also makes the site more easily maintainable when we and other people make changes in the future.
If you are eagle-eyed, you will also notice that the color references (e.g. #903) only have three digits rather than six. This is possible when a color has repeating numbers (e.g. 99 or 00), allowing us to condense #990033 to #903.
If you are not familiar with using CSS, do not be put off using it because it is easy to learn. We also get a helping hand, because when we type code into the style sheet, SharePoint Designer uses IntelliSense to suggest code we may like to use.
Once we have saved our style sheet, SharePoint Designer instantly refl ects changes to the style sheet in the Design view of products.aspx.
When creating our style, we specifi ed that dashed lines should appear below each cell. By default, SharePoint Designer has a default value of 0 for our borders, meaning that they will not display. In order for the dotted lines to appear, we will need to make sure that our table has a border value of 1. We can do this by highlighting the whole table and typing 1 into the border attribute in our Tag Properties task pane. Selecting ourtable as the class for the table in this task pane will remove the solid border, allowing our dashed lines to be visible in all their glory.

W e can take our formatting even further and use CSS to format the delete and insert text links so they look like buttons, by giving them a border and some padding. We can also give our "buttons" a different background color whenever the cursor is positioned over them.
To add this additional formatting, we will place the following code into our style sheet:
a:link, a:visited, a:active {
a:hover {
A word of warning about specifying these styles for your links—they will apply to all links in the share site (and it is unlikely that you would want to do that). It would be better for us to create a new class (e.g A.funkyButton) that we can use whenever we want to render our links to look like buttons.

Conditional Formatting

We can make our data views more meaningful by setting up our data view to automatically use different styles in response to differing data values. This technique is known as conditional formatting.
Applying conditional formatting in SharePoint Designer requires us to use the XPath language. Don't worry though because SharePoint Designer makes this easy for us.
We would like to apply some conditional formatting to our data view so that it shows a differently formatted price for all wines that have a low number in stock.
We start this process by right-clicking on our data view and selecting Conditional Formatting from the shortcut menu. This will open up the Conditional Formatting task pane.

We then click on the data value that we would like to apply our conditional formatting to. We will select any of the prices in the data form. Below, I have selected the price of the most expensive wine, Chateau le Gay.

We then click the Create button in our Conditional Formatting task pane and select Apply Formatting.

Doing so presents us with the Condition Criteria dialog box. This dialog is used to specify the conditions for our formatting. To begin using the dialog, we click on the line that says Click here to add a new clause…. We would like our Price to be formatted differently if the number of products in stock is less than 10, and so select the options in the diagram below and then click OK:

Now that we have chosen our criteria, the next screen allows us to specify the style that will be automatically applied to our Price when the condition is met. In the Font category, we will select a font-weight of bold, and in the Background category, we will select a nice bright background-color of yellow (#FFFF00). This vivid style will ensure that the information stands out to the users of the site.
To mod ify the condition at a later date, we can click on the condition in our Conditional Formatting task pane and select Edit condition… from the drop-down list.
Fig 8
It is also worth noting that it is also possible to use conditional formatting to change the visibility of the data so that it can be displayed or hidden, depending on the value. This is useful to show or hide images. For example, if the type of wine is red, show a red bottle. If white, show a white bottle.

Formatting Numbers

It is w orth pointing out that it is very easy to format numbers in our data view so that they display as we would like. We can display our numbers as percentages or as a currency and specify the number of decimal places that the number should have. We can also control the 1000 separator so that commas appear in the correct places to make large numbers more easily readable.
We will take the opportunity to display our prices with a dollar sign in front of them by doing the following:
  1. Rig ht-click on one of the prices in our data view.
  2. Select Format Item as.
  3. Select Currency.
  4. This will open the Format Number dialog. Ensure that the Symbol is set to $.
  5. Click OK.
Notice that we only needed to select one record and that all prices were formatted in the same manner.

Filtering Data

It is p ossible to fi lter our data view so that only certain records are displayed. We will use this functionality to display only products with a price of over $15. This feature works in a similar manner to the conditional formatting (albeit there is no formatting to be applied). To fi lter our data view, we follow these steps:
  1. Right-click on our data view.
  2. Select Show Common Control Tasks.
  3. Select Filter: from the list.
  4. Click on the fi rst row to add our new clause.
  5. Specify the following values:
    a. Field Name = Price (Number)
    b. Comparison = Greater Than
    c. Value = 15
  6. Click OK.

You will notice that our data view now only displays the products that are priced over $15.
To remove the fi ltering, we follow the fi rst three steps so that the Filter Criteria dialog appears again. We remove our criteria by right-clicking on the black arrow to the left of the criteria and selecting Remove. Finally, we click OK.

Using Formulae

When us ing SharePoint Designer, it should be remembered that it is a fully-fl edged member of the Microsoft Offi ce suite of products. As such, we can use it to perform powerful calculations that you would expect other products in the suite (such as Excel) to perform.
We will add a new column to our data view that will display the total value of the wine the Wine Company has in stock. We begin this process by clicking on our data view to select it and then going to Data View | Edit Columns….
The Edit Columns dialog allows us to select the fi elds in our data set that we would like to include in our data view. If we would like to add columns to or remove columns from our data view, this is the dialog that we would use.
The dialog also allows us to add a formula column. We will do this now by clicking on Add Formula Column… and then clicking on the Add >> button.

The XPat h Expression Builder then appears. If you have previously created formulae in Microsoft Excel or Microsoft Access, then you will be familiar with the principle behind creating formulae using a builder like this.
We can either type our fi eld names into the pane titled Edit the XPath expression or drag them across from the fi eld list in the left pane. We can also use my personal favorite method and double-click them across. Whenever we type a space into the expression pane, IntelliSense suggests appropriate code items including fi eld names and arithmetic operators (such as +, -, /, and *).
We will use the following simple expression:
Price * InStock
The following image shows the Expression Builder in use:

Once we c lick the OK button, SharePoint Designer adds our formula to our Displayed Columns list as Formula 1 (important note: this has nothing to do with fast racing cars!). When we click the next OK button on the Edit Columns dialog, our formula is added as a new column on the right of our data view. You may wish to take a moment to resize the width of your data view to 450 pixels and to rename the last column Total Value.

Sorting Data

Hopefully, by now you are impressed with how easy it is to display data using SharePoint Designer. When it comes to ordering our data, you will continue to be impressed.
We would like to sort our wines so that the cheapest wines appear fi rst and the more costly bottles appear last. To do this, we use the sort feature:
  1. Right- click on our data view.
  2. Select Show Common Control Tasks.
  3. Select Sort and Group: from the list.
  4. Click on the Price(Number) fi eld and click Add>>.
  5. Click on the ProductName fi eld and click Add>>.
  6. Click OK.
It is worth noting that we can also group similar items together within the data view. For example, if our data specifi ed whether the wine was red, white, or rosé, then we would be able to group the data by type.

Allowing Users to Sort the Data

It is easy for us to give users the ability to sort the records in the data view. We can enable this sorting like so:
  1. Click on our data view to select it.
  2. Go to Data View | Change Layout.
  3. Click on the General tab.
  4. Check the Enable sorting and fi ltering on column headers checkbox.
  5. Click OK.
Once we have saved the page, users will be able to click on the column headings to sort the records by alphabetical order (or numerical order, provided that the data in that column are numerical values).


Although ou r example data only contains fi ve different products, there are a huge number of wine products in the market (there are about 6,000 wineries in the United States alone). Naturally, we would not want to display tens of thousands of products all on one page. By using paging, we can specify the maximum number of records that will be displayed in our data view at one time. Depending on the options we have specifi ed, users may be able to click forwards and backwards through the data view, displaying the next records each time they do so.
  1. Right-click on our data view.
  2. Select Show Common Control Tasks.
  3. Select Paging: from the list.
  4. Click on the Display items in sets of this size: radio button.
  5. Enter 4 into the field.
  6. Click OK.


Over the course of the last two chapters, we have discovered how easy it is to interrogate a whole range of data sources and display information from them in our SharePoint site in an attractive and useful manner.