If you want to parse an XML document with the XmlReader, it might help to use this XmlReader example from MSDN. However, there's one thing missing: If you parse an XML with empty elements, such as:
<example1 />
<example2>bla</example2>
the example doesn't set the closing tags write, but like this:
<example1>
<example2>bla</example2>
</example1>
In order to omit this problem, you have to write the end elements in case that the reader parses an empty element:
case XmlNodeType.Element:
writer.WriteStartElement(reader.Name);
writer.WriteAttributes(reader, true);
if (reader.IsEmptyElement)
writer.WriteEndElement();
break;
Random pitfalls (and their solutions) in EAI technologies such as BizTalk
Tuesday, September 27, 2011
Friday, September 23, 2011
VS/BTS Error "The system cannot find the file specified"
If you receive the error message "The system cannot find the file specified." with the exception code 80070002 while adding a disassembling schema in Visual Studio/BizTalk, it is because VS does not find the assembly from the referenced project with the schema. Just build the referenced project, and then you should be able to add the schema.
Wednesday, September 14, 2011
Error details: The Messaging Engine encountered an error during the processing of one or more inbound messages.
If you have created a flatfile schema, you might run into the following error:
A message received by adapter "FILE" on receive location "..." with URI "D:\dev\TestFlatfileDis\filedrop\*Copy.txt" is suspended.In this case, it might be that your test file is running into an error while reading the lines:
Error details: The Messaging Engine encountered an error during the processing of one or more inbound messages.
Reason: Unexpected data found while looking for:To solve this, check that all the lines go until a certain column. If you can't ensure this, you could define the fields (at the end of the line) with MinOccurs=0, so that it can be omitted.
'\r\n'
The current definition being parsed is Root. The stream offset where the error occured is 13. The line number where the error occured is 3. The column where the error occured is 2.
Wednesday, September 7, 2011
XML-Error Message "content is not allowed in prolog"
When we created a BizTalk Mapping in VS2008, the compiler returned the error "line 1 colum 1 content is not allowed in prolog". Since the compiler told us that the error was detected in the very beginning (line 1 column 1), we needed a bit of time to see that actually the error was inside the document, where we had filled an element with a value although this shouldn't contain one.
So, if you get the same error message, check which fields you filled and if one of these shouldn't be filled.
So, if you get the same error message, check which fields you filled and if one of these shouldn't be filled.
Tuesday, September 6, 2011
32/64-bit Installation of Oracle Adapter
After installing the Oracle Adapter, it might be that you run into errors in run-time, though you solved all the problems so that you could connect to Oracle in VS. ;-) I ran into the following error
System.IO.FileNotFoundException: Die Datei oder Assembly Oracle.DataAccess, Version=2.111.7.20, ...
Actually, the Oracle WCF adapter found the assembly 2.111.7.0, but was searching the Oracle.DataAccess.dll in the BizTalk installation folder:
Furthermore, deploy the policies "policy.2.x.Oracle.DataAccess" into the 32- and the 64-bit GAC to because both VS and the administration console of the BizTalk are searching for the assembly.
System.IO.FileNotFoundException: Die Datei oder Assembly Oracle.DataAccess, Version=2.111.7.20, ...
Actually, the Oracle WCF adapter found the assembly 2.111.7.0, but was searching the Oracle.DataAccess.dll in the BizTalk installation folder:
LOG: Diese Bindung startet im default-Load-Kontext.The problem was inconsistent image-typing: While VS ran in 32bit, the BizTalk host instance ran in 64bit so that it didn't look in the GAC... Using a 32-bit host instance solved the problem; however, more elegant might be to install a 64-bit version of the Oracle.DataAccess (that however could cause problems with a 32-bit VS...)
LOG: Die Anwendungskonfigurationsdatei wird verwendet: D:\Program Files (x86)\Microsoft BizTalk Server 2009\BTSNTSvc64.exe.Config
LOG: Die Computerkonfigurationsdatei von C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\config\machine.config wird verwendet.
LOG: In der Anwendungskonfigurationsdatei wurde eine Umleitung gefunden. 2.111.7.0 wird nach 2.111.7.20 umgeleitet.
LOG: Verweis nach der Richtlinie: Oracle.DataAccess, Version=2.111.7.20, Culture=neutral, PublicKeyToken=89b483f429c47342
LOG: Download von neuem URL file:///D:/Program Files (x86)/Microsoft BizTalk Server 2009/Oracle.DataAccess.DLL.
Furthermore, deploy the policies "policy.2.x.Oracle.DataAccess" into the 32- and the 64-bit GAC to because both VS and the administration console of the BizTalk are searching for the assembly.
Monday, September 5, 2011
Installing Oracle WCF-Adapter
In order to use the LOB WCF-Adapter for Oracle, you have to install an oracle client. Since BizTalk requests the assembly Oracle.DataAccess of version 2.111.7.0 or above, you have to select a correct Oracle client at least in version 11.2.0.21.
Install the client according to Steef-Jan Wigger's explanation. In %oracle%\product\11.1.0\client_1\odp.net\bin\2.x, you find the Oracle.DataAccess and you can put it to the GAC using OraProvCfg.exe that also redirects all assembly invocations to the actual one. (Otherwise, VS throws an error that it can't find version 2.111.7.0).
Additionally, you can add the sqlnet.ora und tnsnames.ora into %oracle%\product\11.1.0\client_1\Network\Admin. You find samples in the "Sample" folder.
ORA-1017: invalid name/password: When you connect from Visual Studio to the Oracle server, make sure to write the username in capital letters, even if the username is not written in capital letters in Oracle (otherwise you get an ORA-1017: invalid name/password error)!
Install the client according to Steef-Jan Wigger's explanation. In %oracle%\product\11.1.0\client_1\odp.net\bin\2.x, you find the Oracle.DataAccess and you can put it to the GAC using OraProvCfg.exe that also redirects all assembly invocations to the actual one. (Otherwise, VS throws an error that it can't find version 2.111.7.0).
Additionally, you can add the sqlnet.ora und tnsnames.ora into %oracle%\product\11.1.0\client_1\Network\Admin. You find samples in the "Sample" folder.
ORA-1017: invalid name/password: When you connect from Visual Studio to the Oracle server, make sure to write the username in capital letters, even if the username is not written in capital letters in Oracle (otherwise you get an ORA-1017: invalid name/password error)!
Labels:
Biztalk,
Oracle,
SDK Adapter Pack 2,
WCF adapter,
WCF LOB adapter
Friday, September 2, 2011
Error Message: "Fehler beim Laden der Eigenschaftenliste anhand des Namespaces, oder Eigenschaften in der Liste nicht gefunden."
On a German installation, the BizTalk server threw the following error message after parsing a message:
Fehler beim Laden der Eigenschaftenliste anhand des Namespaces, oder Eigenschaften in der Liste nicht gefunden, Überprüfen Sie, ob das Schema korrekt bereitgestellt wurde.Actually, this error states already the problem quite good, which is that the message contains a promoted property that doesn't exist in the schema property. So, if you get this error message, go through your code and have a close look at all properties that you set and check whether you've spelled their names correctly.
Labels:
Biztalk,
Pipeline Component,
promoted properties
Tuesday, August 30, 2011
Setting the mail address of Receiver in the Pipeline Component
If you want to send a message with a static or dynamic SMTP send port, you can configure the mail address of the receiver in a pipeline component. Therefore, you have to promote OutboundTransportLocation in the message context of the message:
msgContext.Promote("OutboundTransportLocation", "http://schemas.microsoft.com/BizTalk/2003/system-properties", "mailto:" + mailAddress);
Wednesday, August 24, 2011
How to Filter in Orchestrations on Promoted Properties
If you want to do direct-bounding into an orchestration (for example, because you're implementing an ESB where send ports and orchestrations subcribe directly to the message box), you would define filter expressions in the receive shape.
Basically, you can filter on schema properties that are referenced in the BizTalk project of your orchestration. However, to make them visible (and selectable) here, you have to publish them. You can do this in (at least) two ways:
Basically, you can filter on schema properties that are referenced in the BizTalk project of your orchestration. However, to make them visible (and selectable) here, you have to publish them. You can do this in (at least) two ways:
- First, you could promote a field in the incoming message and link the field to a promoted property. This option helps you if you filter on a field that is inside the message.
- Second - if the data is not part of the message but a header information - you have to set the "property schema base" of the schema property to MessageContextPropertyBase. This way, it gets visible and you can filter on it.
Monday, June 6, 2011
Delete all the Data of a Partition
If you want to delete blocks of data, you usually would like to delete blocks instead of deleting rows. If you at the same time use partitions to store your data, and all the data that you want to delete (e.g. all the data from 2010 and before), you can use the partition commands to realize this. Instead of deleting row by row with the delete-Command
delete * from table where timestamp < '2011-01-01'
you would then truncate the data of the partition(s) that contains this data (from 2010 and before). To do this, you have to create a staging table and then use the SWITCH TO command to move the data to this table. Both steps could be done using the SQL Server wizards. If you have created partitions on a table, you could right-click on the table name, choose "Storage", then "Manage partition":

In the wizard, you choose "Manage partitioned data in a sliding window scenario" and then enable "Switch Out":

The wizard composes now SQL commands to create a staging table with the same columns and indexes as the original table. However, to delete a partition's data you wouldn't need to create all the indexes, it's enough to create the columns. Then you have to invoce the SWITCH TO command to move the data to the staging table:
ALTER TABLE table SWITCH PARTITION 1 TO stagingTable
This is a meta data-operation, no data is moved physically, and thus the data movement doesn't cost a lot. To delete the data, you can then drop the table or truncate it. Both is a block operation and, thus, won't harm the database.
PS: In case, that other tables have foreign keys to this table, you would have to delete this data beforehand (since it might not make sense to have it without its references anyway). Most usually, you would have these referenced tables also partitioned so that you should think about deleting the partitions of referenced tables in the same transaction.
delete * from table where timestamp < '2011-01-01'
you would then truncate the data of the partition(s) that contains this data (from 2010 and before). To do this, you have to create a staging table and then use the SWITCH TO command to move the data to this table. Both steps could be done using the SQL Server wizards. If you have created partitions on a table, you could right-click on the table name, choose "Storage", then "Manage partition":

In the wizard, you choose "Manage partitioned data in a sliding window scenario" and then enable "Switch Out":

The wizard composes now SQL commands to create a staging table with the same columns and indexes as the original table. However, to delete a partition's data you wouldn't need to create all the indexes, it's enough to create the columns. Then you have to invoce the SWITCH TO command to move the data to the staging table:
ALTER TABLE table SWITCH PARTITION 1 TO stagingTable
This is a meta data-operation, no data is moved physically, and thus the data movement doesn't cost a lot. To delete the data, you can then drop the table or truncate it. Both is a block operation and, thus, won't harm the database.
PS: In case, that other tables have foreign keys to this table, you would have to delete this data beforehand (since it might not make sense to have it without its references anyway). Most usually, you would have these referenced tables also partitioned so that you should think about deleting the partitions of referenced tables in the same transaction.
Labels:
Data deletion,
partition,
SQL Server,
SQL Server 2008
Subscribe to:
Posts (Atom)