Binding an orchestration to multiple receive ports

In the BizTalk Server Management Console, it’s only possible to bind 1 physical Receive Port to 1 logical (Orchestration-)Receive Port.
To bind multiple receive ports to an orchestration, you could follow these steps:

1) Create receive ports with unique and approviate names in the correct biztalk application.

2) Create a new one way port in your orchestration, which can receive messages. As port binding please use “direct”. In this example please make sure, that “Routing between ports will be defined by filter expressions on incoming messages in the Messagebox database” is selected.

3) Create or select your activating Receive Shape and configure the “Filter Expression” by clicking the ellipsis. In the Filter Expression add as many “BTS.ReceivePortName”-properties as Receive Ports you have created eralier. Set the values of the properties to the portnames of the Receive Ports and group each row by “OR”.
The Filter Expression should resemble something like this: (BTS.ReceivePortName == “ReceiveMsgPort1”) (BTS.ReceivePortName == “ReceiveMsgPort2”)

All the messages which originate from the filtered ports will be processed by the Orchestration

Basic authentification in a soap / webservice call

You have a webservice (based on a wsdl), which you have to call? The owner of the webservice has set basic authentification as security requirement. You have added the webservice via “Add Web Reference” in Visual Studio with the name “WebServiceName”. The generated class MyServiceClass is a derived class of SoapHttpClientProtocol out of namespace System.Web.Services.Protocols. You have no access to the via wsdl prompted definitions and classes.

Unfortunatly it is not sufficient to add the credentials in this way:

ICredentials creds;
creds = new NetworkCredential(username, password);
WebServiceName.MyServiceClass client = new WebServiceName.MyServiceClass();
client.Credentials = creds;
client.PreAuthenticate = true;

client.MyMethodCall();

Solution:

You have to add a new class file to your project, which contains the same namespace as MyServiceClass is a member, e.g. WebServiceNameExtended.cs. Next, you create a new dervied class of MyServiceClass in this file, e.g. MyServiceClassExtended. Into the class you insert a method called GetWebRequest(), which overrides the standard class of System.Net.
So, every Request, which is sent to the webservice will be changed and the request header will contain the credentials and will integrate Basic Authentification.

Example:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Net;
using System.Text;
using System.Web.Services.Protocols;

namespace WebServiceName
{
    public class MyServiceClassExtended : MyServiceClass
    {
        protected override WebRequest GetWebRequest(Uri address)
        {
            WebRequest request = (WebRequest)base.GetWebRequest(address);

            if (request.PreAuthenticate)
            {
                NetworkCredential networkCredentials = request.Credentials.GetCredential(address, "Basic ");
                if (networkCredentials != null)
                {
                    byte[] credentialBuffer = new UTF8Encoding().GetBytes(networkCredentials.UserName + ":" + networkCredentials.Password);
                    request.Headers["Authorization"] = "Basic " + Convert.ToBase64String(credentialBuffer);
                }
                else
                {
                    throw new ApplicationException("No network credentials");
                }
            }

            return request;
        }
    }
}