Demo Application: Receiving EDI Messages in BizTalk 2009, Creating Trading partners and configuring acknowledgements for Parties.
What it does?
This BizTalk application picks the EDI messages from the input directory, where EDIFACT Invoice documents sent from a trading partner named ‘CompanyA‘ is placed. BizTalk does the validation and resolve the party at the receive pipeline and publishes these messages to the Message box. A send port is configured to subscribe these messages and delivered to the output directory. At the same time BizTalk also sends the acknowledgement back to the sender.
How to deploy and test this application?
• Download the EDIDemo.doc file and renamed it to EDIDemo.zip.
• Extract the EDIDemo.zip file to the C:\ drive, this process will create the necessary directories to test the application.
• Go to Start->All programs->BizTalk Server 2009, click on BizTalk Server 2009 Administration console to open the BizTalk Administration console.
• Right click on Applications ->Import ->MSI file to start the import process.

• Select the ‘EDIDemo.msi’ file located at ‘C:\EDIDemo\Installer’ folder and click Next.

• Now follow the steps as shown in the below screen shots to complete the import process.




• Once the installation is completed. Right click on EDIDemo application and click on Start to start the application.

Test the application:
• Copy the sample file named ‘Invoice-CompanyA.txt’ located in ‘C:\EDIDemo\Sample’ and paste it in the folder ‘C:EDIDemo\Input’.
• Validate that the file was picked up from the Input folder by BizTalk. Check the Windows Event Viewer for any errors that may have occurred.
• If everything goes fine then you can see three invoice files in the ‘C:\EDIDemo\Output’ folder. And both of the acknowledgments were written out to the ‘C:\EDIDemo\Ack’ folder.
———————————————————————————————————
Important steps performed while developing this application
Creating Trading Partners:
In BizTalk 2009, trading partners are configured as parties. EDI documents are received in BizTalk are validated and their party is resolved at the receive pipeline (EDIReceive or AS2Receive). This resolution is based on the contextual information within the header of the incoming EDI message that matches with the settings that have been setup for the party.
Configuration of the home party at the Global EDI Properties:


Configuring Trading Partner (Company A) as Sender and Configuring acknowledgements:




When acknowledgement is configured for a party then that party also acts as a receiver so we also need to set the party CompanyA as Interchange Receiver.

