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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:06:53+00:00 2026-05-11T05:06:53+00:00

Given an operation contract such as: [OperationContract] void Operation(string param1, string param2, int param3);

  • 0

Given an operation contract such as:

[OperationContract] void Operation(string param1, string param2, int param3); 

This could be redesigned to:

[MessageContract] public class OperationRequest {     [MessageBodyMember]     public string Param1 { get; set; }      [MessageBodyMember]     public string Param2 { get; set; }      [MessageBodyMember]     public int Param3 { get; set; } }  [MessageContract] public class OperationResponse { }  [OperationContract] OperationResponse Operation(OperationRequest request); 

One thing I like about the MessageContract is that I get a little more explicit control over the format of the SOAP message.

Similarly, I could write nearly the same code, but use a DataContract:

[DataContract] public class OperationRequest {     [DataMember]     public string Param1 { get; set; }      [DataMember]     public string Param2 { get; set; }      [DataMember]     public int Param3 { get; set; } }  [DataContract] public class OperationResponse { }  [OperationContract] OperationResponse Operation(OperationRequest request); 

One thing I like about the DataContract is that I can define IsRequired, Order, and Name.

Today I expect the only consumer will be a WCF client. However, I want to design contract first and adhere to SOA practices as much as possible. Rather than have WCF dictate my SOAP, WSDL, and XSD, I want the XML to define the WCF layer, but use WCF to generate this so as not to add any custom message processing to WCF. I want to follow the most common SOA XML conventions which I believe is probably all tags beginning in lowercase – am I right? And I want to be as version tolerant as possible.

Is it wise to always create Request and Response messages like this? Which of the three formats promotes the best SOA practices? Should I go one step further and define both a DataContract and a MessageContract whereby the MessageContract only contains the DataContract? Or should I only ever use DataContracts if I am truly exposing a new type (i.e. do not create message types as containers)?

A loaded set of questions I know, but I am trying to get to the heart of it, and I am not sure separating the questions provides sufficient context to get the answer I am looking for.

  • 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. 2026-05-11T05:06:53+00:00Added an answer on May 11, 2026 at 5:06 am

    XML usually tends to be camelCased. WSDL and XML Schema use camelCasing for both elements and attributes, for example check out the syntax and schema.

    Why SOAP was defined differently, I do not know, but it uses PascalCasing for elements and camelCasing for attributes, check here.

    Similary, most of the WS* specs (maybe all) use PascalCasing for elements and attributes, see here. XML Schema is agnostic about the conventions of the types it defines for XML.

    Thomas Erl writes many important books on SOA including ‘Service-Oriented Architecture’. In Chapters 13 and 15 he provides a number of examples of the XML of the various parts of typical transactions. It defines types and object members in XML Schema using PascalCasing which nicely matches the normal patterns of C# for class and property naming. Thus WCF defaults already closely match the standards.

    Regarding actual message naming, some conventions use camelCasing and others use PascalCasing, so my preference is to match the primary language needs, which in the WCF case is PascalCasing. And WCF defaults match some examples of how the request and response message should be written, some examples here.

    So the only outstanding question is now the basic question of how much to standardize around the use of OperationContract, DataContract, and/or MessageContract.

    Defining DataContract only when a you have a complex type (in XSD parlance) makes sense, and I tend to think YAGNI (You Ain’t Gonna Need It) as pointed out by Terry is the correct choice, but Erl seems to suggest a much more process intensive version so I am still not sure the best approach to use as my default choice (the main part of the question).

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

Sidebar

Ask A Question

Stats

  • Questions 207k
  • Answers 207k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Instances don't have names. By the time the global name… May 12, 2026 at 9:21 pm
  • Editorial Team
    Editorial Team added an answer Check out FileVersionInfo class might be helpful for you. var… May 12, 2026 at 9:21 pm
  • Editorial Team
    Editorial Team added an answer I would guess the problem is due to you declaring… May 12, 2026 at 9:21 pm

Related Questions

I would like to force svcutil to generate all data contracts in an assembly
I have a C# WCF REST Service which allows the addition of a bookmark,
I’m working on trying to port an ASP.NET app from Server 2003 (and IIS6)
How can I define a [OperationContract] [WebGet] method to return XML that is stored

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.