views:

175

answers:

0

Hi there. I'm going slidely mad over here, maybe someone can help me figure out what's going on. I have a WCF service exposing a function using webinvoke, like so:

[OperationContract]
        [WebInvoke(Method = "POST",
           BodyStyle = WebMessageBodyStyle.Wrapped,
           RequestFormat = WebMessageFormat.Json,
           ResponseFormat = WebMessageFormat.Json,
           UriTemplate = "registertokenpost"
        )]

        void RegisterDeviceTokenForYoumiePost(test token);

The datacontract for the test class looks like this:

[DataContract(Namespace="Zooma.Test", Name="test", IsReference=true)]
    public class test
    {
        string waarde;
        [DataMember(Name="waarde", Order=0)]
        public string Waarde
        {
            get { return waarde; }
            set { waarde = value; }
        }
    }

When sending the following json message to the service, { "test": { "waarde": "bla" } }

the trace log gives me errors (below). I have tried this with just a string instead of the datatype (void RegisterDeviceTokenForYoumiePost(string token); ) but i get the same error. All help is appreciated, can't figure it out. It looks like it's creating invalid xml from the json message, but i'm not doing any custom serialization here.

The formatter threw an exception while trying to deserialize the message: Error in
 deserializing body of request message for operation 'RegisterDeviceTokenForYoumiePost'. 
Unexpected end of file. **Following elements are not closed**: waarde, test, root.</Message><StackTrace>
   at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeRequest(Message message, 
Object[] parameters)