I like to use winforms to generate quick .exe tools for complex tasks, in this case checking to see if a .asmx webservice is responding.
in .net I did this via a wsdl generated proxy object.
Trying to do it in .net core.
static string GetData2(string url)
{
var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Accept.Add( new MediaTypeWithQualityHeaderValue( "text/xml" ) );
httpClient.DefaultRequestHeaders.Add( "SOAPAction", "http://jcdc-aeef.jcdev.org/JCDCADStudent/ADStudent.asmx" );
var soapXml= "<?xml version=\"1.0\" encoding=\"utf-8\" ?> " +
"<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
"<soap:Body>"+
"<GetGuidString xmlns=\"http://tempuri.org/\">"+
"<adUsername>Brown.Eric</adUsername>" +
"</GetGuidString>" +
" </soap:Body>" +
"</soap:Envelope>";
var response = httpClient.PostAsync( "http://jcdc-aeef.jcdev.org/JCDCADStudent/ADStudent.asmx", new StringContent( soapXml, Encoding.UTF8, "text/xml" ) ).Result;
var content = response.Content.ReadAsStringAsync().Result;
return content;
}
But it's acting like my soap request is malformed
What is wrong with my soap requst?
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">soap:Bodysoap:Faultsoap:ClientSystem.Web.Services.Protocols.SoapException: > Server did not recognize the value of HTTP Header SOAPAction: http://jcdc-aeef.jcdev.org/JCDCADStudent/ADStudent.asmx. at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest() at System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message) at System.Web.Services.Protocols.SoapServerProtocol.Initialize() at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)</soap:Fault></soap:Body></soap:Envelope>
Soap spec from .asmx page for webmethod.

My webservice code is namespaced thusly [WebService( Namespace = "http://tempuri.org/" )]