WCF and SSIS: Round 2

time to read 3 min | 558 words

After my last post in the matter, Jeremy Boyd has been gracious enough to track down the problem and send me a complete solution.  Jan Van Ryswyck was the one that pointed me at how to solve another problem with WCF, that I never would have assoicated with the first issue.

WCF has three places that you need to touch to setup the namespace of a service. The interface - using [ServiceContract] - the implementation - using [ServiceBehavior] - and the binding - using bindingNamespace="". I am not sure why you need to touch so many places in order to change a namespace, and I am really not fond of the implementation changing the public interface of a service, but that is another story. There are probably some cases where you want three different namespaces.

At any rate, the way WCF handles different namespaces is by generating wsdl:import and xsd:import declaration, which are apperantly not supported very well by quite a few tools. The key here is that if they are all in the same namespace, you don't get the import declaration, and the tools can consume the WSDL just fine!

So, here is the code from last time:

[ServiceContract(Namespace=http://www.ayende.com/")]
public interface ISsisNotifications
{
    [OperationContract]
    void UpdatedDatabase();
}

[ServiceBehavior(Namespace=http://www.ayende.com/")]
public class SsisNotifications : ISsisNotifications
{
       public void UpdatedDatabase()
       {
       }
}

And we need to configure it like this:

<service behaviorConfiguration="ExposeMetaData" name="My.SsisNotifications">
      <endpoint address="http://my-machine//Services/SsisNotifications.svc"
               bindingNamespace="http://www.ayende.com/"
               binding="basicHttpBinding" contract="My.ISsisNotifications" />

</service>

And now SSIS can consume this service without issues.

(Victory dance)