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.

No comments: