<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Header> <Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://tempuri.org/IMessageContract/GetAuthorInfo</Action> <h:AuthorIdentity xmlns:h="http://tempuri.org/">db2972</h:AuthorIdentity> </s:Header> <s:Body> <AuthorRequest xmlns="http://tempuri.org/" /> </s:Body> </s:Envelope>
string resultXml; const string url = "http://localhost:50399/MessageContract.svc"; WebRequest wbrqst = WebRequest.Create(url); HttpWebRequest httpreq = (HttpWebRequest)wbrqst; httpreq.Method = "POST"; httpreq.ContentType = "text/xml"; httpreq.Headers.Add("SOAPAction", url); httpreq.ProtocolVersion = HttpVersion.Version11; httpreq.Credentials = CredentialCache.DefaultCredentials; Stream requestStream = httpreq.GetRequestStream(); StreamWriter streamWriter = new StreamWriter(requestStream, Encoding.ASCII); StringBuilder sb = new StringBuilder(); sb.Append("<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">"); sb.Append("<s:Header>"); sb.Append("<Action s:mustUnderstand=\"1\" xmlns=\"http://schemas.microsoft.com/ws/2005/05/addressing/none\">http://tempuri.org/IMessageContract/GetAuthorInfo</Action>"); sb.Append("<h:AuthorIdentity xmlns:h=\"http://tempuri.org/\">db2972</h:AuthorIdentity>"); sb.Append("</s:Header>"); sb.Append("<s:Body>"); sb.Append("<AuthorRequest xmlns=\"http://tempuri.org/\" />"); sb.Append("</s:Body>"); sb.Append("</s:Envelope>"); streamWriter.Write(sb.ToString()); streamWriter.Close(); HttpWebResponse wr = (HttpWebResponse)httpreq.GetResponse(); StreamReader srd = new StreamReader(wr.GetResponseStream()); resultXml = srd.ReadToEnd();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)