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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:53:33+00:00 2026-05-13T22:53:33+00:00

I have defined the following Interface [ServiceContract] public interface IHealthProducts { [OperationContract()] ResponseClass OrderSelfSignedHealthCertificate();

  • 0

I have defined the following Interface

[ServiceContract]
public interface IHealthProducts
{
    [OperationContract()]
    ResponseClass OrderSelfSignedHealthCertificate();
}

Which returns the following type

[MessageContract]
public class ResponseClass
{
    [MessageBodyMember]
    public string AnimalSpeciesCode
    {
        get;
        set;
    }

    [MessageBodyMember]
    public int VBN
    {
        get;
        set;
    }
}

I expected that the generated client code would expose the OrderSelfSignedHealthCertificate method in the following way:

HealthProductsClient client = new HealthProductsClient();
ResponseClass response = client.OrderSelfSignedHealthCertificate();

Instead, the properties of ResponseClass aren’t wrapped in the ResponseClass, but exposed like so:

string OrderSelfSignedHealthCertificate(out int VBN)

When I exchange the MessageContract for a DataContract attribute and the MessageBodyMember for a DataMember attribute, I get the expected behaviour (ResponseClass response type).
I need the MessageContract however, because I need to put some of the properties in the SOAP header.

Am I doing something wrong? Is this normal behaviour? How do I get a ResponseClass return type, when using a MessageContract?

Any help greatly appreciated.

  • 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-13T22:53:34+00:00Added an answer on May 13, 2026 at 10:53 pm

    When your [MessageContract] contains more than one [MessageBodyMember], then WCF will return the first one as return value from the service call (AnimalSpeciesCode in your case), and all others are returned as out or ref paraemters.

    You can solve this by having only a single [MessageBodyMember] in your message contract that encapsulates all items you need to have return, something like this:

    [DataContract]
    class CompoundData
    {
        public string AnimalSpeciesCode { get; set; }
        public int VBN { get; set; }
    }
    
    [MessageContract]
    public class ResponseClass
    {
        [MessageBodyMember]
        public CompoundData Payload { get; set; }
    }
    

    In this case, the CompoundData should be the return value from your service call – containing both elements you need.

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

Sidebar

Related Questions

I have defined the following interface in F# [<ServiceContract>] type ICarRentalService = [<OperationContract>] abstract
I have the following interface defined to expose a .NET class to COM: [InterfaceType(ComInterfaceType.InterfaceIsDual)]
I have defined the following interface: public interface IHaveAProblem { string Issue { get;
I have the following interfaces defined in a base library project: public interface IWorkContext
I have the following base abstract class defined as: public abstract class BaseObject<T> :
I have a SysMsgManager class defined in CoreService project as following: public class SysMsgManager
I have the following interfaces defined: public interface IAudit { DateTime DateCreated { get;
I have a class which implements the following interface: IUser { string UserName {
I have defined following control template for my custom control. <ControlTemplate TargetType={x:Type local:CustomControl}> <Grid
I have defined the following class using COM to use the IGroupPolicyObject using C#.NET:

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.