Skip to content

Instantly share code, notes, and snippets.

Created December 10, 2017 12:47
What would you like to do?
SOAP over Azure API Management, Logic Apps and Functions
public static class WcfCallingHttpTrigger
public static async Task<HttpResponseMessage> Run(
[HttpTrigger(AuthorizationLevel.Function, "get", Route = "data/{value}")] HttpRequestMessage req,
int value,
TraceWriter log)
log.Info("C# HTTP trigger function processed a request.");
// Instantiates the binding object.
// Depending on the security definition, the security mode should be adjusted.
var binding = new BasicHttpBinding(BasicHttpSecurityMode.None);
// If necessary, appropriate client credential type should be set.
//binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
// Instantiates the endpoint address.
var endpoint = new EndpointAddress(Config.WcfServiceEndpoint);
using (var client = new Service1Client(binding, endpoint))
// If necessary, username and password should be provided.
//client.ClientCredentials.UserName.UserName = "username";
//client.ClientCredentials.UserName.Password = "password";
var result = await client.GetDataAsync(value).ConfigureAwait(false);
log.Info($"{result} received.");
return req.CreateResponse(HttpStatusCode.OK, result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment