Monday, July 4, 2011

Storing File location in Tracking profile editor's DocumentReferenceURL


Charan: I have a simple scenario where the message flows in through a receive port and is subscribed by a FILE send port for storing at the backup location. I want to store the path of the message in BAM activity.

Rohit: You can use the Document Refernce URL to do it. Let me show how.
Open your deployed activity in TPE and add New Document Reference URL as shown below:
 
Rename the document reference URL to something appropriate e.g. DocumentPath

Associate the data with this DocumentPath

Set Port mapping to the FILE Send Port. Do the same for other milestone in the BAM activity and deploy the tracking profile.

You will found the path of document in the Related Document Section in Activity Status as shown below:





Cheers,
Rohit Sharma

Thursday, June 30, 2011

Monday, March 28, 2011

Certification for BizTalk Server 2010

Microsoft is releasing certification for BizTalk Server 2010 on 30th of March. Check it out at Microsoft Learning Site
Cheers,
Rohit Sharma

Thursday, March 24, 2011

BizTalk Tutorial Part 7: Using Two-Way HTTP Receive Port to receive request and send response

Charan: I have a problem. One of our client wants to send our application an XML message and  want to receive the acknowledgment for the same. Moreover client want to use HTTP protocol for this communication and our application don't support HTTP . Is there a simple way to do this through BizTalk.
Rohit: hmmm interesting problem. Yes, in BizTalk all you have to do is to create Request-Response Receive Port using HTTP adapter. You can use BizTalk to communicate with your backend application.
Let me show you, through a demo application, how you can achieve this on 64-bit machine win Windows Server 2008.
1. Configure BTSHTTPReceive.dll in IIS 7.0
In Internet Information Services Manager console click on Handler Mappings
Then click on Add Script Map... In Add Script Map dialog box specify the required information as shown below:-
Note: If you are having 32-bit OS then the path in Executable: should be '<BizTalkInstallationDirectory> \HttpReceive\BTSHTTPReceive.dll '
Click OK to close the “Add Script Map” window, a warning windows will then appears, Click Yes Button.

2. Create application pool in IIS 7.0
In IIS Manager Console create application pool using .Net Framework Version 4.0 and configure it with identity having appropriate access to BizTalk databases.
In Advanced Setting dialog box for application pool set 'Enable 32-bit Applications' to false.

3. Create Virtual Directory in IIS 7.0
In Add Application dialog box specify the following application:
Alias: HTTPDemoApp
Application pool: Name of Application Pool created in step 2.
Physical Path: <BizTalkInstallationDirectory>\HttpReceive64
Note: <BizTalkInstallationDirectory>\HttpReceive in case of 32-bit.

4. Create BizTalk Application
Open the BizTalk Server Administration Console and create a new BizTalk application with name 'HTTPAdapterDemo'
5. Create Request Response Receive Port
Create a request response receive port with name RP_ReceiceMessage as shown below:

Create RP_ReceiceMessage_HTTP receive location as shown below. Use HTTP adapter .
Configure HTTP adapter as shown below:

6. Create Dummy orchestration to act as back-end application
Create new BizTalk project with name 'BizTalk.HTTPAdapterDemoApp'.
Add Schema 'Message_XML.xsd' to project as shown below:
Add a dummy orchestration that will set the status filed of message to Approved if Quantity is less than 500 and Denied otherwise.
Follow these steps to create the dummy orchestration:

6.1: Add orchestration to the project



6.2: Create two messages in orchestration and sepcify Message_XML as Message Type as shown below: 


6.3: Create a request-response port for receiving message and sending response by following the steps shown below:






6.4 Drop a receive shape and configure it as shown below:


6.5: Drop a decide shape and configure the IF portion as shown below:


6.6: Drop a Message Assignment in IF block and configure the construct shape enclosing the message assignment shape as shown below:


6.7: Configure the message assignment shape as shown below:


6.8: Drop a Message Assignment in ELSE block and configure the construct shape enclosing the message assignment as done in step 6.6 and configure the message assignment shape as shown below:

6.9: Drop a Send shape after decide shape and configure it as shown below:



Deploy this solution and configure the orchestration and attach the logical port to 'RP_ReceiveMessage' created in step 5. Start the HTTPAdapterDemo application created in Step 4.
7. Test the functionality
Create C# console application and use the following code
        static void Main(string[] args)
        {
            WebRequest request = null;
            WebResponse response = null;
            if (args.Length < 1)
            {
                Console.WriteLine("Please specify the name of XML file as argument");
                return;
            }
            try
            {         
                //The path of Virtual Directory created in Step 3
                string uri = "http://localhost/HTTPDemoApp/BTSHTTPReceive.dll";

                request = WebRequest.Create(uri);
                request.Method = "POST";
                request.ContentType = "text/xml";
               
               
                StreamWriter writer = new StreamWriter(request.GetRequestStream());

                //args[0] should contain the path of XML file complying with schema Message_XML.xsd
                StreamReader reader = new StreamReader(args[0]);
                writer.WriteLine(reader.ReadToEnd());
               
                reader.Close();

                writer.Close();

                response = request.GetResponse();
                               
                Console.WriteLine(ReturnString(response.GetResponseStream()));
            }
            catch (WebException webException)
            {
                Console.WriteLine(webException.Message);

            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            finally
            {
                if (request != null) request.GetRequestStream().Close();
                if (response != null) response.GetResponseStream().Close();
            }
        }
        static string ReturnString(Stream stm)
        {
            byte[] buffer = new byte[1024];
            StringBuilder strBldr = new StringBuilder();
            int count;
            while ((count=stm.Read(buffer, 0, 1024)) != 0)
            {
                for (int i = 0; i < count; i++)
                    strBldr.Append(Convert.ToChar(buffer[i]));
            }
            return strBldr.ToString();
        }

Cheers,
Rohit Sharma

Tuesday, February 8, 2011

BizTalk Server 2010: The new Settings Dashboard

I was amazed when I looked at the new setting dashboard available in BizTalk server 2010 everyone who have tried to change the BizTalk settings would be happy. Now you get all the settings you need to tweak at one place instead of modifying registry entries, config files or making changes to the SQL table. I will walk through dash board and will mention the settings for which no UI was available before.
Group: Before no UI was available for group- level tracking you have to do it by making changes to the SQL table.
Host: The most interesting part here is that now Polling Intervals for Messaging and Orchestrations can be changed for each host before it was not possible to do. You normally need to change it for low-latency scenarios.
Now you need not to go to open registry editor to change values of the settings required for Resource Based Throttling.
Here added the UI for throttling override for publishing and delivery in BizTalk 2006 R2 you need to change the registry keys.
Now you can control the dehydration behavior of Orchestration from this UI.
Host Instances:Now you can change the number of worker and IO threads for each host instance from this dashboard.
And can also define Memory throttling for Orchestration for each Host Instance.

Cheers,
Rohit Sharma