BizTalk: Debuging the BizTalk applications with the direct test send ports

” …I have published an orchestration as a web service and consumed it from an aspx page. now, how do I see if I triggered the orchestration and how and where do I get the output (transformed message of the orchestration)? …


It is a very common question, how to debugging the BizTalk applications.

Have you ever tried to use the BizTalk Orchestration Debugger? So painful experience. Never see the BizTalk developer who is using it in real work.

 

One simple decision is creating the direct test send ports.  (http://blogs.msdn.com/kevin_lam/archive/2006/07/07/659214.aspx, http://geekswithblogs.net/LeonidGaneline/archive/2006/12/18/101541.aspx)

Test port is a port with the filter expression (http://msdn2.microsoft.com/en-us/library/aa578042.aspx, http://msdn2.microsoft.com/en-us/library/aa547903.aspx). This expression creates the subscription to the message you interested in.

All sent and received messages go through the MessageBox. When they pass MessageBox you can create additional subscription to these messages and intercept copies of these messages.

The subscription can be to the message type or to the publisher parameters like Receive port name.

This technique has great benefits:



  • The direct test send ports do not disturb the original message flow (excluding the rare case when all main subscriptions to the debugged message have got unenlisted).


  • They can be easily switch on/off.

As a matter of fact I use two methods on the regular basis. (The second one is the old good Trace.WriteLine(..) with DebugView.exe as a receiver of the debug output.) That means I always create the orchestrations with the Expression shapes (for Trace.WriteLine)) after all message receives/transformations, in the begin/end all branches, plus I create the test send ports for almost ALL messages.

 

Yes, for ALL output messages.

It is easy and fast to create the test send ports in the binding file without using UI.

And I always deploy these test ports to the production. It saved me a lot of time in deployment and maintain.

Searching *Inside* Stored Procedures

I’ve recently inherited a large BizTalk system and needed a quick way to determine which custom stored procedures accessed which tables/views and called other sprocs. Thanks to my co-worker Shaun, I now have the power of the INFORMATION_SCHEMA views at my disposal!
Information Schema Views
Information schema views provide an internal, system table-independent view of SQL Server […]

BizTalk 2006 R2, EDI and RFID SCOM2007 Management Pack Released!!! Yeah baby!

We’ve now got official Management Pack support for R2 and the newer things in R2 such
as EDI and RFID.

I’ve had many students come up to me and say “Mick – what in the world are you talking
about?”

(mind you I get that at home as well – but let’s not go there)

Have you ever asked the question:
I wonder how our BizTalk (et. al.) servers are going?

(this is where you could send the work experience kid around to all the servers gathering
details and report back to you by lunch…..but not all of us have work experience
kids)

The answer to this is relatively complex – as you’ll need know things like:

  1. Services – stopped, started, uptime. BizTalk Services, SQL Services, WCF/IIS Services
    etc.
  2. Database sizes, Spool table lengths
  3. Queue Lengths – disk etc.
  4. Memory details
  5. BizTalk Orchestration details
  6. Messaging Details
  7. …. and the list goes on.

SCOM2007 with the management pack gives you that – in near enough realtime with all
sorts of graphs and charts.

One of the *best* things I like about SCOM2007 is that you install the Management
Pack(s) only on *one* machine – usually the SCOM2007 Central Administration machine,
and as more applications are installed on servers on the network, the appropriate
management bits are ‘auto-deployed’.

Grab it here –

http://www.microsoft.com/downloads/details.aspx?FamilyId=389FCB89-F4CF-46D7-BC6E-57830D234F91&displaylang=en&displaylang=en

External function calls

External function calls

The latest release of the Rule Manager allows to import external functions into the business vocabulary. As a little exercise I tried to get the current weather condition for a zipcode (maybe I can write some rules if I should bring my umbrella while I leave my house in L.A.)

Initially I intended to call a webservice, but it seems that all free weather webservice calls is something from the past. Yahoo offers weather information as an RSS feed. So a simple XPath query can select the information that I’m interested in:

Here is the code (note the FunctionAttribute decoration on the method)

1 using System.IO;

2 using System.Net;

3 using System.Xml;

4 using AcumenBusiness.IModel;

5 using Type=AcumenBusiness.IModel.Type;

6

7 namespace TestCallWebService

8 {

9 [Concept(“Weather info”, “Try to get weather forecast from different services”)]

10 public class WeatherInfoProvider

11 {

12 private static readonly string YahooWeatherURLFormat = “http://weather.yahooapis.com/forecastrss?p={0}”;

13

14 [Term(“workaround”, “import function requires one field. (bug)”)]

15 private string dummyField;

16 public string DummyField

17 {

18 get { return dummyField; }

19 set { dummyField = value; }

20 }

21

22 [Function(“Get temperature”, “Get the weather info from Yahoo”,

23 ReturnType = Type.text,

24 ArgumentTypes = new Type[] { Type.integer })]

25 public static string GetWeatherInfoAsFeed(int zipCode)

26 {

27 HttpWebRequest request = (HttpWebRequest) WebRequest.Create(string.Format(YahooWeatherURLFormat, zipCode));

28 // execute the request

29 HttpWebResponse response = (HttpWebResponse) request.GetResponse();

30

31 // we will read data via the response stream

32 Stream resStream = response.GetResponseStream();

33 XmlDocument rssFeed = new XmlDocument();

34 rssFeed.Load(resStream);

35

36 //set an XmlNamespaceManager since we have to make explicit namespace searches

37 XmlNamespaceManager xmlnsManager = new System.Xml.XmlNamespaceManager(rssFeed.NameTable);

38 //Add the namespaces used in the xml doc to the XmlNamespaceManager.

39 xmlnsManager.AddNamespace(“yweather”, “http://xml.weather.yahoo.com/ns/rss/1.0”);

40

41 XmlNode weatherCondition = rssFeed.SelectSingleNode(“/rss/channel/item/yweather:condition/@temp”, xmlnsManager);

42 if (weatherCondition != null) {

43 return weatherCondition.Value;

44 }

45 return null;

46 }

47 }

48 }

With the Import Schema adapter I can import this function and call it from my business rules. The coolest part is that you can invoke this from the Interactive Rule Map. So you can see how your rules are executing with this external data. It seems to be 76 fahrenheid in L.A.
Nice weather to jump on the bike and cycle to work…

More Thoughts on HTML5, CSS3 & WebKit Advances!

Yesterday I wrote a post on Why Safari May Become the Browser of Choice and got some great feedback (both positive and negative) in the comments and several emails. I thought I'd take this opportunity to address this feedback and explain a little bit more about why I believe these new "features" in WebKit are so important to the future of web development and design.

First off, let me set the record straight and tell you that I am an unqualified supporter of Microsoft technologies such as SQL Server, BizTalk Server, Commerce Server and the .NET Framework. I'm also a Microsoft MVP for Commerce Server and an avid C#, ASP.NET and BizTalk developer. In my day job, I use these Microsoft technologies to create business-to-business e-commerce applications for the company that I work for.

But at night and on the weekends, I moonlight as a free-lance web designer/developer using mostly non-Microsoft technologies such as Ajax, PHP & mySQL. In both areas I strive to create "standards" based web sites and applications and my overriding goal is always to "create the best user experience requiring the least bandwidth" and this is where WebKit comes in.

Think about how we (ASP.NET) developers create great user experiences today and two things come to mind; ASP.NET AJAX and Silverlight. Both technologies allow you to create really great user experiences on the web but only at the cost of bandwidth (download time, initial or otherwise). The same rule holds true for Flash and any Ajax library such as Prototype, script.aculo.us or jQuery (all of which are excellent Javascript frameworks).

Now think about our potential to create great user experiences using nothing more than the new HTML5 and CSS3 capabilities found in the latest WebKit builds. Gradients, shadows and rounded-corners without images, transforms and animation without Javascript, client-side data that goes way beyond cookies and support for highly compressible vector graphics (SVG). All in a fully "standards" based HTML/XHTML/CSS framework that (hopefully) renders the same in all browsers, both desktop and mobile.

Now we're talking about actually having the tools to "create the best possible user experience requiring the least bandwidth". This may be a pipe dream but it looks like the WebKit folks and I are drinking the same Kool-Aid at the moment!

 

Currently listening to: "Still Feels Good" by Rascal Flatts

Configuration Wizard – Failed to Connect

Configuration Wizard – Failed to Connect

When specifying the SQL server, Configuration Database name and account for SharePoint you may see the following error

Failed to connect to the database server or the database name does not exist. Ensure the database server is a SQL server, and that you have appropriate permissions to access the database server. To Diagnose the problem, review the extended error information located at c:\program files\common files\microsoft shared\web server extensions\12\logs\PSCDiagnostics <DATETIME>.log. Please consulte the SharePoint Products and Technologies Configuration Wizards for help or additional information regarding the databse server security configuration and network access.

When you look at the log you will probably see some kind of timeout exception at the bottom, right before it all exploded.

LOTS of things could be causing this.  Below is a list of item that I have seen in my travels.

SQL Server Problems

  1. It was OFF,
  2. the service was stopped,
  3. the remote TCP/IP connections were not configured for SQL 2005
  4. SQL was sysprepped and the name was changed and it was just generally messed up and had to be rebuilt (Life Lesson: Just install SQL normally, perhaps record an unattended, but don’t bring an image of a Sysprepped SQL and try to rename the computer [regardless if it has domain membership] )

Network/Security Problems

  1. Router was melted,
  2. firewall was blocking access,
  3. logged in account really did not have the right permissions on the SQL server (see technet for details of required access),
  4. Cluster name was wrong (DUH),
  5. Cluster was offline
  6. Account was local (not domain)
  7. Recent DNS/IP change, needed to flushdns on SharePoint server
  8. Admin password was changed while logged on, needed AD refresh between DCs

This is not likely a bad username/password problem. You will see a different message for that.

Technet Snippit

NoteImportant

The server farm account is used to access your configuration database. It also acts as the application pool identity for the SharePoint Central Administration application pool, and it is the account under which the Windows SharePoint Services Timer service runs. The SharePoint Products and Technologies Configuration Wizard adds this account to the SQL Server Logins, the SQL Server Database Creator server role, and the SQL Server Security Administrators server role. The user account that you specify as the service account must be a domain user account, but it does not need to be a member of any specific security group on your Web servers or your back-end database servers. We recommend that you follow the principle of least privilege, and specify a user account that is not a member of the Administrators group on your Web servers or your back-end servers.

Try this to help diagnose

  1. Ping SQL/Cluster name
  2. Browse to \\ClusterName\C$ (this will tell you if your logged in account has admin permissions on that box)
  3. If SQL is a cluster, be sure which node is active
  4. Open the SQL server in SQL Management Studio
  5. Check for AV or firewall software on SQL server blocking the access
  6. Try user name as domain\username (NOT username@domain)
  7. Check the lists of all the stuff that can go wrong (above) and be sure you are not having those problems.
  8. If all else fails, just call PSS or your Microsoft Technical Account Manager (if you have one)

WCF: Contract name could be any on the client side

WCF: Contract name could be any on the client side.Sometimes we’ve got a very clear fault message:          <faultstring xml:lang=”en-US”>Could not find default endpoint element that references contract ‘ServiceProvider_configuration_Ref.ConfigurationServicePortType’ 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.</faultstring>
         <detail>
            <ExceptionDetail xmlns=”http://schemas.datacontract.org/2004/07/System.ServiceModel” xmlns:i=”http://www.w3.org/2001/XMLSchema-instance”>
               <HelpLink i:nil=”true”/>
               <InnerException i:nil=”true”/>
               <Message>Could not find default endpoint element that references contract ‘ServiceProvider_configuration_Ref.ConfigurationServicePortType’ 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.</Message>
.
It means two things do not conform each other:1)      The contract attribute in the endpoint element of the config file:   <endpoint address=https://ie-services-configuration.ServiceProvider.combinding=customBinding bindingConfiguration=customBinding_Configuration    contract=MyCompany.MyProject.ServiceProvider_configuration_Ref.ConfigurationServicePortType      name=ConfigurationServiceHttpPort /> 2)       And ConfigurationName property of the ServiceContract attribute in the proxy code. It usually generated by Add Service Reference wizard and placed in the hidden file the Reference.cs

     [System.CodeDom.Compiler.GeneratedCodeAttribute(“System.ServiceModel”, “3.0.0.0”)]    [System.ServiceModel.ServiceContractAttribute(
Namespace=“http://ws.ServiceProvider.com”, ConfigurationName=“ServiceProvider_configuration_Ref.ConfigurationServicePortType”)]
    public interface ConfigurationServicePortType {
 How I could get this situation? Very easily. For instance when I am editing my .config file with the Microsoft Service Configuration Editor and selecting to fix my endpoint -> contract name. I choose the dll with the definition of the service contract and there we go! It shows me not the ServiceProvider_configuration_Ref.ConfigurationServicePortType but MyCompany. MyProject.ServiceProvider_configuration_Ref.ConfigurationServicePortType and this creates the error mentioned above. We fix this error easily by changing the config file. Of course we can change the Reference.sc but it is generated be wizard and after updating this reference the error appears again. Is it a whole story? Nope. It is more interesting. Say we have the source code for this Web-service. Then we are creating the client for this Web-service. We are waiting that the full name of the service class should be the same in the service source code and in the client proxy code. It’s wrong! It is completely wrong.That means the “loose coupling” J What the client could get from the service it is the metadata: one or many wsdl-s and schemas (xsd).  Inside there is only the contract name. Usually it is the name of service interface or, if you apply the [ServiceContract] right to the service class, the service class name. The namespace of it does not passed by the metadata! When one of the client tools generates the proxy code it usually adds some new namespace. For example the Visual Studio adds the Default namespace parameter from the project properties.What about the service class name? The metadata passes the name under the [ServiceContract] attribute. And the client tool that generates the proxy code does not know is it the name of the interface or the name of the class. Then is just creates the interface with this name and with the [ServiceContract] attribute. Then it creates the class derived from this interface. And this class has auto generated name!What about the service contract full name?For instance:the source code of the web-service:namespace CMS_Stub { [ServiceContract(
Namespace = ” http://ws.ServiceProvider.com “)]
public interface ICMS_Stubpublic class CMS_StubService : ICMS_Stub the client proxy code:namespace MyCompany. MyProject.ServiceProvider_configuration_Ref {[ServiceContract(
Namespace = ” http://ws.ServiceProvider.com “,
ConfigurationName=“ServiceProvider_configuration_Ref.ICMS_Stub”)]
public interface ICMS_Stubpublic class CMS_StubClient: ICMS_Stub And what we see in the contract attribute in the endpoint element of the client config file?


  • CMS_Stub.ICMS_Stub?

  • CMS_Stub.CMS_StubService?

  • MyCompany.MySolution.MyProject.DownloadUri.ServiceProvider_configuration_Ref.ICMS_Stub?

  • MyCompany.MySolution.MyProject.DownloadUri.ServiceProvider_configuration_Ref.CMS_StubClient?

  • ServiceProvider_configuration_Ref.ICMS_Stub?
Yes, you are right, the last one, the ConfigurationName of the ServiceContract.