Monday, 31 December 2012

BizTalk Error : a correlation may be initialized only once

While Intializing correlation set in Orchestration loop, you might get the following specified error.

Error : "a correlation may be initialized only once"

The solution for this is to add new scope and move your send shape inside scope, Create this correlation set inside this scope, will resolve this errror.

A very good article xplaining this you can find on Rohit Blog. Correlation Error

Friday, 28 December 2012

XPATH Testing TOOL

Hi Friends,

I was working on XML message in BizTalk expression editor for specific business requirement  and wanted to read few values based on XPATH. I was specifying the XPATH in expression editor and then running BizTalk application but unfortunately not able to get the desired response. Tried many time changing XPATH in expression editor But every time changing in BizTalk orchestration and then build/deploy and restart host-instance was too much time consuming process. So thought to write a Simple C# console application to test my XPATH.

But Then I found on internet that There is already an online tool to test your XPATH with input XML message/data. I checked and  it worked for me. Thanks to this it resolved my XPATH problem in just few minutes. So thought share it with all who need it.

XPATH  Tester  :   http://www.xpathtester.com/

Tuesday, 18 December 2012

Javascript Popup with background blocked

Created a simple .aspx page to show Javascript Popup, which will block the background.

To implment this, we need to create.
  1. Css - style for DIV
  2. JavaScript - to support this functionality
  3. DIV tage in .aspx page - used to show/hide on click
  4. Button - to get Event

Following is the simple sample code that, You can use for this fucntionality.

<html>
<
head>
<script type="text/javascript">function showPopUp(el) {
var cvr = document.getElementById("cover")
var dlg = document.getElementById(el)cvr.style.display =
"block"dlg.style.display = "block"if (document.body.style.overflow = "hidden") {cvr.style.width =
"1024"cvr.style.height = "100%"}
}
function closePopUp(el) {
var cvr = document.getElementById("cover")
var dlg = document.getElementById(el)cvr.style.display =
"none"dlg.style.display = "none"document.body.style.overflowY = "scroll"}
</script>

<style type="text/css">#cover {
display: none;
position: absolute;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
background: gray;
filter: alpha(Opacity = 50);
opacity: 0.5;
-moz-opacity: 0.5;
-khtml-opacity: 0.5}
#dialog {
display: none;
left: 100px;
top: 100px;
width: 300px;
height: 300px;
position: absolute;
z-index: 100;
background: white;
padding: 2px;
font: 10pt tahoma;
border: 1px solid gray}
</style>
</
head><
body><
form runat="server"><
div id="cover"></div><
div id="dialog">Popup DIV<br/><input type="text"/><asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br/><input type="button" value="Submit"/><br/><a href="#" onclick="closePopUp('dialog');">[Close]</a></
div><
a href="#" onclick="showPopUp('dialog');">Show</a></
form></
body></
html>

JavaScript to hide/show DIV

ASP.NET, Toggle DIV on button click

To toggle DIV using javascript,we simply add a button in .aspx page and DIV with menu itme in it. which will toggle based on onclick/onmouseover event.
  1. Add button in .aspx page
<asp:Button ID="Button1" runat="server" Text="Send to my Facebook" Width="20px" OnClientClick="toggle('mnDv');" />

   2.Add DIV  to toggle onclick event
<div id="mnDv" runat="server"><asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal"><Items><asp:MenuItem NavigateUrl="~/Default.aspx" Text="Home"/><asp:MenuItem NavigateUrl="~/About.aspx" Text="About"/></Items></asp:Menu></div>
3 .Add Javascript method hide/show DIV

<script type="text/javascript">function toggle(id) {
var o = document.getElementById(id);o.style.display = (o.style.display ==
'none') ? 'block' : 'none';}
</script>
4 . Now click on toggle button to hide/show DIV.
This can also work of  onmouseover event of button.
Enjoy....Happy Coding.

Tuesday, 4 December 2012

BizTalk Debatching message using Custom Pipeline

The following article explain "Splitting/Debatching message using Custom Pipeline component".

Message Splitting, promoting everything happens in Pipeline, So to achieve our output(Splitting) we need to write custom pipeline component. We need to split the message in pipeline component, need get the message based on our Splitting criteria from XML.

Following link explain the creating custom Pipeline component


http://www.codeproject.com/Articles/17140/Debatching-Large-Messages-and-Extending-Flatfile-P

Thanks to blogs.msdn.com and codeproject.com

