Bug 13702 - RESTful self-hosted json deserialize bug
Summary: RESTful self-hosted json deserialize bug
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: WCF assemblies (show other bugs)
Version: 2.10.x
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-08-02 03:07 UTC by AlexZ
Modified: 2013-08-02 03:07 UTC (History)
1 user (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description AlexZ 2013-08-02 03:07:42 UTC
I met 2 bugs while porting my tested programme from .NET to MONO, but it just showed up.

First one is, My service is using webHttpBinding and serialize/deserialize in json, when pass it multiple parameters, it throw below
-------------------------------------------------------------------------------------------------------------------
Exception 'Element' is an invalid node type.  Line 1, position 54.   at System.Xml.XmlReader.ReadEndElement () [0x00000] in <filename unknown>:0 
  at System.ServiceModel.Dispatcher.WebMessageFormatter.DeserializeObject (System.Runtime.Serialization.XmlObjectSerializer serializer, System.ServiceModel.Channels.Message message, System.ServiceModel.Description.MessageDescription md, Boolean isWrapped, WebContentFormat fmt) [0x00000] in <filename unknown>:0 
-------------------------------------------------------------------------------------------------------------------
Second is if try to post it invalid post format(say, missing Content-Type in request header, or invalid json format),
program will force shutdown instead of throw an exception.

Please help! THANK YOU!

-------------------------------------------------------------------------------------------------------------------

Fiddler Post

User-Agent: Fiddler
Host: 192.168.1.99:18688
Content-Length: 36
Content-Type: application/json

{
"name":"Bruce",
"say":"hello"
}
-------------------------------------------------------------------------------------------------------------------
Interface

        [OperationContract]
        [WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)]
        string Echo(string name, string say);
-------------------------------------------------------------------------------------------------------------------
App.config

<?xml version="1.0"?>
<configuration>
  <system.serviceModel>      
    <services>
      <service name="Contracts.MyService" behaviorConfiguration="MEXBehavior">
        <endpoint address="" binding="webHttpBinding" contract="Contracts.IMyService" behaviorConfiguration="MyRestBehavior" /> 
        <host>
          <baseAddresses>
            <add baseAddress="http://192.168.1.99:18688/MyService"/>
          </baseAddresses>
        </host>
      </service>
    </services>

    <behaviors>
      <endpointBehaviors>
        <behavior name="MyRestBehavior">
          <webHttp />
        </behavior>
      </endpointBehaviors>
      
      <serviceBehaviors>
        <behavior name="MEXBehavior">
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <serviceMetadata/>
        </behavior>
      </serviceBehaviors>
    </behaviors>

    

  </system.serviceModel>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> </startup></configuration>

Note You need to log in before you can comment on or make changes to this bug.