c# - Sending and receiving SOAP messages -
I am writing a web service client in C # and do not want to create and serialize / deserize objects Rather, sending them and receiving them is the raw XML
Is it possible in C #?
Here is a part of an implementation based on the example of John M. Gant. Setting the Content Type Request Header is important, besides my request, credentials are required.
Protected Virtual WebQuest Contrast (ISO Message Message Soap Message) {var wr = WebRequest.Create (soapMessage.Uri); Wr.ContentType = "text / xml; charset = UTF-8"; Wr.ContentLength = soapMessage.ContentXml.Length; Wr.Headers.Add ("SOAPAction", Soap Message SoapAction); Wr.Credentials = Soap Message Credentials; Wr.Method = "post"; Wr.GetRequestStream (). Write (encoding. UTF8.GetBytes (soapMessage.ContentXml), 0, soapMessage.ContentXml.Length); Return return; } Public Interface ISoapMessage {string URI {get; } String ContentXml {get; } String SoapEction {Receive; } {Receive ICredentials credentials; }}
Comments
Post a Comment