The transport proxy method DeleteMessage() failed for adapter XYZ (Bug in Codeplex Adapter Wizard)

/
February 25, 2009
/
Comments Off on The transport proxy method DeleteMessage() failed for adapter XYZ (Bug in Codeplex Adapter Wizard)

Ok, I have seen this error a couple of times on the internet. They all have to do with the same issue. And in my current project i stumbled upon this problem. I found a solution and thought it would be nice to share this with the community

  • You have created an adapter with the AdapterWizard on codeplex.
  • You stress test the newly developed adapter and you get some pretty strange eventLog messages.

Some sample Eventlog messages you could encounter:

Event Type: Error
Event Source: BizTalk Server 2006
Event Category: BizTalk Server 2006
Event ID: 5796
Date:  2/10/2009
Time:  2:48:45 PM
User:  N/A
Description:
The transport proxy method DeleteMessage() failed for adapter AAA: Reason: “Messaging engine has no record of delivering the message to the adapter. This could happen if DeleteMessage() is called multiple times for the same message by the adapter or if it is called for a message which was never delivered to the adapter by the messaging engine”. Contact the adapter vendor
.

Or you could get

Event Type: Error
Event Source: BizTalk Server 2006
Event Category: BizTalk Server 2006
Event ID: 5673
Date:  2/10/2009
Time:  2:48:44 PM
User:  N/A
Description:
The Messaging Engine received an error from transport adapter “AAA” when notifying the adapter with the BatchComplete event. Reason “Object reference not set to an instance of an object.”.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

Or

Event Type: Error
Event Source: BizTalk Server 2006
Event Category: BizTalk Server 2006
Event ID: 5675
Date:  2/10/2009
Time:  2:48:44 PM
User:  N/A
Description:
The Messaging Engine encountered an error while deleting one or more messages.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

And even :

Event Type: Error
Event Source: BizTalk DW Reporting
Event Category: None
Event ID: 1000
Date:  2/10/2009
Time:  2:48:45 PM
User:  N/A
Description:
Faulting application btsntsvc.exe, version 3.6.1404.0, stamp 4674b0a4, faulting module btsmsgcore.dll, version 3.6.1404.0, stamp 4674b091, debug? 0, fault address 0x0008fb84.

They all have to do with the same issue.

I compared the code generated by the Adapter Wizard with the code from the HTTP.NET adapter that comes with the samples…..
I found one BIG difference. Here is the code as it is generated by the adapter wizard….

        private IBaseMessage BuildResponseMessage(Stream response,IBaseMessageContext context)
        {
            IBaseMessage btsResponse = null;

            // Get the response stream, create a new message attaching
            // the response stream…
            using (Stream s = response)
            {
                // NOTE:
                // Copy the network stream into a virtual stream stream. If we were
                // to use a forward only stream (as in the response stream) we would
                // not be able to suspend the response data on failure. The virtual
                // stream will overflow to disc when it reaches a given threshold
                VirtualStream vs = new VirtualStream();
                int bytesRead = 0;
                byte[] buff = new byte[8 * 1024];
                while ((bytesRead = s.Read(buff, 0, buff.Length)) > 0)
                    vs.Write(buff, 0, bytesRead);

               response.Seek(0, SeekOrigin.Begin);
               response.Close();

                // Seek the stream back to the start…
                vs.Position = 0;

                // Build BTS message from the stream
                IBaseMessageFactory mf = transportProxy.GetMessageFactory();
                btsResponse = mf.CreateMessage();
                IBaseMessagePart body = mf.CreateMessagePart();
                body.Data = vs;
                btsResponse.AddPart(“Body”, body, true);
                btsResponse.Context = context;
            }

            return btsResponse;
        }

And the code from the HTTP.NET adapter from the BizTalk SDK looks like this :

        private IBaseMessage BuildResponseMessage(WebResponse webResponse)
        {
            IBaseMessage btsResponse = null;

            // Get the response stream, create a new message attaching
            // the response stream…
            using (Stream s = webResponse.GetResponseStream())
            {
                // NOTE:
                // Copy the network stream into a virtual stream stream. If we were
                // to use a forward only stream (as in the response stream) we would
                // not be able to suspend the response data on failure. The virtual
                // stream will overflow to disc when it reaches a given threshold
                VirtualStream vs = new VirtualStream();
                int bytesRead = 0;
                byte[] buff = new byte[8 * 1024];
                while ((bytesRead = s.Read(buff, 0, buff.Length)) > 0)
                    vs.Write(buff, 0, bytesRead);

                webResponse.Close();

                // Seek the stream back to the start…
                vs.Position = 0;

                // Build BTS message from the stream
                IBaseMessageFactory mf = transportProxy.GetMessageFactory();
                btsResponse = mf.CreateMessage();
                IBaseMessagePart body = mf.CreateMessagePart();
                body.Data = vs;
                btsResponse.AddPart(“Body”, body, true);
            }

            return btsResponse;
        }

