Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4582628
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T21:06:08+00:00 2026-05-21T21:06:08+00:00

Following is my Contract and the OperationContracts, my issue is when I’m going with

  • 0

Following is my Contract and the OperationContracts, my issue is when I’m going with WebGet attribute to all the methods my service is working fine, when I remove WebGet Attribute to any one of the OperationContracts im getting following error.

Operation ‘ProductDetails’ of
contract ‘IDemo’ specifies multiple
request body parameters to be
serialized without any wrapper
elements. At most one body parameter
can be serialized without wrapper
elements. Either remove the extra body
parameters or set the BodyStyle
property on the
WebGetAttribute/WebInvokeAttribute to
Wrapped.

These are my methods

string AddNumbers(int x,int y);  --- using [WebGet]

string SubtractNumbers(int x, int y); -- using [WebGet]

String ProductDetails(string sName, int cost, int Quntity, string binding); -- not using using [WebGet]

CompositeType GetDataUsingDataContract(CompositeType composite); -- not using [WebGet]

Is it mandatory to include [WebGet] attribute to all the operation contracts if we go for WebHttpbinding??.

public interface IService1
{
    [OperationContract]        
    string GetData(int value,string binding);

    [OperationContract]
    [WebGet(BodyStyle = WebMessageBodyStyle.Bare,
           ResponseFormat = WebMessageFormat.Xml,
           UriTemplate = "/Add?num1={x}&num2={y}")]
    string AddNumbers(int x,int y);

    [OperationContract]
    [WebGet(BodyStyle = WebMessageBodyStyle.Bare,
           ResponseFormat = WebMessageFormat.Xml,
           UriTemplate = "/Subtract?num1={x}&num2={y}")]
    string SubtractNumbers(int x, int y);

    [OperationContract]
    String ProductDetails(string sName, int cost, int Quntity, string binding);

    [OperationContract]
    CompositeType GetDataUsingDataContract(CompositeType composite);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T21:06:08+00:00Added an answer on May 21, 2026 at 9:06 pm

    The error message really says exactly what the problem is:

    Operation ‘ProductDetails’ of contract
    ‘IDemo’ specifies multiple request
    body parameters to be serialized
    without any wrapper elements. At most
    one body parameter
    can be serialized
    without wrapper elements.

    You cannot have methods which expect more than one parameter, unless you wrap those, e.g. by specifying the BodyStyle setting in the WebGet attribute.

    So yes: either you have to apply a [WebGet] to each method of your REST service, or you can reorganize your methods to take in only a single parameter (e.g. by wrapping up the two or three parameters you have now into a single class that holds those multiple parameters, and then passing in an object instance of that Request class).

    [DataContract]
    public class AddNumbersRequest
    {
       [DataMember]
       public int X { get; set; }
       [DataMember]
       public int Y { get; set; }
    }   
    
    [OperationContract]
    string AddNumbers(AddNumbersRequest request);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following problem, given the following service contract, data contract, and service
I have an AJAX-enabled WCF service with the following signature: [OperationContract] [WebGet] public JQGridContract
I have a WCF webservice that has the following service contract [ServiceContract(Namespace = http://example.org)]
As per the following article, I have defined my service contract as http://blogs.msdn.com/b/endpoint/archive/2010/11/13/simplified-asynchronous-programming-model-in-wcf-with-async-await.aspx [ServiceContract]
Say I have the following service contract and two concrete implementations: [OperationContract] public interface
I've created the following RESTful WCF service, which works just fine when running it
I would like to change the contract of the following Quicksort implementation to return
I have the following: <%= f.select :phase_names, options_for_select([RFP Stage, Pre Contract, Awarded, Unsuccessful, Completed]),
We've got the following WCF Service Contracts: [ServiceContract(Namespace = http://example.com, Name = Service1)] public
I am quite new to hibernate. I have got the following tables: Contract ContractID

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.