+ Reply to Thread
Results 1 to 2 of 2

Thread: Pass multiple parameter to the WCF REST service

  1. #1
    Junior Member
    Join Date
    Oct 2012
    Posts
    3

    Pass multiple parameter to the WCF REST service

    I want to upload image to the WCF REST service. I also want to pass another parameter to the service.
    I have created following method for that:
    Code:
    [WebInvoke(Method = "POST", UriTemplate = "MyService/{param}")]
    string MyService(Stream stream, string param);
    I am getting 400 Bad request error when I invoke it from aspx page. Any help would be appreciated.

  2. #2
    Junior Member
    Join Date
    Oct 2012
    Posts
    4
    First you need to change UriTemplate like this: MyService?param={param}. After that you need to set BodyStyle to WrappedRequest. So your method signature will look like this:
    Code:
    [WebInvoke(Method = "POST", UriTemplate = "MyService?param={param}", BodyStyle = WebMessageBodyStyle.WrappedRequest)]
    string MyService(Stream stream, string param);
    Let me know if it works.

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts