Monday, May 19, 2008

SOA and ESB Architecture with BizTalk

Searching info about ESB Guidance, I found a recent little book (25 pages) by Robert V. Hogg & Ewan Fairweather, that seems to be very interesting.

This is the link http://www.wrox.com/WileyCDA/WroxTitle/productCd-047027011X.html.

BizTalk Accelerator for SWIFT 2008 Message Pack

BizTalk Server Team have launched Evaluation Program of BizTalk Accelerator for SWIFT 2008 Message Pack to test the next release of this product. BizTalk Accelerator for SWIFT 2008 Message Pack will provide compliance with SWIFT 2008 Standards Release Guide (SRG) specification.

The planned release schedule is:

- June 23, 2008 -> CTP
- July 21, 2008 -> Beta
- September 5, 2008 -> RTW

The 2008 Message Pack will include:

- Complete re-packaging of all SWIFT FIN Flat File message types and business rules.
- Updates to all message schemas and business rules for compliance with SWIFT 2008 Certification requirements.
- Roll-up of all schemas and business rule Hot fixes not superseded by 2008 requirements.
- Validation of SWIFT Reference data as a business rule rather than a schema

Friday, May 09, 2008

Endless XmlDisassembler

This is a curious behaviour of XmlDisassembler component. My problem was that I have developed a custom XmlDisassembler, that inside uses BizTalk XmlDisassembler component (Microsoft.BizTalk.Component.XmlDasmComp).

My component disassembles the message with the BizTalk component and discard some of the returned messages, based on some conditions. The problem is when I call XmlDasmComp's GetNext method, never ends.

Why? The problem is that in my conditions to discard the returned messages, I don't need to read the returned message. Inside the XmlDasmComp, in GetNext2 private method, it test a property 'IsNewDoc' to retrieve a new message or not. This property is updated only when we read the returned message.

Why this property is updated only when we read the returned message? Obvious, in BizTalk standard behaviour, it always read the returned message before to call GetNext method other time.

Standard behaviour in a BizTalk disassemble is:

1) XmlDasmComp.Disassemble
2) XmlDasmComp.GetNext (First Message)
3) Validate and ResolvePartyComponents (this components can read the message)
4) Receive Pipeline ends, then BizTalk READ THE MESSAGE
5) XmlDasmComp.GetNext (Second Message)
...
Until GetNext method returns a null message.

In my component, I was calling GetNext method continuosly without reading the message, so 'IsNewDoc' never was updated and GetNext method never ends.

Solution is, after calling GetNext method, I read the message and then I seek to the begin the message (If no, the internal Stream is in the last position and next components couldn't read it)

Thursday, May 08, 2008

Deploy Orchestrations: "Failed to update binding information"

Yesterday, I was redeploying an orchestration through BizTalk MMC -> MyApplication -> Add -> BizTalk Assemblies... with "Overwrite all" checked, when I received this error:



The detail error said that "Receive Location 'Receive Location MQ por FILE' has no Transport type specified.". I was confused, because Receive Location 'Receive Location MQ por FILE' didn't exists, it was a Receive Location that I have deleted weeks ago.

Searching for BindingInfo inside my computer, I discovered that BizTalk stores info about the last deployments in C:\Documents and Settings\[user name]\Application Data\Microsoft\BizTalk Server\Deployment\BindingFiles (over Vista in C:\Users\[user name]\AppData\Roaming\Microsoft\BizTalk Server\Deployment\BindingFiles).

When you do a redeployment, BizTalk uses this information. If this information is erroneous, we get this error "Failed to update binding information".

Solution is easy, remove the info binding file and we can redeploy our orchestration.

Sunday, April 27, 2008

Set Filename for the Attachment

If we want to send message through a SMTP Port with attachments and we want to set the attachment's filename, we have to set MIME.FileName property.

When we are designing the orchestration, Intellisense don't show us this property:



We have to write "Message_1(MIME." and Intellisense will show us this property:



This is because MIME.FileName is a PartContextPropertyBase and Intellisense by default only show us the MessageContextPropertyBase properties.

SMTP Adapter - "Unknown Error Description"

If inside an orchestration, we set SMTP.EmailBodyText property in a message and we don't set SMTP.EmailBodyTextCharset, we receive "Unknown Error Description" when we send this message through a Dynamic Port.

To avoid this error, we have to set SMTP.EmailBodyTextCharset property.

More information in http://msdn2.microsoft.com/en-us/library/aa578225.aspx.

Thursday, April 24, 2008

BizTalk Server 2006 R3

Yesterday, in BizTalk Server Team Blog and in Steven Martin's blog, announced their plans to deliver BizTalk Server 2006 R3.

At high level, new features will be:

- New web service registry capabilities with support for UDDI (Universal Description Discovery and Integration) version 3.0
- Enhanced service enablement of applications (through new and enhanced adapters for LOB applications, databases, and legacy/host systems)
- Enhanced service enablement of “edge” devices through BizTalk RFID Mobile
- Enhanced interoperability and connectivity support for B2B protocols (like SWIFT, EDI, etc)
- SOA patterns and best practices guidance to assist customer’s implementations

They expect to deliver a CTP of BizTalk Server 2006 R3, later this year and an RTM in H1 CY09.

They have also launched the BizTalk Server 2006 R3 TAP program.

Wednesday, April 02, 2008

XmlAsmException (HRESULT = 0xc0c01829) And XmlDasmException (HRESULT = 0xc0c01470)

XmlAsmException (HRESULT = 0xc0c01829) And XmlDasmException (HRESULT = 0xc0c01470) are exceptions without an error message.

Using Tomas Restrepo's error lookup utility (see my previous post), we can get a more detailed message:

0xc0c01829 = "BtsErrorAssemblerDoctypeDoesntMatchSchemas"
0xc0c01470 = "BtsErrorDisassemblerDoctypeDoesntMatchSchemas"

This error message means, that the provided schemas don't match with:
<message root element name> or <message namespace>#<message root element name>

This is the obvious error, but also we can get both error messages if our message has the DocumentSpecName context property setted.

The problem is that the standard biztalk's assemblers and disassemblers, override the DocumentSpecNames property of the XML Assembler/Disassembler pipeline components and the Document Schema property of the Flat File Assembler/Disassembler pipeline component if we set the message's DocumentSpecName context property.

Monday, March 31, 2008

Pipeline Components Error Lookup

Here is a Tomas Restrepo very useful utility class to translate HRESULT error codes from pipeline components (XML Disassembler, ...) to a understandable error code:

http://www.winterdom.com/dev/bts/BtsErrorLookup.cs.txt

For example, in my last application I get from Flat File Assembler an empty error message with HRESULT = 0xc0c01829. The Tomas Restrepo utility class, translate it to "BtsErrorAssemblerDoctypeDoesntMatchSchemas", that helps me to solve the error.

More information in:

http://technet.microsoft.com/en-us/library/microsoft.biztalk.component.aspx

For example:

http://technet.microsoft.com/en-us/library/microsoft.biztalk.component.xmlasmexception.btserrorassemblerdoctypedoesntmatchschemas.aspx

Friday, February 29, 2008

Bug: You may receive a WSE590 exception in Web Services Enhancements 3.0 for Microsoft .NET when you try to implement OASIS Web Services Security 1.0

I have encountered with this error with WSE 3.0: You may receive a WSE590 exception in Web Services Enhancements 3.0 for Microsoft .NET when you try to implement OASIS Web Services Security 1.0.

The proposal solution is set KeyIdentifier myKeyIdentifier = new KeyIdentifier("MIGfMa0GCSq");

I was using MutualCertificate11Assertion and for that, I take advantage that this assertion uses an X509Certificate.

I propose a better and cleaner solution:

1) In our Assertion class, we inherit directly from MutualCertificate11Assertion.
2) In our Filter class:
2.1) A private X509Certificate2 attribute (_certificate).
2.2) In constructor declaration, add a X509Certificate2 parameter (certificate).
2.3) Inside constructor, set _certificate = certificate.
2.4) Instead of KeyIdentifier myKeyIdentifier = ... line, set KeyIdentifier myKeyIdentifier = new KeyIdentifier(System.Convert.ToBase64String(_certificate.GetCertHash()));
3) From our Assertion class, pass this.ServiceX509TokenProvider.GetToken ().Certificate to the Filter class constructor.

Thursday, February 21, 2008

Changing SSO Master Secret Server from one Server to another

If we want to change Master Secret Server from their current server to another, we have to execute on current Master Secret Server (Server1):

"C:\Program Files\Common Files\Enterprise Single Sign-On\ssoconfig.exe" -backupsecret ssosecret.bkp

Create on the new Master Secret Server (Server2) an XML file (ssoserver.xml) with this content:

<sso><globalInfo><secretServer>SERVER2</secretServer></globalInfo></sso>

And execute:

"C:\Program Files\Common Files\Enterprise Single Sign-On\ssomanage.exe" -updatedb ssoserver.xml

Then execute:

"C:\Program Files\Common Files\Enterprise Single Sign-On\ssoconfig.exe" -restoreSecret ssosecret.bkp

And finally, you can test that is correct executing a backupsecret on each server.

Here is a complete sequence:

Server 1
C:\>"c:\Program Files\Common Files\Enterprise Single
Sign-On\ssoconfig" -backupsecret ssobackupsecret.bkp
Password : ***********
Confirm Password : ***********
Password reminder : Reminder
The operation completed successfully.

Server 2

D:\>"c:\Program Files\Common Files\Enterprise Single Sign-On\ssomanage.
exe" -updatedb ssoserver.xml
Using SSO server on this computer

Updated SSO global information with the following values -

SSO secret server name : SERVER2
SSO Admin account name : NOT CHANGED
SSO Affiliate Admin account name : NOT CHANGED


D:\>"c:\Program Files\Common Files\Enterprise Single Sign-On\ssoconfig.
exe" -restoreSecret ssobackupsecret.bkp
Password reminder : Reminder
Password : ***********
The operation completed successfully.

Server 1

C:\>"c:\Program Files\Common Files\Enterprise Single
Sign-On\ssoconfig" -backupsecret ssobackupsecret2.bkp
ERROR: Secrets can only be backed up on the master secret server.
ERROR: 0xC0002A0E : This function can only be performed on the master secret ser
ver.

Wednesday, January 02, 2008

Orchestration Expressions: exists and succeeded operators

exists Operator

This operator inside an Orchestration allow us to determine if a message context property exists in a message.

Syntax:
<Message Property Name Message Part Property Name> exists <Message Variable Name Message Part Name>

Example:
BTS.AckType exists msgIn

This is util to avoid 'There is no value associated with the
property <property> in the message.' error message when we get the value of a property, for example:

if (BTS.AckType exists msgIn)
{
myAckType = msgIn(BTS.AckType);
}


succeeded Operator

This operator is very usefull when we want to use a message (that is constructed inside a transaction) in a handling exception block inside an Orchestration.

For example, if we construct msgOut inside transaction Transaction_1 and in the handling exception block, we write in a expression shape:

System.Diagnostics.Debug.WriteLine ("Received Port was: " + msgOut(BTS.ReceivePortName));

We will receive this error: use of unconstructed message 'msgOut'

But if we write this code, we get the desired behaviour and no compilation error:

if (succeeded(Transaction_1))
{
System.Diagnostics.Debug.WriteLine ("Received Port was: " + msgOut(BTS.ReceivePortName));
}

Wednesday, December 19, 2007

Call SubmitDirect Adapter from Orchestration

If we want call SubmitDirect directly from Orchestration, we will get this error:

"The Messaging Engine failed to register the adapter for "Submit" for the
receive location "submit://submitrequest". Please verify that the receive
location is valid, and that the isolated adapter runs under an account that
has access to the BizTalk databases."


This error is because SubmitDirect adapter needs to run in an Isolated process, because is an Isolated adapter.

My solution is convert this adapter in an In-Process adapter. This is simple, we need to do 2 changes in the SubmitDirect solution:

1) Implement IBTTTransportControl at BizTalkMessaging class (in MessagingAPIs.cs at TransportProxyUtils project), for example:

public void Initialize(IBTTransportProxy transportProxy)
{
_tp = transportProxy;
}

public void Terminate()
{
}

2) Change RegisterAdapter.cs in TransportProxyUtilsReg project:

Change this line "rkBizTalk.SetValue("Constraints", 0x00000081);" with "rkBizTalk.SetValue("Constraints", 0x00000089);"

First change is to implement all interfaces that need an In-Process adapter (see BizTalk documentation "Interfaces for an In-Process Receive Adapter").

Second change is to indicate that our adapter is hosted in-process (see BizTalk documentation "Registering an Adapter -> Constraints -> eProtocolReceiveIsCreatable flag).

With this changes, we build the solution and then, we register our custom SubmitDirect adapter and voilà, we can call SubmitDirect adapter from a Orchestration without errors, because our adapter will run within BizTalk process.

Monday, December 17, 2007

XPath inside BizTalk

XPath is a powerfull feature in BizTalk solutions, but is little complicated when we have a lot of namespaces and elements.

If we develope a solution wich uses this feature, it can be very frustrating, because it's a thorny issue.

There is a good tool that help us to test our xpath expressions, XPathmania.

This tool is a plug-in for Visual Studio 2005 and allows us to do queries against a XML document. After install it, we open this tool in View -> Other Windows -> Xpathmania menu:


If we open a XML document, we can test our xpath queries:


If xpath query is correct, Xpathmania will set the backcolor of selected nodes to green. If it is any sintax error in our query, Xpathmania will tell us the error:

Sunday, December 09, 2007

"No XOP Parts"

Due to a bug in Axis2 1.3, when we call a web service from a .NET application using WSE 3.0 and MTOM, we receive this error: "WSE1608: No XOP parts were located in the stream for the specified content-id: ...".

The problem is that in Axis2 response we receive something like this:

HTTP/1.0 200 OK
Date: Sun, 09 Dec 2007 10:41:00 GMT
X-Powered-By: Servlet 2.4; Tomcat-5.0.28/JBoss-3.2.7 (build: CVSTag=JBoss_3_2_7 date=200501280217)
Content-Type: multipart/related; boundary=MIMEBoundaryurn_uuid_E3F73E4E791CD88AAB1197196860587; type="application/xop+xml"; start="0.urn:uuid:E3F73E4E791CD88AAB1197196860588@apache.org"; start-info="text/xml"
Set-Cookie: BIGipServerhttp_87_integracion= 50571456.22272.0000; path=/
Connection: close

--MIMEBoundaryurn_uuid_E3F73E4E791CD88AAB1197196860587
Content-Type: application/xop+xml; charset=utf-8; type="text/xml"
Content-Transfer-Encoding: binary
Content-ID: <0.urn:uuid:E3F73E4E791CD88AAB1197196860588@apache.org>


The problem is with start attribute, that doesn't match with the content-id of the object root, because it hasn't < and >. According to RFC 2387: "The 'start' parameter, if given, points, via a content-ID, to the
body part that contains the object root."
.
A example from this RFC:

Content-Type: Multipart/Related; boundary=example-1
start="<950120.aaCC@XIson.com>";
type="Application/X-FixedRecord"
start-info="-o ps"

Content-Type: Application/X-FixedRecord
Content-ID: <950120.aaCC@XIson.com>


Here is a link to this issue from Axis2:
https://issues.apache.org/jira/browse/AXIS2-3196.
Here is a link to the culprit version change: http://svn.apache.org/viewvc?view=rev&revision=555276.
Here is a link to the correct version change: http://svn.apache.org/viewvc?view=rev&revision=573037.

Here is the .NET call, that is correct according to RFC:

POST /services/SOAPService HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.1433)
VsDebuggerCausalityData: uIDPo/roRa0+I2ZGg8sva4yaNrAAAAAA0oIuYeGHw0WWedV3KmBPQfNgOTYMehBNh8VxIFQqoJ8ACAAA
SOAPAction: "process"
Host: test.host.com
Content-Type: multipart/related; type="application/xop+xml"; boundary=--MIMEBoundary633327972312845535; start="<0.633327972312845535@example.org>"; start-info="text/xml; charset=utf-8"
Content-Length: 1358
Expect: 100-continue
Proxy-Connection: Keep-Alive

----MIMEBoundary633327972312845535
content-id: <0.633327972312845535@example.org>
content-type: application/xop+xml; charset=utf-8; type="text/xml; charset=utf-8"
content-transfer-encoding: binary

Monday, November 26, 2007

Custom Pipeline FTP Component Error: "Ran out of memory"

We have developed a custom pipeline component that writes in context FTP properties, such as BeforePut, UserName, ...

When we are testing this component we received an unusual error: "Ran out of memory".

After discard memory problems, we realize that our problem was that...Password was not properly setted!!

We set Password FTP Context property ("http://schemas.microsoft.com/BizTalk/2003/ftp-properties") and our "Ran out of memory" error disappears.

Saturday, November 24, 2007

SOA Conference 2007 at Madrid

Next December 4 at Madrid, Microsoft announces SOA Conference 2007 in Spain. My friend Tomás Hernández will talk about "BizTalk Adapters for WCF".

Here is a complete agenda:
http://www.microsoft.com/spain/sunegocioconectado/agenda.aspx

Friday, November 23, 2007

MQSC Adapter error

We have installed MQSC adapter for BizTalk, with WebSphere MQ Client 6, with fixpack 6.0.2.2.

Our MQ Servers are MQ WebSphere 6, one in Z/OS Server and other in a Windows 2003 Server.

When we defined a Receive Location and try to get a message, we received this two errors:

"The adapter "MQSC" raised an error message. Details "Failure encountered while attempting to get message from queue. queue = <QueueName>, queueManager = <QueueManagerName>, reasonCode = 2354"."

"The MQCD structure was not valid. The value of 'Version' field has the value '0'. This value is invalid for the operation requested."

We was investigating in this issue, when we find this post:
http://biztalk.softwareheadlines.com/mqsc-adapter-mqseries-client-adapter-extended-transaction-t3299.html

We try this solution and it works!!

Our channel name (for example CHANN.NAMES.SVRCONN) had sufficient length to produces the error. We change the channel name with a shorter name (CHANN.NAMES) and works ok.

Solution is give a channel name one char less that maximum length.

Wednesday, November 21, 2007

Download the Visual Studio 2008 Express Edition All-in-One DVD

Since few days ago is possible to download Visual Studio 2008 in an ISO image. Here is the link:
http://go.microsoft.com/fwlink/?LinkId=104679

Also for instructions on burning the Visual Studio Express Editions DVD there is this link:
http://www.microsoft.com/express/download/offline.aspx

Thursday, November 15, 2007

Web Parts Personalization Providers

As I say in my previous post, today I found a lot of problems when I deploy my application in an integration environment.

Web Parts Personalization was a problem, because I can't use the default database to store the personalization values.

We found two posible solutions in this links:
http://msdn2.microsoft.com/en-us/library/aa479037.aspx
http://www.kowitz.net/files/source/XmlFilePersonalizationProvider.cs.txt

First of two, allow to store values in a txt file and second allow to store values in an XML files.

Both examples, build a class that derives from ProviderBase class. I use txt file provider, I customize the class, because I need more functionality. For example, I implemented this method that recognize when a user has personalization data:

public override int GetCountOfState(PersonalizationScope scope,
PersonalizationStateQuery query)
{
if (File.Exists(GetPath(query.UsernameToMatch, query.PathToMatch)))
return 1;
else
return 0;
}


It works ok and now, I don't need the default personalization database.