After I removed the context copy part of the code things started to look much better. No host restarts anymore and no more strange exceptions. It’s logical that copying the entire context from one request message to a response message can cause these problems.

So if you created an adapter yourself with the adapter wizard, check your code to see if the offending line of code is still there. If so, do a stress test on it and see the eventlog messages pop up !.

 

 

Cannot add (custom) pipeline component to the toolbox (You have selected an invalid pipeline component assembly. Please check security settings for the assembly if you are loading it from an UNC path)

/
February 17, 2009
/
Comments Off on Cannot add (custom) pipeline component to the toolbox (You have selected an invalid pipeline component assembly. Please check security settings for the assembly if you are loading it from an UNC path)

If you created a pipeline component with the Pipeline componet wizard it will probably run just fine.

But then comes that moment in time that yoy want to create a new pipeline component that looks just like an already created pipeline, so you decide to copy the code and change some things.
Then you compile the component and you try to add it to the Vizual studio toolbox. And then you get the following message :

You have selected an invalid pipeline component assembly. Please check security settings for the assembly if you are loading it from an UNC path.

Well, you can check whatever you want but it probably won’t help.

Possible causes are :

1. Your Pipeline uses some DLL that’s not in the GAC or pipeline components folder.

2. There is something wrong with the namespaces….. That’s what I am going to cover now.

A pipeline component has the following piece of code…

 private System.Resources.ResourceManager resourceManager = new System.Resources.ResourceManager(“BizTalk.BestPractice.PipelineComponents.AuditingComponent”, Assembly.GetExecutingAssembly());

For descriptions and stuff, the pipeline uses a resource file. The piece of code above tells the pipeline component where the resource file is located.
If the namespace and component name are not exactly the same as the namespace and component name mentioned in the piece of code above you will get that message.

I saw several questions about this in google but none had this solution, so I figured this blog entry would maybe come in handy for someone with the same problem.

 

 

BizTalk HotRod number 5 is now online !

/
February 12, 2009
/
Comments Off on BizTalk HotRod number 5 is now online !

Topics covered :

  • Application Servers: BizTalk vs. Dublin
  • Unit Testing in BizTalk Server 2009
  • Monitoring a WCF Service Using BAM: A Walkthrough
  • Operations Management for BizTalk
  • Governing the SOA Runtime with AmberPoint
  • BizTalk monitoring and exception handling from any desktop
  • Add Governance to BizTalk with SOA Software

So lots of interesting stuff again !. Go to the site of BizTalk HotRod and download your copy >>here<<

Now that BizTalk Utillities is out of business It’s time ………………

/
February 10, 2009
/
Comments Off on Now that BizTalk Utillities is out of business It’s time ………………

BizTalk Utillities used to have a very nice suite of solid adapters. For some reason, Pieter van de Merwe has stopped his business.

We tried for months to get into contact with him to no avail. We called all the possible phone numbers we could find and finally we got somebody on the line.
It was not Pieter himself but someone else working there in the same office. This person mentioned that he believed that BizTalk Utillites were no longer available as a product.
This answer in combination with our results (as to getting into contect with BizTalk Utillities) makes me believe the person on the phone was correct.

If that’s true !

IT’S TIME FOR MICROSOFT  TO WRITE A DESCENT ODBC/ADO ADAPTER FOR BIZTALK !!!

Excellent post about Synchronous To Asynchronous Flows Without An Orchestration

/
January 23, 2009
/
Comments Off on Excellent post about Synchronous To Asynchronous Flows Without An Orchestration

While writing my previous blog posting, I remembered that Paolo Salvatori had posted about another very usefull “Synchronous To Asynchronous Flows Without An Orchestration“scenario.

So again I can recommend the article found >>Here<<

Excellent post about BizTalk Protocol Transition

