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

  • Home
  • SEARCH
  • 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 4044658
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T13:17:11+00:00 2026-05-20T13:17:11+00:00

I have written a REST Service in WCF in which I have created a

  • 0

I have written a REST Service in WCF in which I have created a method(PUT) to update a user. for this method I need to pass multiple body parameters

[WebInvoke(Method = "PUT", UriTemplate = "users/user",BodyStyle=WebMessageBodyStyle.WrappedRequest)]
[OperationContract]
public bool UpdateUserAccount(User user,int friendUserID)
{
    //do something
    return restult;
}

Although I can pass an XML entity of user class if there is only one parameter. as following:

var myRequest = (HttpWebRequest)WebRequest.Create(serviceUrl);
myRequest.Method = "PUT";
myRequest.ContentType = "application/xml";
byte[] data = Encoding.UTF8.GetBytes(postData);
myRequest.ContentLength = data.Length;
//add the data to be posted in the request stream
var requestStream = myRequest.GetRequestStream();
requestStream.Write(data, 0, data.Length);
requestStream.Close();

but how to pass another parameter(friendUserID) value?
Can anyone help me?

  • 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-20T13:17:11+00:00Added an answer on May 20, 2026 at 1:17 pm

    For all method types except GET only one parameter can be sent as the data item. So either move the parameter to querystring

    [WebInvoke(Method = "PUT", UriTemplate = "users/user/{friendUserID}",BodyStyle=WebMessageBodyStyle.WrappedRequest)]
    [OperationContract]
    public bool UpdateUserAccount(User user, int friendUserID)
    {
        //do something
        return restult;
    }
    

    or add the parameter as node in the request data

    <UpdateUserAccount xmlns="http://tempuri.org/">
        <User>
            ...
        </User>
        <friendUserID>12345</friendUserID>
    </UUpdateUserAccount>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to web services. I have written a rest web service which
I want to call a rest service written in WCF (which can support both
i have written a stand alone WCF REST service in 4.0 under Studio 2010
I have written a REST service hitting a MySQL database. This service will soon
I have written a REST service with windows azure using the WCF Rest Service
I have a generic REST service layer written to Java modules which can be
I have a REST service method written in C#, defined as below: [WebGet(UriTemplate =
I've written a C# Windows Service that provides a REST api through WCF. This
I have written a WCF service with the REST template that has the defaultOutgoingResponseFormat
I have written a WCF REST API for third-party use. One of the things

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.