BizTalk Server Talk

My experiences with BizTalk Server

How to test HTTP Send and Receive port in BizTalk

I have interviewed around 10 people on BizTalk, none were able to answer this question.

How do I test HTTP Send and Receive in BizTalk?

One guy told me to create a Plugin using DOT Net using webrequest and webresponse objects.

I asked him is there any alternative and quick way of doing the same without writing a Plugin??

He said, He haven’t tried .

Well , there is indeed a quick way to do the same.

IF i have a HTTP physical receive port , with the address as /BTSHTTPReceive/BTSHTTPReceive.dll?GoogleReceive, where GoogleReceive is an unique name.

Now you need to have create 2 ports to test the above HTTP Receive

Port 1: File Receive Port Name: File_ReceivePort

Port2: HTTP Send PortName: HTTP_SendPort

Now the File_ReceivePort will be subscribed to HTTPSend Port, which means , HTTPSend will keep on looking if It is receiving any message from File (In the HTTP Send Port filter setting , use BTS.ReceivedPortName=File_SendPort .

Now the HTTP_SendPort will have the URL as http://YourServerName/BTSHTTPReceive/BTSHTTPReceive.dll?GoogleReceive

(Note GoogleRecive is a unique name for the combination for HTTP Send and HTTP Receive Ports)

and File_ReceivePort will have the location of the receive folder on your file system.

now you have File Receive Port => HTTP Send Port => HTTP Receive Port (Bound to Orchestration(Logical) Receive Port)
Hope my above post helps you in testing on development machine , as there is no customer/client to send a message.

The above post will be modified if there is a discrepancy in the configuration settings or code.

December 25, 2007 Posted by biztalkservertalk | Physical Ports, Receive Ports, send Ports | , , | No Comments Yet

Converting xml to pdf in BizTalk

Businesses are more concerned about reports , that is easily readable. I have seen many users who have posted asking , how to convert xml to pdf files in BizTalk. Well , this can be achievedas follows.

Create a Table in a Database, with the key fields : for Ex: Invoice will contain Invoice #, Customer name, Address, LineItems, further contains LineItem.price,qty and many more to say.

Now you have the table structure.

Create a crystal report (.rpt) which has all the above fields (Name and Value)

For Ex: Invoice No : @InvoiceNo

Now you have a report ready.

The next step is to get the details from the database table and create a temporary DataTable with the values fetched from the Table.

Now the next step is to bind the instance of report created above with the data source.

Now the report has all the details.

PDF accepts the data in base 64 encoded string.

Now the tricky thing here is how do you convert xml into base64encoded string.

read from the stream using stream reader,

put the read stream into a buffer containing bytes

December 24, 2007 Posted by biztalkservertalk | File Formats, biztalk, xml | | No Comments Yet

How to debatch a xml file

I searched the internet to find ways to debatch an xml file and found a way to do the same.

I did not write a custom pipeline component to achieve the same.

What I did is wrote a method which accepts the xpath of the node , you want to debatch , its current node ,count and xml document.

c#

public void batchSplitter(xmldocument xDoc, string xPathOf Node,string xPathOfParent,int index)

//take a back up of the node which you want to retain

XmlNode xmlnodetoInsert;

xmlnode backUpNode =xDoc.selectsinglenode(xPathOf Node + “[" + index + "]” );

xmlnodetoInsert = backUpNode ;

//remove all the nodes from the parent

xmlnode node =xDoc.selectsinglenode(xPathOf Node + “[" + index + "]” );

node.Parentnode.removeall();

//now get the parent node

XmlNode xmlRequestNode = xDoc.SelectSingleNode(xPathOfParent )

//now append the backed up node

parentNode.appendchild(backUpNode);

End method

In the orchestration designer get the count of the nodes (Item) which you are planning to debatch,Ex

nodeCount = System.Convert.ToInt32(xpath(yourXmlMessage, “count(//Item)”));

add a loop shape to the orchestration..

call the method by sending the input message along with the count i.e. nodecount

decrement the nodeCount by 1

loop untill nodeCount > 0

The above concept works for flat files too, just send the xml document created by flat file schema.

Let me know if you have questions.

December 24, 2007 Posted by biztalkservertalk | concepts, xml | , , | No Comments Yet

Hello world!

Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!

December 24, 2007 Posted by biztalkservertalk | Uncategorized | | 1 Comment