Dennis van der Stelt

The most votes generally drown out the best votes

Community

News

  • Meet me at PDC08

Email Notifications

I read...

I Use...

Tags

Recent Posts

Archives

“M” and MService

I’ve been talking to people and perhaps here on the blog that during the Doug Purdy talk they showed a demo of MService where, with a few lines of code, a REST enabled WCF services with WF activities was created with only so few lines of actual code.

service Service

{

  operation PhotoUpload(stream : Stream) : Text

  {

    .PostUriTemplate = "upload";

 

    index : Text = invoke DateTime.Now.Ticks.ToString();

    filename : Text = "d:\\demo\\photo\\" + index + ".jpg";

    invoke MService.ServiceHelper.StoreInFile(stream, filename);

 

    return index;

  }

 

  operation PhotoGet(index : Text) : Stream

  {

    .UriTemplate = "getphoto/{index}";

    .ContentType = "image/jpeg";

 

    filename : Text = "d:\\demo\\photo\\" + index + ".jpg";

    return invoke File.OpenRead(filename);

  }

 

  endpoint HttpEndpoint

  {

    Binding = WebHttpBinding;

    Address = "http://localhost:8080/service/";

  }

}

Add breakpoints, post a photo or get one and the breakpoints are hit under debugging. You can see activities and endpoints in the locals window.

At the bottom you can see the endpoint defined. The first operation is PhotoUpload and it invokes code to store a file. Runtime this results in a WF activity storing the file on disc. The second operation is the get and it invokes a file read activity.

In the PhotoUpload operation you also see the invoke of DateTime.Now.Ticks.ToString(), which will result in a code-activity in WF, running the specified code.

This is just it, a REST enabled service for uploading, storing and retrieving images.

Remember that this is MService, including a WF/WCF runtime that understands the language ‘M’, hosted inside Dublin.

Comments

Vijay Santhanam said:

Looks nice, but what does the calling code in C# look like?

Does the WService publish a wsdl that can be used to create C# proxy classes from? How does this work for simplifying/automating calling code?

# October 31, 2008 6:49 PM

Dennis van der Stelt said:

@Vijay : That's the good part, there is no C# code generated. It's immediately handled by the runtime

I don't know about the WSDL, if it does that right now. But eventually it should be possible.

As for calling code, that hasn't changed.

Remember that this is extremely pre-alpha bits. I don't know if you can even play around with MService yet.

# November 1, 2008 6:52 PM

System.Blog.Martens.Ben said:

Microsoft "Oslo" Resources " Oslo" Developer Center Download the "Oslo" SDK Ask a Question About "Oslo

# November 4, 2008 9:00 PM

Dennis van der Stelt on "Oslo" « .Net Braindrops said:

Pingback from  Dennis van der Stelt on "Oslo" « .Net Braindrops

# November 18, 2008 2:51 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)