Category nameļ¼šBizTalk

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 <<

HowTo define a Custom Soap Header in BizTalk. Expose it, Consume it , even map them..

June 13, 2008 / Comments Off on HowTo define a Custom Soap Header in BizTalk. Expose it, Consume it , even map them..

 

1. Create the schema that defines your custom header. This schema should be a NORMAL schema. (Give it a decent rootnode name)

2. Create a PROPERTY schema with TargetNamespace : http://schemas.microsoft.com/BizTalk/2003/SOAPHeader.

3. Make sure you define a property in the PROPERTYSCHEMA with EXACTLY the same name as the ROOTNODE of the schema in step 1

4. Make sure you set the set the “Property schema base” to “MessageContextPropertyBase” !!!!!

5. Deploy.

That’s it…… I was really confused by other posts on the web that are just not clear enough… But the summary above is very short so I will explain a bit more.

First step.

Create a normal schema that represents your custom header. Below is a screenshot of my schema.

But I also wanted to send a custom header, so I had to create a second schema representing my outgoing envelope.

 

Second step.

Now I had to create a property schema. Taking care that my property names where EXACTLY the same as the Rootnodes in the schemas. I also had to set the namespace to the correct SOAPHeader namespace.

After setting  the “Property schema base” to “MessageContextPropertyBase” I deployed everything. And I was basically ready to go.

The orchestration

I created a very simple orchestration. It Receives a message, Maps it to the output and sends the output back. More on this orchestration later. I then generated a web service With the wizard that came with Biztalk. It is probably important to mention that when generating the service, I added extra SOAP headers. As the inbound header I specified the “inHeader” schema  and as the outbound header I specified the “outHeader” schema (So not the propertyschema). Then after some wizardry of the wizard, I fired up my trusted WebService Studio tool” and hit the GET button. I was presented with the following picture..

Everything I was expecting, was there. So it was very easy to send and receive headers.

Receiving

After receiving the message, the Adapter (it also works with PASSTHROUGH) will strip off the header and put it into the context property. Below is a screenshot of the received message. As you can see there is no messagetype set so it was received via a passthrough pipeline.

But how nice … the context property “inHeader” contains an XML document with the content of the SOAP header.

So if you want to get to a Specific SOAP Header in an Orchestration. The following code should do the trick.

 

Sending

For Sending messages with the header it works the other way around. Just make sure you have set the content of the outbound header context property to an XML document representing a valid header. I created mine with the mapper.

Then I threw in a shape where I put the contructed document into the context property…

And Presto….

 

 

 

 

New Style SSO Available on Codeplex

June 2, 2008 / Comments Off on New Style SSO Available on Codeplex

If you are working with BizTalk you know the dilemma, where do I store my configuration data. Could be on several locations. Have a read of this article to have some in-dept information.

I created a base class SSOBaseFunctionality thad deals with storing and loading configuratioin data to and from SSO. So if you want to store a specific class in SSO just make sure it inherits from SSOBaseFunctionality and you are ready to go.

The project is on Codeplex.

Your class could simply look like this.

     [Serializable]
    public class SampleConnectionData:SSOConfigItem
    {
        public SampleConnectionData(string ApplicationName)
        {
            base.SSO_ApplicationSettingName = ApplicationName;
        }

        public SampleConnectionData()
        {
        }

        private string dataSource = string.Empty;
        private string database = string.Empty;
        private string applicationName = string.Empty;
        private string userName = string.Empty;
        private string password = string.Empty;
        private bool trustedConnection = false ;

        public bool TrustedConnection
        {
            get { return trustedConnection; }
            set { trustedConnection = value; }
        }
 
        public string Password
        {
            get { return password; }
            set { password = value; }
        }

        public string UserName
        {
            get { return userName; }
            set { userName = value; }
        }
 

        public string ApplicationName
        {
            get { return applicationName; }
            set { applicationName = value; }
        }
 
        public string DataSource
        {
            get { return dataSource; }
            set { dataSource = value; }
        }
      

        public string Database
        {
            get { return database; }
            set { database = value; }
        }
   }

And then you will have functionality like this :

// Create a SSO connection class.
SampleConnectionData objConnection = new SampleConnectionData(“SomeApplicationName”);

// Set properties
objConnection.TrustedConnection = true;
objConnection.DataSource = “(Local)”;
objConnection.Database = “Master”;
objConnection.ApplicationName = “DemonstrateUsage”;

// Create the applications
objConnection.CreateApplication();

// Save the application
objConnection.Save();

// Get a new Object
SampleConnectionData OtherConnection = new SampleConnectionData(“SomeApplicationName”);
// Load properties from SSO Configuration Store
OtherConnection.Load()

 

Some guidance on BizTalk Testing.

April 28, 2008 / Comments Off on Some guidance on BizTalk Testing.

 Via BlogLines I monotor lot’s of BizTalk feeds. And once in a while there is an article worth reading. The same with this article >>CLICK<< from michael Stepenson. It has some interesting points about BizTalk testing. Worth a read.

Using a Bitwise AND in a BizTalk Send Port as a Filter Expression

March 20, 2008 / Comments Off on Using a Bitwise AND in a BizTalk Send Port as a Filter Expression

I knew this was possible but I guess a lot of people are unaware of this functionality.
Somebody told me I  should blog about it, so here I am adding another entry to my Blog.


How to define the BitWise and in a send port.




  1. Define a property schema in biztalk and make sure one of the properties is of the type unsigned int.


  2. Now deploy that propertyschema.


  3. Now add a send port and go to the filter Expression.


  4. Select the Unsigned int in the first part of the Exprssion


  5. Then open the dropdown and see… there it is …

the magical, almost undocumented, rarely seen, extra operator &. (standing for Bitwise AND)


Microsoft BizTalk Server Operations Guide

February 19, 2008 / Comments Off on Microsoft BizTalk Server Operations Guide

This is  a post from Microsft Download Center. I found it in my RSS feeds. (Don’t know where). It’s such a usable BizTalk document that I really don’t want to loose the link so it’s a reminder for myself. But a nice read (+700 pages) for anyone who is involved in BizTalk Developement.

get the download link >>HERE<<


Brief Description

Provides detailed information for planning a BizTalk Server environment, as well as recommendations and best practices for configuring, testing, maintaining, monitoring, and optimizing this environment.

 


Overview


A valuable resource for anyone involved in the implementation and administration of a BizTalk solution, particularly IT professionals. The guide provides detailed information for planning a BizTalk Server environment, as well as recommendations and best practices for configuring, testing, maintaining, monitoring, and optimizing this environment.

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