API Forum

This forum is in read-only mode.
Please refer to our API support in case you have any questions.
We can be reached at api@e-conomic.com
e-conomic API developer forum

Could not find default endpoint når jeg bruger service reference

0

Jeg har prøvet at tilføje både en web reference og en service reference til:

https://api.e-conomic.com/secure/api1/EconomicWebService.asmx?wsdl

Web reference virker fint, selvom det tager lang tid (næsten et minut) at instantiere klienten, men service referencen fejler.

Desuden kan jeg ikke regne ud hvordan jeg giver den CookieContainer når jeg bruger service reference.

Jeg bruger følgende kald:

EconomicAPI.EconomicWebService client = 
new EconomicAPI.EconomicWebService { 
CookieContainer = new CookieContainer() 
};

EconomicAPI_SR.EconomicWebServiceSoapClient client = 
new EconomicAPI_SR.EconomicWebServiceSoapClient();

 

Fejlen på service referencen er: 

Could not find default endpoint element that references contract 'EconomicAPI_SR.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.

created Jan 7, 2016 by kejster
33% Accept Rate
Q 3 A 1 C 0

1 Answer

+1
 
Best answer
Update:
 
Det var fordi jeg brugte servicen i et class library, så jeg skulle kopiere nogle linier fra app.config til den app.config der lå i mit program.
 
Desuden skulle denne linie tilføjes for at bruge cookies:
 
((BasicHttpBinding)client.Endpoint.Binding).AllowCookies = true;
 
answered Jan 7, 2016 by kejster
Visma e-conomic A/S
...