This project is read-only.

Fully serialize parameters and return types

Feb 28, 2012 at 9:48 AM

Hi,

I like what you've you've done here, its great and just "works". However, it only goes so far. What I'm looking for is more of a WSDL for my JSON web services. For example, using the SMD behaviour on one of my services produces the following output:

{
  "target": "http://localhost:49580/MobileServices.svc/",
  "services": {
    "Login": {
      "transport": null,
      "target": "Login",
      "envelope": "JSON",
      "parameters": [
        {
          "name": "request",
          "type": "MobileServices.Contracts.LoginRequest"
        }
      ]
    }
  }
}

What I'd really like it to do is serialise "MobileServices.Contracts.LoginRequest" as well as the service return type either as part of the single call to /?smd or as a separate call. Is this possible?

Thanks,

Mike,

Coordinator
Feb 28, 2012 at 9:32 PM

Hi mikevanoo,

I am not sure to fully understand your blocking point.
This description of the
Login service, requires a parameter named "request" and type "MobileServices.Contracts.LoginRequest".

It is the responsibility of your client side library (dojo or anything else) to serialize a javascript object into it's json equivalent, that will be deserialized on the server side as an instance of type MobileServices.Contracts.LoginRequest.

I hope this will helps you.

Feb 28, 2012 at 9:49 PM
Thanks for your reply.

I guess that is my point: how does the client side library know what MobileServices.Contracts.LoginRequest looks like? Do the data contracts have to be shared out of band? If the json schema exposed the level of detail of a WSDL then the client side library could have all the information it needs to call the Login service. Does the json schema not go to the level of a service being fully discoverable?

Thanks again,

Mike.


From: [email removed]
To: [email removed]
Date: Tue, 28 Feb 2012 13:32:32 -0800
Subject: Re: Fully serialize parameters and return types [SMDBehavior:346533]

From: Fab_Michellonet
Hi mikevanoo,
I am not sure to fully understand your blocking point.
This description of the
Login service, requires a parameter named "request" and type "MobileServices.Contracts.LoginRequest".
It is the responsibility of your client side library (dojo or anything else) to serialize a javascript object into it's json equivalent, that will be deserialized on the server side as an instance of type MobileServices.Contracts.LoginRequest.
I hope this will helps you.
Read the full discussion online.
To add a post to this discussion, reply to this email (SMDBehavior@discussions.codeplex.com)
To start a new discussion for this project, email SMDBehavior@discussions.codeplex.com
You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.
Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com
Coordinator
Mar 1, 2012 at 11:09 PM

Hi mikevanoo,

you're pointing the main problem of the draft SMD, at least that was the case the last time I've had a look.

So actually, this is a good solution to share the contract off band.

Another solution would be to use the JSON.Net dynamic json deserialization to accept any json sent from the client to your server.

This blog post might help you to start with JSON.NET lib :