Wednesday, July 8, 2009

BizTalk: Pass an XLANG message or an XLANG message part to a .Net method call as a parameter in Orchestration. / Call .Net assembly to update the XLan

Today, I go through a solution to send XLangMessage to .net assembly from an Orchestration and update it. After update I need it in my Orchestration. For this I have created a project which I think it can help others.

I have created an Orchestration project named “CallNetAssemblyBySendingXLangMessageAndUpdate”. I have added the following simple schema in this project named “Book.xsd”.

Then I have created added an orchestration named “CallAssemblyXLangMessage.odx” in project. In this orchestration I am receiving the Book.xsd type message in receive shape. After this I have added the message assignment shape in the transform shape to update the values of message received of Book.xsd type. In this Construct shape I am creating a new message of Book.xsd type. In this message assignment shape I am calling the .net assembly in which I am updating the message.

I am sending the message in .Net assembly method as XLANGMessage parameter. Before going further I want to explain how I am accepting the message and updating it and return it.

For this I have added a new Class Library Project named “UpdateXLangMessage” in the Solution.

You need to create the Book class of Book.xsd created in Orchestration project by using XSD.exe util. You can create this class by using the following command at Visual Studio Command Prompt:

xsd.exe /c Book.xsd

This will create a Book.cs class. Add this project in class library project UpdateXLangMessage.

Now to receive XLangMessage and update it I have added the following class in this project.

========================================================

using System;
using Microsoft.XLANGs.BaseTypes;
namespace UpdateXLangMessage
{
public class UpdateMessage
{
public static Book UpdateBookMessage(XLANGMessage xlngMsg)
{
//Serialize message into Book Object
Book objBook = (Book)xlngMsg[0].RetrieveAs(typeof(Book));
try
{
//Update Book Object
objBook.Author = "Vijay Modi"
objBook.BookID = "00001"
objBook.BookName = "Biztalk 2006 R2"
objBook.Price = "Free"
objBook.Publisher = "Testing Publisher"
}
catch (XLANGsException xlngEx)
{
throw xlngEx;
}
catch (Exception ex)
{
throw ex;
}
//return book object
return objBook;
}
}
}

=========================================================

Build this class. Assign a Strong Name key to this project and add it in GAC using following command in Visual Studio Command Prompt.

gacutil /i UpdateXLangMessage.dll

Now we are going back to our Orchestration project. In Orchestration project add the reference of the .Net class library project.

Now in our Orchestration’s message assignment shape write the following expression:

//msgBookNew is the new message created of Book.xsd schema type

//msgBook is the message received in receive shape

msgBookNew = UpdateXLangMessage.UpdateMessage.UpdateBookMessage(msgBook);

Add the send shape just below the Transform shape in the orchestration. Assign the msgBookNew message in this send shape. The orchestration will look like as below:

Now deploy your orchestration project and test it. Some important reference I have found on the net are as below:

Reference:
http://support.microsoft.com/kb/917841
http://msdn.microsoft.com/en-us/library/aa995576.aspx

You can write your comments here:)

Regards,
Vijay Modi

Sunday, July 5, 2009

Biztalk WSE Web Services Publishing Wizard Unable to load the assembly "…..\BTSTest.dll" [System.IO.FileNotFoundException] File or assembly name......

Error: Biztalk WSE Web Services Publishing Wizard Unable to load the assembly "…..\BTSTest.dll" [System.IO.FileNotFoundException] File or assembly name Microsoft.XMLANGs.BaseTypes, or one of its dependencies, was not found.

Solution:

To resolve this error you need to install the BtsAdpaterForWSE20-SP1 and need to add the ASPNet Users in BizTalk Isolated Host user group.

You can use the Start -> Administrator Tools-> Computer Mangement -> Local Users & Groups -> Group -> Double click on BizTalk Isolated Host Users and add the ASPNet user.

Wednesday, July 1, 2009

Could not retrieve transport type data for Receive Location ‘RCVTestLoaction’ from config store. Primary SSO server ‘MYMachine’ failed. Could not ....

Error: Could not retrieve transport type data for Receive Location ‘RCVTestLoaction’ from config store. Primary SSO server ‘MYMachine’ failed. Could not contact the SSO server ‘MYMachine’. Check that SSo is configured and that the SSo service is running on that server.

Solution:

You will receive this error when you have changed password of your local machine. Please note here, when you changes the password of your local machine, it will not set at the SSO’s configuration. Means it will not change the password in the configuration of SSO. So at this time you will receive this type of error. So to resolve this error you need to go to SSO’s configuration and set the new password of local machine. It will resolve your error.

Note: Whenever you change the password of local machine at this time you need to change the password of all Biztalk services including SSO server too.