Friday, September 19, 2008

Tip: Skip Orchestration while Compiling

When you are working on several orchestrations, and need to compile your work, but one of orchestrations is still not working, but you don't care at the moment as you want to compile the other ones. How to do it?

- Right Click on the Orchestration in the Solution Explorer
- Set Build Action to None

- Compile the project and the orchestration will not be taken care of.

Easy feature!

Tip: Error Handling

I had 2 receive locations (1 Receive Port).
Each receive location did validation of a schema in the XmlReceive Pipeline
When an invalid message arrived, i wanted to send an email to the helpdesk and copy the incoming message in the error directory.

I had enabled routing for failed messags in the Receive Port

I created a send port group, adding filter BTS.ReceivePortName = the ReceiveLocation
+ ErrorReport.ErrorType exists.

When an invalid message arrived at the location, I received error entries in the eventlog, but the email nor the copy was processed.

I changed the filter to ErrorPort.ReceivePortName = receivelocation

It worked great.

Wednesday, August 20, 2008

Schema Validation at Port level

When receiving a message at the Receive Port (Location). BizTalk isn't really validating the incoming Xml against th Xsd.

What is happening is that BizTalk looks at the NameSpace + Root Element, place it in the MessageBox and the Orchestrations will pick it up.

But in meany cases, we want to validate the incoming Xml and be sure that the Xml corrspond to the Xsd

- On the receive port, select the XmlReceive Pipeline

- Click on th Properties of the XmlReceive Pipeline
- Set ValidateDocument to true
- Fill in the DocumentSpecNames property

How to find the DocumentSpecNames Value ?

- In the BizTalk Admin Console, go to the BizTalk Application
- Click on the Schemas
- Got to the properties of the Schema you want to Validate
- Concatenate the value of Name and Assembly, using a comma

[Name Value],[Assembly Value]

When using this method, the incoming Xml file will be validated against the given schema. When an error occured in th validation, an error will be written to the eventlog.

Thursday, July 24, 2008

btsharepointadapterws.asmx - Server Error - No Access

After installing the BizTalk Adapter on a SharePoint (SPA1) Server, I wanted to have access to the btsharepointadapterws.asmx webservice via internet explorer.

I receive a Server error, with no extra information.
Even if I played by changing the CustomErrors tag in the web.config, I didn’t receive any extra information.

Open the file
C:\Program Files\Microsoft BizTalk Server 2006\Business Activity Services\BTSharePointV3AdapterWS\web.config

Under System.Web -> WebServices - >Protocols you will see

Put this line as comment and save the file.

No you will have access to the webservice.

Tuesday, July 8, 2008

Stored Procedures parameters and empty nodes.

An Xml file contains data and needs to be uploaded to a DB2 database (Or other database).
The xsd tells us that one of the field’s isn’t mandatory.

A stored procedure who accepts some IN parameters.

A mapping that converts the data from the xml file to the stored procedure schema.

When you use the mapping above, and the name isn’t available in the Import Xml (minoccures = 0), and phone is available, then the stored procedure will throw an error.
The raison is as in the Import Xml file, the mapping can’t find a Name node, the CustomerName node will not be created. This means in our example that we only send 2 parameters instead of 3, and the stored procedure will not find the CustomerName input parameter/


Add to the mapping the ‘Value Mapping’, set the first parameter to true, the second the node you want to copy.
This way, every node in the Xml will be created, even if you send a null value.

List of supported macros

%datetime%: Coordinated Universal Time (UTC) date time in the format YYYY-MM-DDThhmmss (for example, 1997-07-12T103508).

%datetime_bts2000%: UTC date time in the format YYYYMMDDhhmmsss, where sss means seconds and milliseconds (for example, 199707121035234 means 1997/07/12, 10:35:23 and 400 milliseconds). Local date time plus time zone from GMT in the format YYYY-MM-DDThhmmssTZD, (for example, 1997-07-12T103508+800).

%DestinationParty%: Name of the destination party. The value comes from the message context property BTS.DestinationParty.

%DestinationPartyQualifier%: Qualifier of the destination party. The value comes from the message context property BTS.DestinationPartyQualifier.

%MessageID%: Globally unique identifier (GUID) of the message in BizTalk Server. The value comes directly from the message context property BTS.MessageID.

%SourceFileName%: Name of the file from where the File adapter read the message. The file name includes the extension and excludes the file path, for example, Sample.xml. When substituting this property, the File adapter extracts the file name from the absolute file path stored in the FILE.ReceivedFileName context property. If the context property does not have a value, for example, if a message was received on an adapter other than the File adapter, the macro will not be substituted and will remain in the file name as is (for example, C:\Drop\%SourceFileName%).

%SourceParty%: Name of the source party from which the File adapter received the message.

%SourcePartyQualifier%: Qualifier of the source party from which the File adapter received the message.

%time%: UTC time in the format hhmmss. Local time plus time zone from GMT in the format hhmmssTZD (for example, 124525+530).

Tuesday, June 3, 2008

Assemblies in GAC not showed in Add Reference dialog


I created a GeneralBiztalkHelper Dll, I placed it in the GAC and want to use the assembly later in other projects.

When I wanted to add it to the new project via Add Reference,  I didn't saw the assembly listed.



The list of assemblies used in the Ad Reference  dialog isn't populated from the GAC but from the following directory


Friday, May 30, 2008

File transport does not have read/write privileges for receive location

Situation:When creating a File Locations, linked to a share directory, i always received the following 2 errors:
The errors are telling that the "File transport does not have read/write privileges for receive location..."

The Host Instance User has modify permissions on the shared folder.


You need to
Delete Subfolders and Files attribute is not set when the Modify property is set, you need to add the FILE_DELETE_CHILD "Delete Subfolders and Files" Attribute

Wednesday, April 16, 2008

Error: ...The failure may be cuased by the fact that under the default settings SQL Server does not allow remote connections

While deploying my BizTalk Project i received the following error

- Open the Properties of the project,
- Under Configuration properties, select Deployment
- Check if the server is correct

Friday, April 4, 2008

Replace " (double quotes) from Field Elements with Xslt

I receive a CSV file, all string values are surrounded by " (double quotes).
This is normal for a CSV file, to use with Excel. But when I need the values of these fields in my Xml to send to SharePoint, you can understand that I don't want to have those double quotes in the fields.

I didn't find in my map a functiod to Replace those double quotes

I created a map with a Custom Xlst, and used the function Translate for each field

I added this map to the receive port. Once the Xml file arrives in my Orchestration,the double quotes are gone.

Friday, March 14, 2008

Flat File Disassember Error: Unexpected end of stream while looking for

I receive a flat file, going thru a receive pipeline with a Flat File Disassembler Component. And I received the following error:

There was a failure executing the receive pipeline: "OmnioApplication.Pipelines.ReceiveFlatOmnioFile_IncomingRequest, OmnioApplication, Version=, Culture=neutral, PublicKeyToken=99f7db139ef9cf70" Source: "Flat file disassembler" Receive Port: "OmnioFlatPort" URI: "D:\TestArea\Omnio\Input\IncomingRequest\*.txt" Reason: Unexpected end of stream while looking for:
Positional data (length is 24)
The current definition being parsed is RequestRevenue. The stream offset where the error occured is 72. The line number where the error occured is 2. The column where the error occured is 33.

While checking the Flat File I saw that the last line was an empty line. This means that after the last record, a carriage return was added.

So I went to the XSD of the flat file in Visual Studio and selected the Root Element
Within the properties I changed Child order to PostFix and it worked.

Friday, March 7, 2008

Documentate BizTalk Applications

This will be a short blog message, to documentate your BizTalk Applications download UK SDC BizTalk 2006 Documenter

UK SDC BizTalk 2006 Documenter
Creates compiled help files for a given BTS 2006 installation. This tool can be run on an ad-hoc basis using the UI or from the command line as a post build/deploy task to create a compiled help file describing a BTS 2006 installation. It will compile: BTS Host configuration, Send/Receive port configuration, Orchestration diagrams, Schema and Map content, Pipeline process flow, Adapter configuration, Rule engine vocabularies and policies, More… and publish them as compiled help files. Optionally you can embed custom HTML content and custom descriptions for all BTS artifacts to produce a more customized look and feel to the CHM output.

Download link:

Wednesday, March 5, 2008

Determine the Version of BizTalk Installed

Check the version on Test, Validation and Production Server.

Open regedit and got to
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\BizTalk Server\3.0\

You will find the information you need and compare with the other systems.

Tuesday, February 12, 2008

Copy Any-Element to a typed structure

Situation:I received a SSDN reply, the schema contained a element.
This element can contain different other xml data, depending on the request.
I need to map the content of the element to a structured format.

Schema of the incoming XML file (with the element):

Schema of the Output-Xml, this schema = the structure within th element

BizTalk can’t link elements, the Mass copy didn’t work as there are more fields next to above the any-element at the same level. (See XSD schema)

Add a Message Assign shape to your Orchestration
Add the following code

IdentifyPersonResultMsg = xpath(SSDNReplyMsg, "/*[local-name()='SSDNReply']/*[local-name()='ServiceReply']/*[local-name()='IdentifyPersonReply']");

I just use an xpath query to get the content in the element and I place the result I the correct message.
In this case IdentifyPersonResultMsg has the message type as the element

Message constructed on the Construct Shape: IdentifyPersonResultMsg

Wednesday, February 6, 2008

Uploading Documents to a SharePoint Document Library containing different Content Types

A document library in SharePoint contains several Content Types. BizTalk will upload documents to the document library in SharePoint.
When uploading via BizTalk the document to SharePoint, I need to say which Content Type the document is linked too.

When uploading the document and adding the Metadata needed for the content type of the document, I saw that SharePoint always uses the default content type.
So metadata not used in the default content type is discharged.
How can I tell the WSS adapter which content type to use?

The solution is very simple; the name of the content type is also metadata.

In the orchestration, add a Message Assign Shape
Add the following code to the Message Assign Shape:

SharePointOutMsg(WSS.ConfigPropertiesXml) = "<ConfigPropertiesXml><PropertyName1>Content Type</PropertyName1><PropertySource1>My Custom ContentType</PropertySource1> [Add more custom metadata] </ConfigPropertiesXml>";

Tuesday, February 5, 2008

Creating an 0kb File

For a project I needed to create an XML file and also a 0kb Control file.
This 0Kb file is needed for the external software to know for sure when the Xml file is created. Only when the 0Kb file is available, the external software will read the Xml file.
This situation is still frequently used in the environment I work (Mainframe, old VB6,….)
A Some Microsoft consultant told us to create an custom pipeline and did some custom coding.

How to create an 0Kb file with BizTalk without creating a custom pipeline with custom code.

Create a Flat File Schema, called CrtFile

Set the following schema parameter:
Default Child Delimiter Type: none
Default Escape Character Type: none
Default Pad Character Type: none
Default repeating Delimiter Character Type: none
Default Wrap Character Type: none

Set the following properties on the root node:
Child Delimited Type : none
Child Order: infix
Escape Character Type: none
Nillable: true
Preserve Delimiter for Empty Data: No
Suppress Trailing Delimters: No

Create a Flat File Send Pipeline
Add the Flat File assembler to the Assemble Block.

In the Orchestration,
Add a message assign shape and add the following code

//-- Initialize the CrtFile Variable --
tempXmlDoc = new System.Xml.XmlDocument();
tempXmlDoc.LoadXml("<?xml:namespace prefix = ns0 /><ns0:root ns0="http://My0kbProject.Schemas.CrtFile"></ns0:root>");

zeroKbMsg = tempXmlDoc;

When sending the zeroKbMsg to the File Adapter, using the FlatFileSendPipeline, you will have an 0kb file created.

Monday, February 4, 2008

Receiveing a File from a File or Ftp Adapter

I have an orchestration, receiving an XML-file from via the File Adapter. I need the filename to store in a database.
When placing the project in the production environment, we decided to use the FTP adapter instead of the File Adapter.
With BizTalk, It should be easy to change the receive ports.

I used in my orchestration line of codes like ReceiveXmlMessage(FILE.ReceivedFileName), but when changing the File Adapter to FTP adapter in the BizTalk Administration Console, something went wrong.

- Create a variable: fileName in your Orchestration
- Add an Expression Shape to you Orchestration
- Add the following Code into the expression shape:

tempString = "UNKNOWN";
if(FILE.ReceivedFileName exists ReceiveXmlMessage)
fileName =ReceiveXmlMessage(FILE.ReceivedFileName);
else if(FTP.ReceivedFileName exists ReceiveXmlMessage)
fileName =ReceiveXmlMessage(FTP.ReceivedFileName);

Not working Solutions:
I thought the following code would work, but I received an error saying that ReceiveXmlMessage(FTP.ReceivedFileName) was empty while using the File Adapter.

Not working code:
fileName = ReceiveXmlMessage(FILE.ReceivedFileName) + ReceiveXmlMessage(FTP.ReceivedFileName)