Hello Friends.
Wish you all very Happy New Year 2009.
Never Ending Welcomes YEt to ARrive.
Thanks
SreenivasaRagavan.
Bytes Matters
Hello Friends.
Wish you all very Happy New Year 2009.
Never Ending Welcomes YEt to ARrive.
Thanks
SreenivasaRagavan.
In this Blog I am going show how to expose BizTalk Server 2009 Schema as a WCF Service using BizTalk Server WCF publishing Wizard.
First we need to create Empty BizTalk 2009 Project and Add Schema to that project.
Here I created the Contacts XSD with the following Child Elements.
<Name>Name_0</Name>
<Email>Email_0</Email>
<Phone>Phone_0</Phone>
Now Build this project and deploy into BizTalk server DB.
Launch the BizTalk Server WCF Service Publishing Wizard
Enable metadata endpoint Checking check box causes the “httpGetEnabled” flag to be set to true, thus enabling Client application to retrieve the WSDL for this service.
Now select the BizTalk application name which you want to expose as WCF Service. here we need to select the project we deploy into BTS Server.
Now we asked whether we want “Publish orchestrations as WCF service” or “Publish schemas as WCF service.” This both options same as classic BizTalk Web Services Publishing Wizard. Now we will choose Publish schemas option.
Here we are going to Add method to our WCF Service .
Select the Schema type for the method we just created.
Provide the Namespace for the WCF Service.
Provide the IIS Server Location to create the WCF Service. check allow Anonymous Access.
Go to IIS Manger and you can see the WCF Service web application is created with .SVC file
Browse the WCF .SVC file. Now you created WCF service.
Configure the BizTalk server Receive and Send ports.
Now let's create the Windows Client and consume the BizTalkServiceInstance WCF Service.
Run the client Application , now you will see Message in BTS Send ports.
Thanks
SreenivasaRagavan.
First let's create a simple WCF service that Biztalk server will call.
Here is my ServiceContract and Implementation of the Service Contract.
I am Hosting this WCF service in Console Application (Self hosting).
Now I need to actually start up my WCF service host. Now BizTalk can interrogate this service to extract the necessary metadata. Within Visual Studio.NET, I chose “Consume WCF Service” from the “Add Generated Items” project menu.
Now create Empty Biztalk Project. Right click on the project and select Add Generated Items as shown below.
From Add Generated Items Dialog select Consuming WCF Service Template.
Now Follow the BizTalk WCF Service Consuming Wizard.
Here Edit the WCF Service MEX endpoint URL
Before doing above step make sure that WCF service UP and Running ( Remember We hosted this service in console App).
Now we are successfully finished the Wizard.
WCF Service Consuming Wizard Generates the following files.
Now Open the SreeniImpl.odx Orchestration Create a message for the WCF Service Add Operation and configure the Receive and Send Ports.
Now Build and Deploy the Application and Open up the Biztalk 2009 Admin Console.
Our WCF service build with Basic HTTP binding so in Biztalk we need to configure send port Transport type as WCF-Basic HTTP as shown below.
Now configure the send port as shown below.
Now configure the Receive port as shown below .
Now test the Biztalk application.
Input XML Message
<ns0:Add xmlns:ns0="http://tempuri.org/">
<ns0:a>5000</ns0:a>
<ns0:b>18</ns0:b>
</ns0:Add>
when we drop the input XML message in Receive Location Biztalk server call WCF service Add Operation.
Output XML Message:
<?xml version="1.0" encoding="utf-8" ?>
<AddResponse xmlns="http://tempuri.org/">
<AddResult>5018</AddResult>
</AddResponse>
Thanks
SreenivasaRagavan,
An extension method is a new language feature of C#. This methods provides a ability to "ADD" methods to an existing types without creating a new derived type.
Extension methods are a special kind of static method, but they are called as if they were instance methods on the extended type.
In my current project I had Business Object called LOT this is C# class with the following properties .
public class Lot
{
public string lotNumber {get;set;}
public string lotDescription { get; set; }
public string customerName { get; set; }
public string metalId { get; set; };
}
when I pass this Lot Information to Back end ERP System I need to format with padding Zero ( total length of the lotNumber field is 14 in DB).
Here comes new C# 3.0 Extension Methods for handy .
Extension methods are defined as static methods but are called by using instance method syntax. Their first parameter specifies which type the method operates on, and the parameter is preceded by the this modifier. Extension methods are only in scope when you explicitly import the namespace into your source code with a using directive.
Here is my Extension methods.
for more Information about C# Extension Methods POINT your IE to EXTENSION METHODS
Thanks
SreenivasaRagavan.
The property fields are promoted so that their values can be referenced for content based routing purposes inside orchestration, Pipeline, Receive and Send ports. A term Promoting a Property is commonly used to describe a message’s promoted properties is message context.
Property Promotion | Distinguish field |
Promoted field available in all the following BizTalk artifacts such as Receive, send ports, Pipelines, Orchestration.
Promoted properties are max Length of 255 Char
Promoted properties are persisted to the Message box database. |
Distinguish filed only available in single instance of Orchestration.
Distinguish filed can be any length.
Distinguished fields have less of a performance impact than promoted properties, as They are not persisted to the MessageBox database. Instead, they are essentially XPath aliases, which simply point to the appropriate XML data field. |
Here I am promoting the Age Property of the Contact.XSD
Once I Promote the age Property I can Filter the message (CBR) based on Age in my Receive , Send and Orchestration.
After promoting the Age Property you see difference in Age Element. ( Small Yellow circle on top).
Once you have deployed the solution with the promoted properties, they may be used to
perform content-based routing (CBR).
for example: Suppose I am receiving two Message with different age I can Route this message to two different send port based on age.
First send port : Only Age > =10
Second Send port Only < 10
Message 1:
<ns0:Contact xmlns:ns0="http://BizTalk_Server_Project1.Contacts">
<Name>Name_0</Name>
<Age>10</Age>
<Email>Email_0</Email>
<Phone>Phone_0</Phone>
</ns0:Contact>
Message 2:
<ns0:Contact xmlns:ns0="http://BizTalk_Server_Project1.Contacts">
<Name>Name_0</Name>
<Age>25</Age>
<Email>Email_0</Email>
<Phone>Phone_0</Phone>
</ns0:Contact>
Thanks
SreenivasaRagavan.
What is Functoid?
The term Functoids refers to predefined functions within the Biztalk Mapper tool set. Functoid's support
a number of useful translations and transformations.
Here are the steps to create, deploy and test the Custom Functoid.
1) Create a C# Class Library Project
2) Add Reference Microsoft.BizTalk.BaseFunctoids.dll to the project you can find this DLL from the following Folder [ Biztalk sever should be installed to get this Assembly]
3) Add Resource file VS.NET Template to the project for to store Functoid Configuration parameters. and add the following Resource string and values.
4) Add Custom Functoid class and that should derive from BaseFunctoid class as shown below.
Here is the my custom function implementation.
When Overriding the Constructor we need to perform the following primary tasks as shown in the table.
[ Source : Microsoft here is the link Custom Functoid]
Task | Use these methods or properties | Comments |
Assign a unique ID to the functoid | ID | Use a value greater than 6000 that has not been used. Values less than 6000 are reserved for use by internal functoids. |
Indicate whether the functoid has side effects | HasSideEffects | Used by the mapper to optimize the XSLT code that is generated. This property is true by default. |
Point to the resource assembly | SetupResourceAssembly | Include a resource file with your project. If building with Visual Studio, the resource assembly must be ProjectName.ResourceName. |
Enable the custom functoid to appear in the BizTalk Mapper palette | SetName SetTooltip SetDescription SetBitmap | Use a resource ID pointing to a string for the name, tooltip and description; use a 16x16-pixel bitmap. |
Assign the functoid to one or more categories | Category | Categorize the functoid by using one or more FunctoidCategory values. |
Specify the number of parameters accepted | SetMinParams SetMaxParams HasVariableInputs | Use the SetMinParams method to set the number of required parameters and the SetMaxParams method to set the number of optional parameters. Use the following guidelines to set these values: · If you have no optional parameters, set min = max. · If you have some optional parameters, set max = (number of optional parameters - min number of parameters). · If you want to allow unlimited optional parameters, do not set max. · If you have a variable number of inputs, do not set min or max, and set HasVariableInputs = true. |
Declare what can connect to your functoid | AddInputConnectionType | Call AddInputConnectionType once for each ConnectionType that the functoid supports. |
Declare what your functoid can connect to | OutputConnectionType | Use values from ConnectionType to tell BizTalk Mapper the types of objects that can receive output from your functoid. Use OR to specify multiple connection types. |
Tell BizTalk Server which methods to invoke for your functoid | SetExternalFunctionName SetExternalFunctionName2 SetExternalFunctionName3 | For cumulative functoids, use SetExternalFunctionName to set the initialization function, SetExternalFunctionName2 to set the accumulation function, and SetExternalFunctionName3 to specify the function that returns the accumulated value. For noncumulative functoids use SetExternalFunctionName to set the functoid method. |
Have BizTalk Server use inline code to invoke your functoid | AddScriptTypeSupport SetScriptBuffer | Call AddScriptTypeSupport with ScriptType to enable inline code. Invoke SetScriptBuffer to pass in the code for the functoid. This code will be copied into the map. |
Declare global variables for an inline functoid | SetScriptGlobalBuffer | Any declarations made will be visible to other inline scripts included in the map. |
Indicate which helper functions your inline functoid requires | RequiredGlobalHelperFunctions | Use values from the InlineGlobalHelperFunction enumeration to specify which helper functions are required. Use OR to specify multiple helper functions. |
Validate parameters passed to your functoid | IsDate IsNumeric | These functions provide a true/false answer without throwing an exception. |
5) Add Strong Name Key to the project this can be done from VS.NET IDE itself or we can use SN.EXE from VS.NET command prompt .
6) Now copy the Build DLL into the following Windows Folder. this is the place where BIZTALK server looks for custom Functoids.
7) Add Custom Functoid to VS.NET Tool Box
8. Add the functoid to the Global Assembly Cache (GAC) [ To add Assembly to GAC the assembly has to build with Strong Name].
Now create a Biztalk MAP and test the Custom Functoid
Input XML Instance:
<ns0:Root xmlns:ns0="http://BizTalk_Server_Project1.Schema1">
<Id>AG</Id>
</ns0:Root>
Map Out put XML : ( with custom Functoid)
<ns0:Root xmlns:ns0="http://BizTalk_Server_Project1.Schema2">
<ID>SILVER</ID>
</ns0:Root>
Thanks
Sreenivasaragavan.
Today I installed WCF REST start kit from CodePlex . here is the link to download WCF REST STARTER KIT
What is Inside WCF Starter Kit?
WCF REST Starter Kit is a set of features, Visual Studio templates, samples and guidance that enable users to create REST style services using WCF. Visual Studio templates for creating REST style services such as an Atom feed service, a REST-RPC hybrid service, Resource singleton and collection services and an Atom Publishing Protocol service.
VS.NET 2008 REST Templates.
Thanks
SreenivasaRagavan.
What is debatching?
Suppose you are receiving a BizTalk Message that contains multiple records. In order to process the message and update or send to particular system (DB or any other Application) we need to process this message individually this process called debatching in BizTalk.
How BizTalk helps ?
In BizTalk using Envelope Schema, Document schema we can process or break a message individually .
Steps Needed to Achieve this.
1) First Create document schema which has all the elements of the XML message. and call this schema as Contact.XSD
Here I am going to use The following XML Message
<Name>Sreeni</Name>
<Age>35</Age>
<Email>sragavan@hotmail.com</Email>
<Name>Gandhi</Name>
<Age>35</Age>
<Email>Gandhi@india.com</Email>
2) Create Envelope schema and name it Contacts
Now select Schema node in newly created schema and set Envelope Property to "YES" as shown above.
Now we need to Import Contact Document schema into Envelope schema.
Now add child record and name it Contact and change the Data structure type to Contact as shown below.
Now change the Body Xpath to /*[local-name()='Contacts' and namespace-uri()='http://XmlDebatching.ContactsEnvelope']
Step 3:
Now create custom Receive Pipeline with XML Disassembler as shown below.
and Change the document schema to Contact.XSD and Envelope schema to ContactsEnvelop.XSD.
finally Add Strong Name key file to the project and Deploy into BizTalk Message DB.
Create Receive Port with the custom pipeline we created and Send port with Filters and test the application.
Now drop the Contacts.XML in Receive Location and BizTalk Read the message and Split into individual messages as shown here.
Thanks
SreenivasaRagavan.