简体   繁体   中英

WCF streaming with more parameters

I have succeeded to send my data to the service and from the service by making a data contract classes and putting inside as members, all the attributes I needed. I did like so:

[DataContract]
public class DataToSend{
[DataMember(Name="model")]
public MyData data;
[DataContract(Name="id")]
public string id;
}

and this is working for sending/ receiving usual data using json format. Now I want to send attachments as Stream, but id as well, to know where should I insert the attachments in a database. I've succeeded to make it work only with the Stream as input but I can't make it work with the id. I've tried to add it in the UriTemplate but that won't work.

Anyone has any idea on how I could handle this ? Thank you.

Basically, you just can't have any other parameter than Stream in your contract (ty WCF).

What can you do to solve this is to create a model as a MessageContract that will have a set of properties and accept one of them as a Stream.

Here is a link to help you out

http://social.msdn.microsoft.com/Forums/vstudio/en-US/ef4cfee3-4d96-44a5-9fa1-ebafdff9bee3/wcf-stream-with-more-than-one-parameter?forum=wcf

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM