Konsumieren von SOAP-web-service in ASP.NET

Habe ich einen SOAP-WSDL (gefunden hier: https://portal.bsh-partner.com/picenter/server/a2a/) und ich bin versucht zu konsumieren, die web-services.

var soapEnvelope = string.Empty;
soapEnvelope = "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
soapEnvelope += "<soapenv:Envelope xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:q0=\"http://thexmlhost.com\">";
soapEnvelope += "<q0:Connect>";
soapEnvelope += "<q0:Username>username</q0:Username>";
soapEnvelope += "<q0:Password>password</q0:Password>";
soapEnvelope += "</q0:Connect>";
soapEnvelope += "</soapenv:Body>";
soapEnvelope += "</soapenv:Envelope>";

var xmlHttp = new MSXML2.ServerXMLHTTP40();
xmlHttp.open("POST", "https://thexmlhost.com/", "", "");
xmlHttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xmlHttp.setRequestHeader("SOAPAction", "thexmlhost.com/");

xmlHttp.send(soapEnvelope);

xmlHttp.waitForResponse(500);

var outXml = xmlHttp.responseText;

Die Antwort hält der Rückkehr eine Allgemeine HTTP-Antwort-Fehler-Seite. Irgendeine Idee, wie ich sollte vorbei mein Soap-Umschlag, um die richtige Antwort von der web-service?

Warum in der Welt sind Sie basteln eine soap-Nachricht?
Idk, wenn ich sollte upvote dies, weil es ein so großartiges Beispiel dafür, es zu tun falsch oder downvote es aus dem gleichen Grund...

InformationsquelleAutor Lawrence | 2010-07-26

Schreibe einen Kommentar