Showing posts with label FILE Adapter. Show all posts
Showing posts with label FILE Adapter. Show all posts

Wednesday, August 20, 2008

Schema Validation at Port level

Situation:
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

Solution:
- 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.

Tuesday, July 8, 2008

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).

%datetime.tz%: 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.

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

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.


and



Solution
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

Monday, February 4, 2008

Receiveing a File from a File or Ftp Adapter

Situation:
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.

Problem
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.

Solution
- 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)