0

Being completely new to WCF, I'm trying to make a RESTful service which will accept a file (the file is usually text with comma/tab-separated values) and a delimiter as parameters, parse the file and do some calculations. Based on what I read in others posts, I assume that the WCF service needs to save the file on the server first.

EDIT: I presume the answer is something similar to the one answered here, but I'm also interested in the code not mentioned in the answer.

Here is the interface method:

    [OperationContract]
    [WebInvoke(Method = "POST", UriTemplate = "dataSets/{dataSet}/metadata?delimiter={delimiter}&format=json",
       BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
    void PostMetadataJSON(Stream dataSet, char delimiter)
    {

    }

And here is the method in the class implementing the interface:

void IMyService.PostMetadataJSON(Stream data, char delimiter)
    {
      //the delimiter is needed for splitting each line of the file  
    }

Can someone explain the approach to follow? I've found some examples on SO but they only got me more confused as I am completely new to this.

Community
  • 1
  • 1
globetrotter
  • 997
  • 1
  • 16
  • 42

1 Answers1

0

Just use WCF's streaming support

http://msdn.microsoft.com/en-us/library/ms733742.aspx

James Manning
  • 13,429
  • 2
  • 40
  • 64