Brijesh
Brijesh

Reputation: 529

Biztalk - Consuming WCF via an external assembly

I've a WCF service which is referenced into an assembly. This Assembly has been referenced in a BizTalk project. While calling the WCF method via Orchestration it gave following error: Could not find default endpoint element that references contract 'SubscriberService.ISubscriber' in the ServiceModel client configuration section.

I've googled it and it is a known issue if you try to call the WCF via assembly in a Window project or web application. This can be resolved if we adds configuration in the project which is calling the assembly. And I've tested the scenario in sample project and copying the client configuration to my test project resolves the issue but this is not working in BIZTALK project.

Configuration in App.Config file of assembly:

<configuration>

  <configSections>
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
      <section name="CustomerMain.HelperAssembly.CoreProcess.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    </sectionGroup>
  </configSections>
  <system.serviceModel>
    <protocolMapping>
      <add binding="basicHttpBinding" scheme="http" />
      <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_ISubscriber" />
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:81/SubscriberService.svc"
          binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ISubscriber"
          contract="SubscriberService.ISubscriber" name="BasicHttpBinding_ISubscriber" />
    </client>
  </system.serviceModel>

</configuration>

Configuration in Biztalk Project's App.Config file:

<configuration>

  <system.serviceModel>
    <protocolMapping>
      <add binding="basicHttpBinding" scheme="http" />
      <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_ISubscriber" bypassProxyOnLocal="true" />
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:81/SubscriberService.svc"
          binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ISubscriber"
          contract="SubscriberService.ISubscriber" name="BasicHttpBinding_ISubscriber" />
    </client>
  </system.serviceModel>

</configuration>

Thanks

Upvotes: 0

Views: 123

Answers (1)

DTRT
DTRT

Reputation: 11040

Because this is a BizTalk project, the answer begins with do not do this.

While you can, it is not the correct way to call a Service in a BizTalk app.

So, the correct way to address this is to add that Service to your app using the BizTalk WCF Adapter.

If anyone on you team raises any objections, we're happy to help you address those. There is no scenario where what you describe is the right thing to do.

Upvotes: 1

Related Questions