title: WCF REST web service to accept Stream and list of objects
body: <p>I am building a couple of REST web services with WCF. I have some POST services to which I pass a list of objects in the wrapped HTTP body like this:</p>
  
  <pre><code>    [OperationContract]
      [WebInvoke(
          Method = "POST",
          UriTemplate = "DoSomething/pages?term={term}",
          BodyStyle = WebMessageBodyStyle.Wrapped)
      ]
      MyResponseContainer DoSomethingFromPages(string term, List&lt;Page&gt; pages);
  </code></pre>
  
  <p>This works just fine. I can wrap the <code>List&lt;Page&gt;</code> into JSON or XML and put it into the body and it is deserialized automatically.</p>
  
  <p>In a similar way I have another service where I read a binary stream (a file) from the HTTP body like this:</p>
  
  <pre><code>    [OperationContract]
      [WebInvoke(
          Method = "POST",
          UriTemplate = "DoSomething/upload?term={term}",
          BodyStyle = WebMessageBodyStyle.Bare)
      ]
      MyResponseContainer DoSomethingUploadFile(Stream httpBody, string term);
  </code></pre>
  
  <p>Now my question is: Can I somehow combine both ways? So basically I want to pass a list of custom objects together with a (file)stream. And I would like to avoid using multi-part forms style.</p>
  
  <p>Thanks a lot!</p>