BizTalk : Accessing context/Promoted properties within maps.


BizTalk does not provide  any asset or control using which we can use Context/Promoted property in maps. It say instead of using specific field of message use entire message as source input to map.

Promoted Property  : This property are used for content based routing, If we want to use any schema field outside the Orchestration then we can promote that field.  Once the property is promoted It will be accessible outside the Orchestration like in send port filter. Based on this promoted property we can make required routing decision.

Now, If some specific  design/development require a Context/Promoted property value in the map then for this case we need to implement a custom functoid  to read a Context/Promoted property value. We can use the following link dll and refer to this project, This link exactly explain how to do this. Instead of developing custom functoid we can use the dll shared on CodePlex and blog.

    - download dll


Thanks to BizTalk247 and Codeplex.com

Tuesday, 27 November 2012

BizTalk Consuming Schema/Orcehstration Service Endpoint

Error :

Cannot process the message because the content type 'text/xml;charset=UTF-8' was not the expected type 'application/soap+xml; charset=utf-8'.

Solution:

This Error could be thrown by service when there is binding mismatch between the client/server. Make sure your client application and Server is having same Binding type.
In BizTalk:
Transport Type of your Receive location must match with client.
TransportType : WCF-WSHttp/WCF-BasicHttp, must be same as client

BizTalk: Publishing Schema as WCF Endpoint Error


While working with Schema published as WCF service, after publishing schema as WCF endpoint when I tried to consume the service in client application I got the following error
“There was a failure executing the receive pipeline: "Custom.XmlReceive, Custom.BT.Pipelines, Version=1.0.0.0, Culture=neutral, PublicKeyToken=bf32dc0ac0a61497" Source: "ConsumConfig" Receive Port: "" URI: "/Custom/Test.svc" Reason: Could not find default endpoint element that references contract 'TrimProxy.ITriming' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element”
My process flow is as follow
WCF service (Schema Endpoint) hosted on IIS server, calling BizTalk application. I was using some custom pipeline component for XMLReceive, This custom pipeline component was consuming few services, endpoint defined in  BTSNTSvc.exe.config file.
Now I got this error as my WCF Service is not able to find service endpoint setting used for Pipeline component, which is defined in BTSNTSvc.exe.config file.
Now question is “Why my WCF service is not able to read my   BTSNTSvc.exe.config file setting required for custom pipeline component?”
Answer:
As BizTalk uses two different Host process
·         BizTalkServerApplication : this host is used by all BizTalk application , This process read all required config setting from BTSNTSvc.exe.config
·         BizTalkServerIsolatedHost: All web/wcf service use this host, Know only web.config file.
As the WCF service which we have published run under BizTalkServerIsolatedHost ,This process read all configuration setting from local web.config file, When I tried to consume the published endpoint at run time it gave me above specified error, as the service is not able to find Endpoint setting required for Custom Pipeline component. And hence throw an error related to endpoint.
Solution for Error:
Just copy your required configuration setting from BTSNTSvc.exe.config and put it in Web.Config file of WCF service (IIS Virtual Directory).This will resolve your issue.

Friday, 16 November 2012

BizTalk Custom XSLT if/when

BizTalk Custom XSLT, working with “if..else” and  “when…otherwise”
When….Otherwise example:
<xsl:choose>
                    <xsl:when test="Number1">
                      <ns1:Object>
                        <ns1:Value>
                          <xsl:value-of select="Number1/text()" />
                        </ns1:Value>
                      </ns1:Object>
                    </xsl:when>
                    <xsl:when test="Number2">
                      <ns1:Object>
                        <ns1:Value>
                          <xsl:value-of select="Number2/text()" />
                        </ns1:Value>
                      </ns1:Object>
                    </xsl:when>
                    <xsl:otherwise>
                      <ns1:Object>
                        <ns1:Value>
                          <xsl:value-of select="Number3/text()" />
                        </ns1:Value>
                      </ns1:Object>
                    </xsl:otherwise>
                </xsl:choose>

If….Else example:
                <xsl:if test="Number">
                <ns1:Object>
                   <ns1:Value>
                    <xsl:value-of select="Number/text()" />
                   </ns1:Value>
                </ns1:Object>
      </xsl:if>
      <xsl:if test="Number1">
                <ns1:Object>
                   <ns1:Value>
                    <xsl:value-of select="Number1/text()" />
                   </ns1:Value>
                </ns1:Object>
      </xsl:if>