0

I use Fiddler to call my method. Here are the parameters:

{"timestamp":"",
"json":
    {
        "something":[{"text":"bla","status":"1"},{"text":"sfdf","status":"1"}],
        "somethingElse":[{"description":"description""status":"1"}],
        "som1":[{"id":"1""status":"1"}]
    }
 }

The path to the method is correct. Here is the signature:

public void MyMethod(string timestamp, string json)

But it never gets called. How to modify my method so that it gets called? Should the parameter 'json' be not string?

I make the call via Fiddler. My method is in C#. The project is Wcf service.

I tried changing the type of json from string to object, and the method gets called, but json has no value.

7
  • I wonder what language you're using and what environment your setup is in? Please retag and add some more info. Commented Mar 21, 2012 at 7:58
  • @NickWeaver I make the call via Fiddler. My method is in C#. Commented Mar 21, 2012 at 8:00
  • WCF, Web Service, Web API, Open Rasta? Commented Mar 21, 2012 at 8:38
  • 1
    @Srcee, what binding are you using for this service? Commented Mar 21, 2012 at 8:58
  • 1
    When you change it from string to object it gets called but json doesnt have a value because you are using the type as object which is generic. Try using a specific type for the json parameter as the framework would be able to deserialize the value to that specific type of object then Commented Mar 21, 2012 at 9:51

2 Answers 2

1

try this in your interface,

 public interface IRestFulWCF
{
    [OperationContract(Name = "MyMethod")]
    [WebInvoke(
        RequestFormat=WebMessageFormat.Json,
        UriTemplate="/Example",
        Method="POST",
        BodyStyle=WebMessageBodyStyle.WrappedResponse)
    ]
    public void MyMethod(string timestamp, string json) ;

}

please post your interface detail end web.config here if this is not helping you.

Sign up to request clarification or add additional context in comments.

Comments

0

What I did was creating a new class which had these properties: List, List, List, and I changed the method:

public void MyMethod(string timestamp, theNewClass json) ;

and it worked.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.