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 6777099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:06:28+00:00 2026-05-26T16:06:28+00:00

I created a WCF service, that returns some data and also allow to post

  • 0

I created a WCF service, that returns some data and also allow to post some data to.
The methods of the service are as below:

    [OperationContract]
    bool UploadStream(Guid key, List<StreamRecord> values);

    [OperationContract]
    bool RegisterStream(Guid key);

    [OperationContract]
    StreamCollection GetStreams(Guid key);

I need to implement this with a REST interface.
I created a new interface, IRestService as below

    [WebInvoke(
        Method = "GET",
        ResponseFormat = WebMessageFormat.Xml,
        UriTemplate = "/bitpool/{poolKey}/streams")]
    BitStreamCollection GetBitStreams(string poolKey);

and it works ok (I can test it from the browser address bar and all is fine)

Now I want to implement also the Upload method, but I’m not sure how to do it
I tried with

    [WebInvoke(
        Method = "POST",
        RequestFormat = WebMessageFormat.Xml,
        ResponseFormat = WebMessageFormat.Xml,
        UriTemplate = "/stream/{streamKey}/records/{values}")]
    bool UploadStream(string streamKey, List<StreamRecordEntity> values);

But when I try to access the service in browser it gives error

http://localhost:6767/RestServer.svc/

it gives an error:

Operation ‘UploadBitStream’ in contract ‘IRestServerJson’ has a path variable named ‘values’ which does not have type ‘string’. Variables for UriTemplate path segments must have type ‘string’.

I think for POST I cannot define such URL, but how should I do it?

Also, method RegisterStream should check if stream with key exists and if not, create it and return true, otherwise return false.

Should I define it as GET (since it must return result) or as PUT or POST?

Thanks

  • 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-26T16:06:28+00:00Added an answer on May 26, 2026 at 4:06 pm

    Pass the values in the body of the POST request, formatted in xml, not on the url. An easy way to test this is to use Fiddler.

    Regarding RegisterStream, both POST and PUT can return information in the response body. You could use POST and return an appropriate HTTP status code depending on the action taken by the server: 201 Created if the resource is created, a different status code that makes sense in your application if the resource already exists.

    The caller can determine whether the resource was created or already existed based on the HTTP status code returned, so the bool return value wouldn’t be needed.

    Side note: you can use the [WebGet(...)] instead of [WebInvoke(Method = "GET"...)].

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created a WCF service (.NET 3.5) that grabs data from a db and
I have a Data Service created using WCF that internally uses nHibernate. This WCF
I created a WCF service that uses TagLib# ( http://developer.novell.com/wiki/index.php/TagLib_Sharp ) which relies on
I recently created a WCF service that works fine when tested from Visual Studio
We have created a WCF service hosted in a windows service that handles Authentication
I've created a .NET WCF service that is intended to always be over HTTPS.
I'm creating a WCF service that transfers entity objects created via entity framework. I
I have created a basic WCF service in IIS. I am aware that this
I've created a Windows Service that uses WCF for communications to it. The service
I'm working with a RESTful WCF service. One of the service methods returns byte[]

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.