user1623237
user1623237

Reputation: 223

Precompiled Azure Function and SOAP endpoints

I'm writing a precompiled Azure function that will perform a SOAP call to ServiceNow. The code works as a standalone exe but I can't seem to get it converted to a precompiled function. In know it's because my DLL can't find the app.config file but what's the best way to get around it. Error message below. ServiceNow requires I set certain bindings and endpoint configuration. The other contractors for their ServiceNowSoapClient class allow me to specify a url directly but don't seem to allow me to get to the binding settings.

Exception while executing function: Functions.TimerTriggerCSharp. System.ServiceModel: Could not find endpoint element with name 'ServiceNowSoapDev' and contract 'ServiceNowReference.ServiceNowSoap' 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 name could be found in the client element.

Upvotes: 0

Views: 455

Answers (1)

Mikhail Shilkov
Mikhail Shilkov

Reputation: 35144

In WCF you can define your client binding and endpoint programmatically instead of using app.config. Use the constructor of the generated client with two parameters:

new ServiceNowSoapClient(binding, remoteAddress);

See more code here.

Upvotes: 1

Related Questions