Microsoft Visual Studio LightSwitch
Visual Studio LightSwitch is a new addition to the Visual Studio family, it will give us a simpler and faster way to create high-quality business applications for the desktop and the cloud. Microsoft is going to release this on coming 26th July.
LightSwitch Beta2 is available for free download. To know more details, follow the below link:
Overview of the Microsoft Middleware Strategy….
A must watch video for the BizTalk consultants on the topic ‘An Overview of the Microsoft Middleware Strategy” by Seetharaman Harikrishnan (Hari) – GM, Microsoft, at TechEd 2011. Very informative and useful.
Watch the Video
Issue: Received unexpected message type ‘http://www.w3.org/2003/05/soap-envelope#Fault’ does not match expected type ‘http://abhijit/WCF/06/2011#Operation1’
Generally we encounter this issue when we try to consume a WCF Service with Custom Fault Contract from BizTalk. To circumvent this issue, check the WCF-Transport configuration settings of the Send port.
Select the xPath option under the inbound BizTalk message body and set the Body path expression to /*[local-name()='Fault']/*[local-name()='detail']/* | /*[local-name()='Operation1Response'] | /*[local-name()='Operation2Response']
In the above xPath expression, I have used the union operation for multiple responses. So, if BizTalk receives the fault message then the Custom Fault will be extracted from /Fault/Detail path and when there is no fault then the successful response message will be forwarded to the orchestration.
Batching Outbound EDI messages in BizTalk Server 2009
While working on a B2B projects, it is very common requirement to send many EDI documents at once within a single batch. From BizTalk 2006 R2 onwards we have native EDI support in BizTalk, therefore no need to use any accelerators.
We have got following components in BizTalk to accomplish batching outbound EDI messages.
• BatchMarkerReceivePipelineComponent in the EDI receive pipeline
• Routing Orchestration
• Batching Orchestration
• Upgrade Batching Orchestration
• BatchSuspend Orchestration
• EDI Send Pipeline
These components are installed as DLLs when we install and configure BizTalk Server EDI and AS2 and available under the “BizTalk EDI Application”.
Please refer MSDN,to have more details about EDI batching in BizTalk .
In this blog, I am going to demostrate step by step tutorial on how to implement batching outbound EDI transactions in BizTalk Server 2009.
Steps:
1. Open Visual Studio 2008 and create a BizTalk project named “Abhijit.BizTalk.EDI”.

2.Right click on the BizTalk project created and click on add existing items , browse to the folders “C:\Program Files\Microsoft BizTalk Server 2009\XSD_Schema\EDI\X120501” and select the invoice schema “X12_00501_810.xsd”.
3.Go to the project properties, sign the assembly and deploy the project to the application “Abhijit.BizTalk.EDI”.


4.Close the Visual studio and open the BizTalk Server Administrator console.
5.Right click on “Abhijit.BizTalk.EDI” application, Click on Add–>References.

6.Select the “BizTalk EDI Application” and press OK to add the reference.

7.Create a new Receive Port and new receive location and set the following:
Name of the ReceivePort : RcvInvoice
Name of the ReceiveLocation: RcvLoc-Invoice
Type of the RecieveLocation : FILE
Receive Folder : <<file directory where receive location listens for incoming files>>
Receive Pipeline : EDIReceive


8.Now create a new party named “TestBatch” and set the EDI Properties as shown in the below images.




9. Now Select Batches–>Click on New Batch button
Click on Filter and set the filter property as
BTS.ReceivePortName == RcvInvoice
Click OK to save the filter settings.

Select the Maximum Number of Transaction Sets property and set the Interchange property to 3. This will make that a batch file will send out only when three documents are available in the BizTalk message box.
Click on the Start button to start the batching.
10. Now create a new send port and set the following properties:
Name of the Send Port : SndBatchInvoice
Type : FILE
Send Folder: <<Destination File location>>
Send Pipeline : EDISend
Filters:
EDI.DestinationPartyName ==TestBatch
EDI.ToBeBatched == False
Click OK to save the send port settings.


11. Now associate the send port with the party , From the Parties, Right click on the “TestBatch” party and set the send ports as shown in below image.

12. Start the batching orchestrations:
a. Click the BizTalk EDI application.Start all three of the batching orchestrations (shown in below image).

13. Enable the Receive location (RcvLoc-Invoice) and Start the send port(SndBatchInvoice).
Test the solution:
a. Drop the sample file Invoice5010.txt from in the receive location folder.

b. Drop the same file another two times in the same receive location folder.
c. Check the output folder. You can see a single batch file containing three files, as shown in below image.

Download the SourceCode:
To download the code please Click here
Note:Change the extension of the file from .doc to .zip and extract it into your C: drive.
Now I am also MCTS on .Net Framework 3.5 Windows Communication Foundation Applications (Exam Code-70-503)
From last few weeks, I was preparing for the exam to get the certification on MCTS- .Net Framework 3.5 Windows Communication Foundation Applications (Exam Code-70-503). Today I have successfully passed the exam with very good score. So now I have one more MCTS certification.
Though I had experience working on various development projects using WCF still I spent a lot of time on reading articles/books related to WCF for this exam.
For the guys who are preparing for this exam may find this information very useful.
Major topic area with relative weight (percentage of questions)
Creating Services (19 percent)
Define Service contracts.
Define Data contracts.
Define Operation contracts.
Define Message contracts.
Process generic messages.
Exposing and Deploying Services (23 percent)
Create and configure service endpoints.
Manage consistency between life cycle, sessions, concurrency, and bindings.
Host a service in a managed application.
Host a service on a Web server.
Create custom behaviors.
Instrumenting and Administering Services (11 percent)
Implement end-to-end service tracing.
Monitor service health.
Log messages.
Dynamically configure the service by using the service model.
Implement inspectors.
Consuming Services (16 percent)
Create a service proxy.
Configure the client endpoint.
Call a service by using a service proxy.
Handle exceptions on clients.
Consume non-WCF services.
Securing Services (16 percent)
Implement transport-level security.
Implement message-level security.
Authenticate clients.
Authorize clients.
Impersonate clients.
Managing the Service Life Cycle (15 percent)
Manage instances.
Manage sessions.
Manage transactions.
Manage concurrency.
Manage consistency between instances, sessions, transactions, and concurrency.
For more details please refer
Books:
MCTS Self PacedTraining Kit 70_503 by Bruce Johnson, Peter Madziak and Sara Morgan
MSDN Webcast events:
Windows Communication Foundation Top to Bottom series
Building RESTful Services with WCF
BizTalk configuration issue:Same CID value for MSDTC on both the BizTalk and SQL Server machine.
There could be a lot of reason for not able to successfully configure BizTalk on your machine. But in most of the cases these issues are related to MSDTC.
To troubleshoot problems with MSDTC,
you can refer to MSDN Troubleshooting Problems with MSDTC .
Once I had faced strange problem while configuring BizTalk server on multi server installation. I did all the tricks mentioned on MSDN but not able to solve the problem. Finally uninstalling MSDTC and then reinstalling MSDTC in one machine solved my problem.
Actually problem was there with the same CID value for MSDTC on both the BizTalk and SQL Server. And the reason for same CID value was there because both the machines were cloned from the same one. Reinstalling of MSDTC generates a new CID value.
Steps to solve the problem:
Do this on any of the two machines(either on BizTalk machine or on SQL Server machine)
1. Stop the Distributed Transaction Coordinator service.
2. Go to command line and run:
MSDTC –uninstall
MSDTC -install
3. Start the Distributed Transaction Coordinator service.
I hope this trick would save a lot of time for others.
BizTalk ESB Toolkit 2.0 samples (Content based routing)
In this post, I am going to demonstrate how to achieve content based routing using BizTalk ESB Toolkit 2.0 and Business rules policy.
In the sample Business rule policy(RouteBasedOnDepartment) is used to set the endpoint information of the incoming employee messages based on the value of the department field in the incoming message.
The Itinerary(RouteBasedOnDept.Itinerary) contains ON-Ramp, OFF-RAMP and Routing service with BRE resolver to dynamically route the message.
Steps to create and test the application:
1. Open BizTalk Administrator console and create an application named “ESBSamples”. add a reference of the application “Microsoft.Practices.ESB” to the ESBSamples project.
Note:Microsoft.Practices.ESB is the default application for ESB related artifacts which get automatically created during the configuration of ESB Toolkit 2.0
2.Right click on Send ports under the application ESBSamples and Create a new dynamic one way send port named “DynamicSendToOutput”. Create the following filters as shown below:

3.Create a Receive port ESBSample.OnRamp.Itinerary and a Receive location named ESBSample.OnRamp.Itinerary.FILE and configure this as:
URI: C:\Abhijit\Abhijit.ESBSamples\Input\ *.xml
Receive Pipeline: ItinerarySelectReceive having ItineraryFactKey = Resolver.Itinerary
ResolverConnectionString = ITINERARY:\\name=RouteBasedOnDept;version=1.0
Here RouteBasedOnDept is the name of the Itinerary which we will be creating from step- (21)

4. Now open visual studio 2008, create a blank solution named “Abhijit.ESBSamples”.
5. Add a BizTalk project named “Abhijit.ESBSamples.Demo1.Schemas” and a C# class library named “Abhijit.ESBSamples.Demo1.Itinerary”.

6. Right click on the schema project and add a schema named Employee.xsd having following fields as shown below in the image:

7. After signing the project deploy it to application named “ESBSamples” the one we have created in step-1.
8. Now open Business Rule Composer and create a policy named “RouteBasedOnDept”
9. In the RouteBasedOnDept policy, right-click and Add New Rule. Name the rule to ”ForAdmin”.
10. In Facts Explorer, click the XML Schemas tab, right-click Schemas, and then click Browse.
to Employee.xsd under the folder C:\Abhijit\Abhijit.ESBSamples\Abhijit.ESBSamples.Demo1.Schemas\ and open it.
11. In fact explorer click on Employee.xsd and change the Document Type property to
Abhijit.ESBSamples.Demo1.Schemas.Employee.
12. In the Rule window, right-click Conditions, point to Predicates, and then click Equal.
13. From Facts Explorer, drag the Department element to the argument1 node under Conditions.
14. Click the argument2 node, and then type Admin.
15. From Facts Explorer, drag the Set End Point Outbound Transport Location definition under the vocabulary ESB.EndPointInfo to Actions.
16. Click and then type C:\Abhijit\Abhijit.ESBSamples\Output\Admin \%MessageID%.xml.
17. From Facts Explorer, drag the Set End Point Outbound Transport Type definition to Actions.
18. From Facts Explorer, drag the Adaptor Providers definition under ESB.TransportTypes, vocabulary to <empty string>.
19. In the Actions pane, expand the Adaptor Providers drop-down list, and then click FILE.

Similarly add two more rules name “ForHR” and “ForOthers” having following Conditions and Actions respectively.
Rule: ForHR
Conditions:
Abhijit.ESBSamples.Demo1.Schemas.Employee:/Employee/Department is equal to HR
Actions:
Set End Point Outbound Transport Location to C:\Abhijit\Abhijit.ESBSamples\Output\HR\%MessageID%.xml
Set End Point Outbound Transport Type to FILE
Rule:ForOthers
Conditions:
Abhijit.ESBSamples.Demo1.Schemas.Employee:/Employee/Department is not equal to HR
AND
Abhijit.ESBSamples.Demo1.Schemas.Employee:/Employee/Department is not equal to Admin
Actions:
Set End Point Outbound Transport Location to C:\Abhijit\Abhijit.ESBSamples\Output\Others\% MessageID%.xml
Set End Point Outbound Transport Type to FILE
20. Publish and Deploy the policy to RuleEngine database.
21. Now switch to Visual studio solution and right click on Abhijit.ESBSamples.Demo1.Itinerary project and add an Itinerary named “RouteBasedOnDept.Itinerary”
22. Design the Itinerary as below:

Here first shape is the On-Ramp and for the properties of this refer the below image.

Last shape is the Off-Ramp and for the properties of this shape refer the below image.

Middle shape is the Itinerary service shape and for the properties of this shape refer the below image.

and for the properties of the BRE Resolver used in the Itinerary service, refer the below image.

23. Now Right-Click on the Itinerary designer and click on validate. You might get an error with description: A X509 Certificate is required in the model property ‘EncryptionCertificate’ to encrypt any sensitive property in the designer.

To get rid of this error you need to disable the X.509 certificate validation from the registry:
In the Registry Editor, navigate to the subkey HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\BizTalk ESB Toolkit\2.0\Designer, and then set the RequireX509Certificate property value to false.
24. Set the model exporter of the Itinerary as Database Itinerary Exporter and Itinerary status as Deployed.

25. Right-Click on Itinerary designer and click on Export model to store the Itinerary into EsbItineraryDb database.
Test the solution:
From the BizTalk administrator console under the application “ESBSamples” enable the Receive location and start the send port.
Now drop all the three files from the folder “C:\Abhijit\Abhijit.ESBSamples\Sample\ “ into “C:\Abhijit\Abhijit.ESBSamples\Input\ “ folder. If everything configured properly then you will see one file each in the locations “C:\Abhijit\Abhijit.ESBSamples\Output\HR\” ,
“C:\Abhijit\Abhijit.ESBSamples\Output\Admin\” and “C:\Abhijit\Abhijit.ESBSamples\Output\Others\” based on the value of the Department field of the input messages.
Download the SourceCode:
To download the code please Click here
Note:Change the extension of the file from .doc to .zip and extract it into your C: drive.
Pitfalls encountered and there workarounds during the developement of BizTalk Projects
While working on a BizTalk projects, we have encountered a lot of issues. Here is some of the commonly encountered pitfalls and their workarounds. I hope this would help others.
1.Installation Failure of BizTalk 2004 in Win XP with SP2
· Failed to enable the single sign-on(SSO) service
· Failed to generate the master secret code
Resolution:
· Use the Group policy object editor to enforce the use of authenticated client calls to the RPC End point Mapper and to disable the RestrictRemoteClients setting that is enforced by the RPC protocol.
1. Click Start, click Run, type gpedit.msc, and then click OK.
2. In the Group Policy Object Editor, expand Computer Configuration, expand Administrative Templates, expand System, click Remote Procedure Call, and then click RPC Endpoint Mapper Client Authentication.
3. Change the value for RPC Endpoint Mapper Client Authentication to Enabled.
4. Click Restrictions for Unauthenticated RPC Clients.
5. Change the value for Restrictions for Unauthenticated RPC Clients to Disabled.
· Use Registry Editor to enforce the use of authenticated client calls to the RPC Endpoint Mapper and to disable the RestrictRemoteClients setting that is enforced by the RPC protocol.
1. Click Start, click Run, type regedit, and then click OK.
2. Locate and then click the following registry key : HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT
3. Look for a subkey that is named RPC. If this key exists, click the RPC subkey, and then go to step 6. If this key does not exist, go to step 4.
4. On the Edit menu, point to New, and then click Key.
5. While the new key is selected, type RPC, and then press ENTER.
6. On the Edit menu, point to New, and then click DWORD Value.
7. Type EnableAuthEpResolution, and then press ENTER.
8. On the Edit menu, click Modify.
9. In the Value data box, type the number 1. Click OK.
10. On the Edit menu, point to New, and then click DWORD Value.
11. Type RestrictRemoteClients, and then press ENTER.
12. On the Edit menu, click Modify.
13. In the Value data box, type 0, and then click OK.
14. Quit Registry Editor.
2. Issues with SQL Adapter Distributed Transactions and their Isolation levels
Issue:
· Transaction Manager has disabled its support for remote network transactions.
Resolution:
· First of all verify that “Distribute Transaction Coordinator” Service is
running on both database server computer and client computers.
1. Go to “Administrative Tools > Services”
2. Turn on the “Distribute Transaction Coordinator” Service if it is not running.
· If it is running then following settings need to do on the computer running database server.
1. Go to “Administrative Tools > Component Services”.
2. On the left navigation tree, go to “<Component Services><Computers > My Computer” (you may need to double click and wait as some nodes need time to expand).
3. Right click on “My Computer”, select “Properties”.
4. Select “MSDTC” tab.
5. Click “Security Configuration”.
6. Make sure you check “Network DTC Access”, “Allow Remote Client”, “Allow Inbound/Outbound”, and “Enable TIP”.
7. The service will restart.
8. But you may need to reboot your server if it still doesn’t work.
On your client computer use the same above procedure to open the”Security Configuration” setting, make sure you check “Network DTCAccess”, “Allow Inbound/Outbound” option, restart service and computer if necessary.
3. Issues with Disassembly of Messages using Envelope Schemas
Issue:
· We can use custom pipelines with XML Disassembler to cut an envelope message coming from a SQL receive location to obtain its constituent document messages. If proper options are not specified in the pipeline and the Receive Location through which the envelope message will be coming, the disassembly fails and no document messages are returned, resulting to message loss.
Resolution
· It is the responsibility of the Receive Location to add the envelope node to the incoming XML, along with the Namespace URI, which is the means by which the messaging engine identifies the type of the message. So, proper envelope node name (Document Root Name) and Namespace URI must be specified when creating the SQL receive location.
· The Namespace URI specified in the Receive Location must also be specified as the Document Namespace of both the Envelope Schema and the Document Schema.
· While designing the custom pipeline, the Document Schema and the Envelope Schema of the XML Disassembler stage component must be specified. The custom pipeline must be explicitly specified as the Receive handler of the SQL Receive Location.
4.Message Construction issues inside Orchestrations.
Issue:
· Message is not constructed inside construct shape of the Orchestration.
Resolution:
· Before using a BizTalk XML Message inside an orchestration, it must first be constructed. In fact this is just populating the message with XML. If there is an attempt to use this message before it is constructed, the above error will come. Some messages come pre-constructed, such as messages that originate from a send port
· There is several ways to construct a message inside an orchestration
1.Create new message from an existing message using BizTalk map
2.Assign one message to other( i.e creating a copy of an existing message)
3.Creating a message with the help of a System.XML.XMLDocument variable.
We have to first declare an orchestration variable of type XmlDocument. Then in a message assignment shape, need to do something like this:
myxmlDoc = new XmlDocument();
myxmlDoc.LoadXML(“”)
myMsgBeingConstructed = myxmlDoc





Recent Comments