Skip to content

Instantly share code, notes, and snippets.

@Rickedb
Created June 6, 2022 16:01
Show Gist options
  • Save Rickedb/3d566519da8ba3240b922d4e99129fda to your computer and use it in GitHub Desktop.
Save Rickedb/3d566519da8ba3240b922d4e99129fda to your computer and use it in GitHub Desktop.
Basic soap call
var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "<token>");
var xml = "<xml>";
var soapAction = "<soap-action>";
var httpContent = new StringContent(xml, Encoding.UTF8, "text/xml");
var request = new HttpRequestMessage(new HttpMethod("POST"), url)
{
Content = httpContent
};
request.Headers.Add("SOAPAction", soapAction);
var response = await client.SendAsync(httpContent);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment