zdarsky.peter
zdarsky.peter

Reputation: 6277

Could not find default endpoint element that references contract

I have a ASP .NET MVC app that I want to be able to connect to SOAP API.

I have created a wrapper project were I have my common methods that are working with the API. I have created this wrapper because the file generated by tool is so huge the project build would take ages. From api doc site:

The tool then generates a single file named EconomicWebService.cs with the proxy code. This file can then be included directly in a project (this can slow down your Visual Studio as it is a rather big file) or built into a dll that can be referenced from your project)

I have referenced this wrapper as dll in my class library (middle layer) that is referenced into my MVC application.

Sadly it is not working, and I am getting this error:

Could not find default endpoint element that references contract 'S2s.Economic.WebService.EconomicWebServiceSoap' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.

Webconfig

<system.web>
   .....
</system.web>

<runtime>
...
</runtime>

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
         <binding name="EconomicWebServiceSoap">
             <security mode="Transport" />
         </binding>
         <binding name="EconomicWebServiceSoap1" />
      </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="https://api.e-conomic.com/secure/api1/economicwebservice.asmx"
            binding="basicHttpBinding"  bindingConfiguration="EconomicWebServiceSoap"
            contract="PTS.S2s.Economic.WebService.EconomicWebServiceSoap"
            name="EconomicWebServiceSoap" />
    </client>
</system.serviceModel>
</configuration>

Upvotes: 2

Views: 2684

Answers (1)

zdarsky.peter
zdarsky.peter

Reputation: 6277

I have managed to find a workarround with manual endpoint setup in the code.

 EndpointAddress  endpoint = new EndpointAddress( "https://api.e-conomic.com/secure/api1/economicwebservice.asmx" );

Upvotes: 3

Related Questions