Wednesday, October 16, 2013

A safe way to delete things from BizTalkMgmtDb ?

On occasion I see something like this;

Schema referenced by Map '<Namespace>.<MappName>' has been deleted. The local, cached version of the BizTalk Server group configuration is out of date. You must refresh the BizTalk Server group configuration before making further changes. (Microsoft.BizTalk.Administration.SnapIn)

When it doesnt go away by refreshing the Server group I tend to try restarting, etc. If that doesnt work it usually means something in the biztalk database is out of date or messed up. I have gone in a few times to bts_item table in BizTalkMgmtDb to look for whatever the offending item is and from there you can delete it out of MapSpec or wherever else. I found a great link online covering this specific case here . The sql code used was (once youre connected to the BizTalkMgmtDb);

 
SELECT itemid FROM [BizTalkMgmtDb].[dbo].[bts_item] where FullName ='<whatever the map is>'
 
Then
 
Delete from BizTalkMgmtDb.dbo.bt_MapSpec where itemid ='<whatever the map itemid was>'.


Tuesday, October 8, 2013

xpath and biztalk; really?

stringTmp = "string(/*[local-name()='SXPTaskUpdate' and namespace-uri()='SXPTaskUpdateTN']/*[local-name()='Task']/*[local-name()='Customer']/text())";
stringTmp3 = xpath(Message_1 , stringTmp);


and

stringTmp = "string(/*[local-name()='SXPTaskUpdate' and namespace-uri()='SXPTaskUpdateTN']/*[local-name()='Task']/*[local-name()='Customer'])";
stringTmp3 = xpath(Message_1 , stringTmp);


returns: Customer_0

stringTmp2 = System.Convert.ToString(xpath(Message_1 , "/*[local-name()='SXPTaskUpdate' and namespace-uri()='SXPTaskUpdateTN']/*[local-name()='Task']/*[local-name()='Customer']"));

and


stringTmp2 = System.Convert.ToString(xpath(Message_1 , "/*[local-name()='SXPTaskUpdate' and namespace-uri()='SXPTaskUpdateTN']/*[local-name()='Task']/*[local-name()='Customer']/text()"));

returns: Microsoft.XLANGs.Core.Part+ArrayBasedXmlNodeList

One good source I've found is this:
http://social.technet.microsoft.com/wiki/contents/articles/6944.biztalk-orchestrations-xpath-survival-guide.aspx

Tuesday, May 14, 2013

Two things I learned about direct bound ports


When you directly bind to the message box, your messages will get picked up by subscribing orchestrations and send ports and then returned (see diagram below which I got from http://www.c-sharpcorner.com/UploadFile/john_charles/Introduction_to_Biztalk_Server09072007152846PM/Introduction_to_Biztalk_Server.aspx). One thing I learned is that if you have two orchestrations subscribing to a message they will both get it. Another thing you might notice from the diagram is that if your orchestration recieves and sends back the same message then it will pick it up again(and again, and again...). This infinite loop is a rather common peril of message box use.

Thursday, March 14, 2013

Enterprise SSO problem

So I was having an issue after creating a local user on my box with all kinds of privledges. The issue was that this user couldnt access the secret on the master secret server(ESSO was running as this local user);
Error Code: 0xC0002A1F, Cannot perform encryption or decryption because the secret is not available from the master secret server. See the event log for related errors.

The consensus online is to restore the master secret. This means going to the ESSO snap in (or cmd) and right click 'Restore'. Then locate the backup file you want to restore from. The location of your backup files(*.bak) in case you don't already have one you set up or you don't know, is:

 C:\Program Files\Common Files\Enterprise Single Sign-On\SSOXXXX.bak 

where the XXXX is generated by Biztalk when it creates the backups. I used the most recent backup file. I didnt know the password, then noticed, from the password secret, that the password was an old users password. After using the correct password i successfully restored and everything worked fine. I will say that if you use the wrong password you get an error of 'Bad Data' from ESSO.
 

Tuesday, January 29, 2013

xpath in expression shapes

 xpath is a notation for returning specific elements found in xml. It is very useful. I will go over a few problems I had getting it to work in Biztalk 2010 and the solutions I came accross.
First of all suppose you have some message in Biztalk,
  <ns0:TaskUpdate xmlns:ns0="TaskUpdateTN">
  <ns0:Task>
  <ns0:CallID>CallID_0</ns0:CallID>
  <ns0:Number>125</ns0:Number>
  <ns0:Status>
  <ns0:Name>Name_0</ns0:Name>
  </ns0:Status>
  <ns0:Customer>Customer_0</ns0:Customer>
  <ns0:WorkOrderNumber>WorkOrderNumber_0</ns0:WorkOrderNumber>
  <ns0:RequiredSkills1>Skill</ns0:RequiredSkills1>
  </ns0:Task>
  </ns0:SXPTaskUpdate>

 and you want to extract a certain element of the xml, say the 'Customer' element.

1) Create a couple of strings in the orchestration, tempStr and customerStr.

2) Use the schema properties to grab the xpath of the element you want,
 /*[local-name()='TaskUpdate' and namespace-uri()='TaskUpdateTN']/*[local-name()='Task']/*[local-name()='Customer']. Notice you dont need every last namespace in the xpath, just enough so it can safely find what you're looking for.

3) Open up an expression shape and type:
 tempStr="string(/*[local-name()='TaskUpdate' and namespace-uri()='TaskUpdateTN']/*[local-name()='Task']/*[local-name()='Customer']/text())";
 customerStr = xpath(Message_1, tempStr);


 And youre done; 'customerStr=Customer_0'. In some cases the 'string()' is not neccesary. The '/text()' however is, or else you would get 'customerStr=<ns0:Customer>Customer_0</ns0:Customer>' instead of just 'customerStr=Customer_0'. If you have a list of Customer elements in your message and you want the 3rd element in that list then your xpath will be '...[local-name()='Customer'][3]/text()'.


 If you want to assign a certain element in the Message to a value, say the 'Customer' element, to "John Doe". Change step 3) above to:

3)Open up an expression shape and type:
 tempStr="/*[local-name()='TaskUpdate' and namespace-uri()='TaskUpdateTN']/*[local-name()='Task']/*[local-name()='Customer']";
 xpath(Message_1, tempStr)="John Doe";


 Here a 'string()' doesnt work. Also an important thing to remember is if Message_1 is from a Message Part then you will have to write 'xpath(Message_1.part1,tempStr)="John Doe"'.