Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I haven't actually tried this, but <a href="http://dotnetfriendly.blogspot.com/2010/08/bare-and-wrapped-message-in-wcf-rest.html" rel="nofollow">this article</a> might have what you want. He created a wrapped message by doing this:</p> <pre><code> private void ConsumeWcfRest() { string url = "http://something/MyWebsite/tagservice"; Tag tag1 = new Tag() { ID = 1, TagName = "test1" }; Tag tag2 = new Tag() { ID = 2, TagName = "test2" }; HttpWebRequest req = HttpWebRequest.Create(url + "/tags/wrapped/1") as HttpWebRequest; req.Method = "POST"; string content = "&lt;DoSomethingWrapped xmlns='http://mytagservice'&gt;"; content = content + DoSerialize(tag1, "tag1"); content = content + DoSerialize(tag2, "tag2"); content = content + "&lt;/DoSomethingWrapped&gt;"; // ..... } private string DoSerialize(object obj, string rootName) { System.Runtime.Serialization.DataContractSerializer se; if (string.IsNullOrEmpty(rootName)) se = new System.Runtime.Serialization.DataContractSerializer(obj.GetType()); else se = new System.Runtime.Serialization.DataContractSerializer(obj.GetType(), rootName, ""); System.IO.MemoryStream ms = new System.IO.MemoryStream(); se.WriteObject(ms, obj); ms.Position = 0; byte[] arr = new byte[ms.Length]; ms.Read(arr, 0, Convert.ToInt32(ms.Length)); return new System.Text.UTF8Encoding().GetString(arr); } </code></pre> <p>So basically he is using the normal <code>DataContractSerializer</code> to serialize each argument, then manually putting XML tags around that. It seems a little hacky, but it might work...</p> <p>You might want to start decompiling the WCF libraries and see if you can find out how WCF does it in the first place.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload