[Mono-dev] Problems with System.ServiceModel.Web
atsushieno at veritas-vos-liberabit.com
Fri Oct 15 06:46:27 EDT 2010
OK, I have checked in your patch in almost identical form in git master.
I found that GET operation does not pass on .NET when
GetRequestClientFormatter() is invoked, so I split it into another contract
and marked the test as NotWorking (it haven't passed earlier anyways).
Thanks a lot for the patch :)
On 2010/10/13 23:34, Frank Wilhelm wrote:
> thank you for your review. I tried to use the style of the existing
> code but I guess I missed some spaces.
> The problem with your modifications is that it defeats the purpose of
> my patch. In .NET I can host a method with a definition like:
> void Set(string name, string value);
> In Mono I couldn't. This is why I created the patch. With your
> modifications the problem still exists, but now in a different place.
> ValidateStyleForMessageFormatter shouldn't reject a method like the
> one above. Like the modified Validate method it should consider the
> UriTemplate. In the method above there is no need to wrap because
> everything is passed in the URI. That works for .NET and also works
> for Mono if the validation is less restrictive. I think the major
> problem with my patch is that it doesn't work if the UriTemplate is
> null. With only that fixed the test RejectTwoParametersWhenNotWrapped
> will not break and it also works for my purpose.
> I also checked the .NET behavior for WrappedRequest and
> WrappedResponse. In .NET the BodyStyle WrappedRequest resolves
> problems with multiple inputs and WrappedResponse with multiple
> outputs. That is what I expected and it is the opposite to what is
> done in ValidateStyleForMessageFormatter.
> So I created a new version that hopefully resolves all issues.
> On 12.10.2010 13:30, Atsushi Eno wrote:
>> Thanks for the patch, I very much appreciate it. Though there were
>> some problems in your patch.
>> - your implementation had an assumptiopn that WebGetAttribute and
>> WebInvokeAttribute has non-null UriTemplate. They can indeed be
>> - Your change broke RejectTwoParametersWhenNotWrapped() in
>> WebInvokeAttributeTest. It is because, in your
>> change you just removed existing code that checked what this
>> test exactly
>> verifies i.e. invalid multiple arguments. You might think it is
>> "very strange"
>> and "wrong" but that's what .NET indeed does (looks like it is
>> done in
>> GetClientMessageFormatter() in current version of .NET though).
>> - There was a couple of coding style fixage needed. You had right
>> and wrong
>> style, so I assume you might have already known the style, but
>> in case you
>> haven't, have a look at http://mono-project.com/Coding_Guidelines
>> (I found this page was not linked from our "Contributing" page,
>> which was
>> our bad, just fixed it.)
>> I'm attaching the modified fix here. It includes some additional
>> tests. I'll commit the changes unless you have further comments.
>> (As a cosmetic excuse, WebMessageBodyStyle.Bare was new in 3.5 SP1
>> AFAIR, so it was left ignorant in our implementation from 3.5 era.)
>> Atsushi Eno
>> On 2010/10/09 18:27, Frank Wilhelm wrote:
>>> 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
>>> 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.
>>> Mono-devel-list mailing list
>>> Mono-devel-list at lists.ximian.com
More information about the Mono-devel-list