[Mono-dev] Problems with System.ServiceModel.Web

Frank Wilhelm fwilhelm at nowisys.de
Sat Oct 9 05:27:07 EDT 2010


  Hello Mono devs,

I tried running my web service on Mono and ran into several issues. I 
use the WebHttpBinding to create REST web services by hosting that with 
the ServiceHost class. This works fine on .NET but the Mono 
implementation of System.ServiceModel.Web shows very different, and very 
limiting, behavior. So I decided instead of waiting for a fix I try to 
track down the issues. Here is the first I discovered.

The Validation of WebHttpBehavior is very limiting. If a POST operation 
has several parameters it will only host them if you define 'wrapped' 
body format. But this isn't required if the parameters are passed in the 
UriTemplate. Also the requirements for WrappedRequest and 
WrappedResponse look very strange. I have to wrap my response if I have 
multiple input parameters? That looks wrong.

I looked up in the MSDN what the Validate method does for .NET, and then 
I tried to make the .NET implementation fail. It just doesn't behave 
like specified in the documentation, it never fails no matter what.

I attach a patch that will make the Validate method less picky. It will 
look for placeholders in the URI template and only after that decides 
whether wrapping is needed or not. That is still more restrictive than 
the .NET implementation but for me it looks like the right thing to do. 
I also added a test that reproduces the problem.

Please accept the patch and give me some feedback on what I can improve 
for further contributions.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0001-Fixed-error-in-validation-by-WebHttpBehavior.patch
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20101009/59fcafa9/attachment.pl 


More information about the Mono-devel-list mailing list