Saturday, May 30, 2009

BizTalk: Message Assignment shape. Assign value from one Schema to another Schema.

We can assign one schema to another by many ways. But best way to assign values to one schema from another schema is to use the Message assignment Shape inside the Message Construct shape. Let’s take an example for it.

Example: Conversion of BillingAddress to ShippingAddress. For this I have two Schemas BillingAddress.xsd and ShippingAddress.xsd. All the elements of both schemas are promoted to Distinguished Fields, so that we can access them in message assignment shape. Both schemas are as follows:



Now I have created an orchestration, in which I am assigning the values of BillingAddress.xsd to ShippingAddress.xsd. For this I have created two messages msgBillingAddress and msgShippingAddress of BillingAddress.xsd and ShippingAddress.xsd types respectively. I have created a variable named varXmlDoc of System.Xml.XmlDocument type. My orchestration will look like the follows:

You can see in the image that there I have added a Receive Shape which will accept the msgBillingAddress and at the last you can see that I have added a Send Shape to send the ShippingAddress using msgShippingAddress. Between these two shapes(Receive & Send Shape), I have added a shape through which I am assigning values of BillingAddress to ShippingAddress message. And for this I have added a Construct shape and inside it I have added a Message Assignment Shape.

Now the purpose of this article is to share how to assign one message to another one. I have added the following code to assign BillingAddress to ShippingAddress message.

//Create a new object of XMLDocument. For this we will use the Variable created as XMLDocument.

varXmlDoc = new System.Xml.XmlDocument();

//We need to Load the variable with dummy XML.

//It can be same as generated instance.

//Note here we have to assign that instance that we need in target, not the //source schema.

varXmlDoc.LoadXml(@"<ns0:ShippingAddress xmlns:ns0=""http://SampleXPath.ShippingAddress"">

<Address1>Test Address1</Address1>

<Address2> Test Address2</Address2>

<City>Test City</City>

<State>Test State</State>

<Country>Test Country</Country>



//Assign XMLDocument varSmlDoc variable to ShippingAddress message.

msgShippingAddress = varXmlDoc;

//Assign data to each element

msgShippingAddress.Address1 = msgBillignAddress.Address1;

msgShippingAddress.Address2 = msgBillignAddress.Address2;

msgShippingAddress.City = msgBillignAddress.City;

msgShippingAddress.Country = msgBillignAddress.Country;

msgShippingAddress.State = msgBillignAddress.State;

msgShippingAddress.Zip = msgBillignAddress.Zip;

I think now you can understand how to assign one schema to another schema using Message Assignment shape in BizTalk Orchestration.

Let me know if you have any confusion in this article.

Tuesday, May 26, 2009

BizTalk : The configuration section for Logging cannot be found in the configuration source.

You will find this error while you will running / testing your orchestration. The error is telling that the configuration section for logging cannot be found in the configuration source.

So You will go to change your configuration file. I have done the same.

But it will not resolve your problem. The main problem is not in your application's configuration file. But the problem is in the BTSNTSvc.exe.config file, located in your installcation directory. So please enter the logging details in this file. Then test your Orchestration. I am sure it will resolve your problem.Cheers:)

I am adding the following(at 14th August,2008) after getting comments from some friends(E.R. Joell & PeteM). Thanks buddy:

We needs to add the following block in the BTSNTSVC.exe.config file (that you can find in C:/Program Files/Microsoft BizTalk Server 2006) inside the <configSections></configSections>:


<section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />


And add the following block just after </ConsigSection>:


<loggingConfiguration name="Logging Application Block" tracingEnabled="true"
defaultCategory="General" logWarningsWhenNoCategoriesMatch="true">
<add fileName="C:/log/testrolling.log" rollSizeKB="0" timeStampPattern="yyyy-MM-dd"
rollFileExistsBehavior="Increment" rollInterval="Day" formatter="Text Formatter"
header="----------------------------------------" footer="----------------------------------------"
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
traceOutputOptions="DateTime, ProcessId" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
name="Rolling Flat File Trace Listener" />
<add listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.SystemDiagnosticsTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
traceOutputOptions="DateTime, ProcessId" type="System.Diagnostics.TextWriterTraceListener, System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089"
name="System.Diagnostics TraceListener" initializeData="C:/Trace/TestTractListener.log" />
<add template="Timestamp: {timestamp}&#xD;&#xA;title: {title}&#xD;&#xA;Message: {message}&#xD;&#xA;Category: {category}&#xD;&#xA;priority: {priority}"
type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
name="Text Formatter" />
<add switchValue="All" name="General">
<add name="Rolling Flat File" />
<allEvents switchValue="All" name="All Events" />
<notProcessed switchValue="All" name="Unprocessed Category" />
<errors switchValue="All" name="Logging Errors &amp; Warnings">
<add name="Rolling Flat File Trace Listener" />


Once more thank to give me a such type of comments so that I can update my articles. I like this.

Vijay Modi

Monday, May 25, 2009

The application is already precompiled.

You will get this error when you are going to build your Web Service. To resolve this error please first make sure no .keep file exist in you this web service. Please remove all .keep files and also move the PrecompiledApp.config file. Its resolve my problem. I think its the solution of this error.

Thursday, May 14, 2009

BizTalk Orchestration: How to assign Called Orchestration property of CallOrchestration shape:

When we have Orchestration in the same project, we can select it directly in Called Orchestration property of the CallOrchestration shape. But when we have called orchestration in reference assembly (Another Project), we need to set the Type Modifier property of that orchestration to Public. By default it is Internal. But to use any orchestration as Referece Assembly in another project for CallOrchestration shape, we need to set its Type Modifier property to public and one more thing that the receive shape of that called orchestration must not Activated(i.e. its Activate property should be False). So an so we can find that orchstration in CallOrchestration's reference assembly else not.

Saturday, May 9, 2009

Biztalk : How to comment the Shape used in orchestration?

I am working on Biztalk 2006 R2 and facing a big problem. I have created an orchestration and for temporary purpose I want to comment some shapes that I have used in this orchestration like we are commenting the code in .net. But I have not found any facility in Biztalk to do it. I think microsoft has to add this functionality in this technology. Let me know your reviews, if you want to add.

At this time to resolve this issue, I am using the decide shape and keeping all unwanted shapes in this decide shape which cannot execute. I have added such type of condition which will never true (i.e. 1==0). So at this time I can run my orchestration and can use those commented shapes(insude the above decide shape) in future if I want. Is it ok?

Let me know if you have any new idea.

Tuesday, May 5, 2009

ASP.Net + Access to the path 'C:\Inetpub\wwwroot\Test\images\upload\test.jpeg' is denied.

This error is coming when you are going to upload the file on specified folder. Here I am going to upload test.jpeg in upload folder. When I am going to upload I am getting the following error:

Access to the path 'C:\Inetpub\wwwroot\Test\images\upload\test.jpeg' is denied.


For this you have to give the access to this folder. Please follow the steps to resolve this error:

1> Right click on upload folder. Click on properties.

2> Click on Security tab. You can find the window like following:

3> Click on Add button. You will find the following window.

4> Write the Everyone in the "Enter the objecdt names to select[Select]:" textarea.

5> Click on Check Name button and click on ok button.

6> Give full control rights to this Everyone user.

Now test your application. It will works fine.

Friday, May 1, 2009

Javascript + Replace forward slashes '/' with backward slashes '\'.

Hi friends,

Using following Javascript sysntax you can replace forward slashes ('/') with backward slashes ('\') :
var strReplace = "C:\Temp\Temp1\Temp2\text.jpeg";

strReplace = strReplace.replace(new RegExp(/\\/g),"/");