/
January 23, 2009
/
Comments Off on Excellent post about BizTalk Protocol Transition

Today I found an excellent post about BizTalk Protocol transition by Paolo Salvatori.
It’s absolutely worth reading if you have to work with Webservices / Single Sign On.

He covers 3 scenarios:

Scenario 1 – Messaging Only Scenario with a SOAP Receive Location
Scenario 2 – Messaging Only Scenario with a WCF-Custom Receive Location
Scenario 3 – Orchestration with an Inline Send Port

 Have a read of the post >>Here<<

Interesting post about Schema versioning in BizTalk

/
December 4, 2008
/
Comments Off on Interesting post about Schema versioning in BizTalk

Today I found a very intersting post about schema vesrioning and BizTalk >>Here<<

Basically it says, if you have schema versioning, just increase the version number of your DLL with the schema.
BizTalk will then resolve automatically to the latest version.

Just one of those things that are easy to forget.

Excellent post of Charles Young about Dublin and BizTalk

/
October 16, 2008
/
Comments Off on Excellent post of Charles Young about Dublin and BizTalk

I was reading the post of Charles Young about Dublin and BizTalk Server – What’s the difference?

I can only say, it’s really worth a read, and after reading it, you will probably know you will still be doing BizTalk and XLANG for a long time.
The goodies mentioned in the article that come with BizTalk will just not be available for WF for a long long time to come.

COme on have read of the article here:Dublin and BizTalk Server – What’s the difference?

How to expose an old style WSDL (Flattened) with the schema’s included from BizTalk 2006 R2 with a WCF adapter

/
October 6, 2008
/
Comments Off on How to expose an old style WSDL (Flattened) with the schema’s included from BizTalk 2006 R2 with a WCF adapter

It is really nice to have WCF around. With WCF you are ready for the future. Unfortunaltely this is only true in a Microsoft landscape. The new style WSDL with the schema’s no longer included is one of those enhancements that should be really nice. Unfortunately there are tons of software out there that cannot handle the default WSDL behaviour of a WCF service. Below is a picture of the default WSDL behaviour.

DefaultSoap

And this is not the behavoiur old clients like. So we have to modify the WSDL that’s spitted out by a WCF service.

To make things happen I googled around a lot and finally after some very good posts of Thomas Restrepo and LocoTheGrande(Don’t know who’s behind that blog post) i had a class up and running that should do what I wanted. Below is the code of that class….

 //
// InlineXsdInWsdlBehavior.cs
//
// Author:
//    Tomas Restrepo (tomasr@mvps.org)
//

using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Configuration;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
using System.Text;
using System.Xml;
using System.Xml.Schema;
using System.Web.Services;
using System.Web.Services.Description;
using WsdlDescription = System.Web.Services.Description.ServiceDescription;

namespace FH.CE.ESB.WSDL.Extensions
{
    /// <summary>
    /// IEndpointBehavior implementation that will
    /// force WCF to generate all schemas inline into the
    /// generated WSDL files, instead of as individual files.
    /// </summary>
    public class InlineXsdInWsdlBehavior : BehaviorExtensionElement,IWsdlExportExtension, IEndpointBehavior
    {

        #region IWsdlExportExtension Implementation
        //
        // IWsdlExportExtension Implementation
        //
        public void ExportContract(WsdlExporter exporter,WsdlContractConversionContext context)
        {
            // never called
        }

        public void ExportEndpoint(WsdlExporter exporter,WsdlEndpointConversionContext context)
        {
            XmlSchemaSet schemaSet = exporter.GeneratedXmlSchemas;

            foreach (WsdlDescription wsdl in exporter.GeneratedWsdlDocuments)
            {
                //
                // Recursively find all schemas imported by this wsdl
                // and then add them. In the process, remove any
                // <xsd:imports/>
                //
                List<XmlSchema> importsList = new List<XmlSchema>();
                foreach (XmlSchema schema in wsdl.Types.Schemas)
                {
                    AddImportedSchemas(schema, schemaSet, importsList);
                }
                wsdl.Types.Schemas.Clear();
                foreach (XmlSchema schema in importsList)
                {
                    RemoveXsdImports(schema);
                    wsdl.Types.Schemas.Add(schema);
                }
            }
        }

        #endregion // IWsdlExportExtension Implementation

        #region Private Methods
        //
        // Private Methods
        //

        /// <summary>
        /// Recursively extract all the list of imported
        /// schemas
        /// </summary>
        /// <param name=”schema”>Schema to examine</param>
        /// <param name=”schemaSet”>SchemaSet with all referenced schemas</param>
        /// <param name=”importsList”>List to add imports to</param>
        private void AddImportedSchemas(XmlSchema schema,XmlSchemaSet schemaSet,List<XmlSchema> importsList)
        {
            foreach (XmlSchemaImport import in schema.Includes)
            {
                ICollection realSchemas =
                   schemaSet.Schemas(import.Namespace);
                foreach (XmlSchema ixsd in realSchemas)
                {
                    if (!importsList.Contains(ixsd))
                    {
                        importsList.Add(ixsd);
                        AddImportedSchemas(ixsd, schemaSet, importsList);
                    }
                }
            }
        }

        /// <summary>
        /// Remove any &lt;xsd:imports/&gt; in the schema
        /// </summary>
        /// <param name=”schema”>Schema to process</param>
        private void RemoveXsdImports(XmlSchema schema)
        {
            for (int i = 0; i < schema.Includes.Count; i++)
            {
                if (schema.Includes[i] is XmlSchemaImport)
                    schema.Includes.RemoveAt(i–);
            }
        }

        #endregion // Private Methods

        #region IEndpointBehavior Implementation

        public void AddBindingParameters(ServiceEndpoint endpoint,BindingParameterCollection bindingParameters)
        {
            // not needed
        }

        public void ApplyClientBehavior(ServiceEndpoint endpoint,ClientRuntime clientRuntime)
        {
            // not needed
        }

        public void ApplyDispatchBehavior(ServiceEndpoint endpoint,EndpointDispatcher dispatcher)
        {
            // not needed
        }

        public void Validate(ServiceEndpoint endpoint)
        {
            // not needed
        }

        public override System.Type BehaviorType
        {
            get { return typeof(InlineXsdInWsdlBehavior); }
        }

        protected override object CreateBehavior()
        {
            return new InlineXsdInWsdlBehavior();
        }

        #endregion // IContractBehavior Implementation

    } // class InlineXsdInWsdlBehavior

} // namespace Winterdom.ServiceModel.Extensions

The code above is not the original code of Thomas Restrepo. The last two methods were added by me. I found the directions of how to do that in the post of LocoTheGrande. I made sure that I gac-ed the component an tried to add the behaviour to a Service that was generated by BizTalk. And I tried really hard but could not succeed. So finally I was out of options and decided to write a mail to Thomas Restrepo. His Email address was on hist site so I thought I give it a try. And I got a reply from Thomas the same evening helping me on my way. Basically he said the following things..

1. Make sure the component is in the GAC.
2. Edit the machine.Config
3. Use one of the Custom WCF adapters. (The default adapters dont allow you to change behaviour)

So I fired up the good old svcConfigEditor, looked for the machine.config in the C:WINDOWSMicrosoft.NETFrameworkv2.0.50727 directory and opened it with the editor. Then I made a modification to support the InlineWsdl behaviour. Below is a screenshot of that.

Then I Went back to BizTalk and fired up the BizTalk WCF Service Publishing Wizard, I then chose the CustomIsolated WCF adapter and finished the Wizard.
After everything was done I opened up the port in the BizTalk Server Administration Console and added my behaviour. Below is a screenshot of that.

Then I browsed to my endpoint and looked at the WSDL….. Ahhhhh reward how nice. The WSDL has all the schema’s included.

 

Besides the fact that the WSDL inluded the correct XSD now this also has the benefit of exposing the correct cardinality of the elements.
Hope this helps anywone who is struggeling with this problem. Again many thanks to Thomas restrepo !

 

Interesting stuff coming with the BizTalk Adaper Pack

/
August 15, 2008
/
Comments Off on Interesting stuff coming with the BizTalk Adaper Pack

I really can’t wait for the BizTalk Adapter pack. Finally we get a good SQL adapter capable of almost everything. I had concurrency problems in the past cause the Adapter always has a transaction level Serializable. Now with the new SQL Adapter the transaction level is settable. Have a read of the SQL LOB adapter capabillities >> here <<

They also threw in some goodies in the Adapter pack, The various Adapters will now show up as native BizTalk Adapters, have a look >> here <<

  • Recent Posts
  • Recent Comments
  • Archives
  • Categories
  • Meta