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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:10:02+00:00 2026-05-31T06:10:02+00:00

I am having a WCF service. The service is so that it returns the

  • 0

I am having a WCF service. The service is so that it returns the result as string. When I run the application, I am getting this error message.

The operation ‘GetTemplate’ could not be loaded because it has a parameter or return type of type System.ServiceModel.Channels.Message or a type that has MessageContractAttribute and other parameters of different types. When using System.ServiceModel.Channels.Message or types with MessageContractAttribute, the method must not use any other types of parameters.

My corresponding code is like this:
Interface:-

[OperationContract]
[WebGet(
 ResponseFormat = WebMessageFormat.Json,
        BodyStyle = WebMessageBodyStyle.Wrapped,
        UriTemplate = "GetTemplate/templateid={templateID}"
        )]
    Message GetTemplate(string templateID);

Implementation:-

 public Message GetTemplate(string templateID)
    {
        string jsonText = TemplateManager.GetJSONTemplate(templateID);
        return WebOperationContext.Current.CreateTextResponse(jsonText,
         "application/json; charset=utf-8", Encoding.UTF8);
    }

When I googled t I got to know that, we can’t use any serializable object as parameter or return type when using Message. I want to accept the templateid as parameter, in order to get the corresponding template. Is there any way to accept a parameter without having this error?

Thanks in advance.

Vipin Menon

  • 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-31T06:10:03+00:00Added an answer on May 31, 2026 at 6:10 am

    The error message basically translates into this: using the Message type is an all or nothing proposition, if you have a Message type output then you must either have a single Message parameter for the operation or no parameter at all. You should read this old but good MSDN article on the using the WCF Message type and what it can do for you. The Message class drops the level of coding abstraction from using standard .NET classes down to the WCF “plumbing” level where you manipulate the soap XML message your operation is receiving and manually create the soap XML message the operation will be sending out.

    It’s not clear why you are trying to use Message as a return type but you cannot use it in the manner of your sample code in the question.

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

Sidebar

Related Questions

I'm having a strange problem with my WCF service that returns data in JSON
I am having a minor problem with WCF service proxies where the message contains
I am having the following problem: I have a WCF service that checks a
I've written a windows service application that exposes a WCF REST web service. The
This is a strange problem that I am having with WCF trying to send
I'm having some issues with a WCF service and Impersonation, I've distilled this to
We're having a problem testing Entity Framework 4. We've deployed a WCF service that
I have A WCF service that has a class that inherits System.Web.Security.RoleProvider. In this
I’m writing a WCF service that returns data in JSON format to clients. I
I am having a service orientedwebsite that all its html is generated by wcf

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.