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

The Archive Base Latest Questions

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

I am using a data contract in WCF, but there is some unwanted response

  • 0

I am using a data contract in WCF, but there is some unwanted response tags being sent in the xml file, I am not sure how to modify the data contract class so that I can avoid sending that unwanted response field. In the below XML file, all the text which is bolded and italics is unwanted. Thanks.

  <GetCertMailReceiptNumbersResponse xmlns="http://tempuri.org/">
      <GetCertMailReceiptNumbersResult xmlns:a="http://schemas.datacontract.org/2004/07/WcfSmartConnect" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
        ***<a:AccountNumber i:nil="true" />
        <a:Address1 i:nil="true" />
        <a:Address2 i:nil="true" />
        <a:City i:nil="true" />
        <a:Name1 i:nil="true" />
        <a:Name2 i:nil="true" />
        <a:OrderNumber>1325661</a:OrderNumber>
        <a:Password i:nil="true" />***
        <a:ReturnCode>200</a:ReturnCode>
        <a:ReturnMessage />
        ***<a:SoftwareID i:nil="true" />
        <a:State i:nil="true" />
        <a:TrackingStatus i:nil="true" />
        <a:USPSReceipt i:nil="true" />
        <a:UserID i:nil="true" />
        <a:Zip i:nil="true" />***
        <a:lsCMRN>
          <a:CertMailReceiptNumbers>
            <a:AccountNumber>1</a:AccountNumber>
            <a:Address1>201 Test Ln</a:Address1>
            <a:Address2>TSTCity TST  123456</a:Address2>
            <a:City>TSTCity</a:City>
            <a:Name1>pinu</a:Name1>
            <a:Name2 i:nil="true" />
            <a:OrderNumber />
            ***<a:Password />
            <a:ReturnCode>0</a:ReturnCode>
            <a:ReturnMessage i:nil="true" />
            <a:SoftwareID />***
            <a:State> TST </a:State>
            <a:TrackingStatus>MAILED</a:TrackingStatus>
            <a:USPSReceipt>71926389001019</a:USPSReceipt>
            ***<a:UserID />***
            <a:Zip>123456</a:Zip>
            <a:lsCMRN />
            <a:order>1325661</a:order>
          </a:CertMailReceiptNumbers>
          <a:CertMailReceiptNumbers>
            <a:AccountNumber>10</a:AccountNumber>
            <a:Address1>121 Mant Drive</a:Address1>
            <a:Address2>TestCity  Test  123456</a:Address2>
            <a:City> TestCity </a:City>
            <a:Name1>Kris </a:Name1>
            <a:Name2 i:nil="true" />
            <a:OrderNumber />
            ***<a:Password />
            <a:ReturnCode>0</a:ReturnCode>
            <a:ReturnMessage i:nil="true" />
            <a:SoftwareID />***
            <a:State>Test</a:State>
            <a:TrackingStatus>MAILED</a:TrackingStatus>
            <a:USPSReceipt>71926389000026</a:USPSReceipt>
            ***<a:UserID />***
            <a:Zip>123456</</a:Zip>
            <a:lsCMRN />
            <a:order>1325661</a:order>
          </a:CertMailReceiptNumbers>
          <a:CertMailReceiptNumbers>
            <a:AccountNumber>2</a:AccountNumber>
            <a:Address1>121 Technot</a:Address1>
            <a:Address2>Test  Tst  123456</a:Address2>
            <a:City>Test</a:City>
            <a:Name1>Alice</a:Name1>
            <a:Name2 i:nil="true" />
            <a:OrderNumber />
            ***<a:Password />
            <a:ReturnCode>0</a:ReturnCode>
            <a:ReturnMessage i:nil="true" />
            <a:SoftwareID />***
            <a:State>Tst</a:State>
            <a:TrackingStatus>MAILED</a:TrackingStatus>
            <a:USPSReceipt>7192638900000033</a:USPSReceipt>
            ***<a:UserID />***
            <a:Zip>123456</</a:Zip>
            <a:lsCMRN />
            <a:order>1325661</a:order>
          </a:CertMailReceiptNumbers>
          <a:CertMailReceiptNumbers>
            <a:AccountNumber>3</a:AccountNumber>
            <a:Address1>194 Green st</a:Address1>
            <a:Address2>Matt  MA  123456</a:Address2>
            <a:City>Matt</a:City>
            <a:Name1>Jewel Bondurant</a:Name1>
            <a:Name2 i:nil="true" />
            <a:OrderNumber />
            ***<a:Password />
            <a:ReturnCode>0</a:ReturnCode>
            <a:ReturnMessage i:nil="true" />
            <a:SoftwareID />***
            <a:State>MA</a:State>
            <a:TrackingStatus>MAILED</a:TrackingStatus>
            <a:USPSReceipt>71926389001000000040</a:USPSReceipt>
            ***<a:UserID />***
            <a:Zip>123456</</a:Zip>
            <a:lsCMRN />
            <a:order>1325661</a:order>
          </a:CertMailReceiptNumbers>
          <a:CertMailReceiptNumbers>
            <a:AccountNumber>4</a:AccountNumber>
            <a:Address1>123  Nasas</a:Address1>
            <a:Address2>Mtar  Tst  123456</a:Address2>
            <a:City>Mtar</a:City>
            <a:Name1>Terry </a:Name1>
            <a:Name2 i:nil="true" />
            ***<a:OrderNumber />
            <a:Password />
            <a:ReturnCode>0</a:ReturnCode>
            <a:ReturnMessage i:nil="true" />
            <a:SoftwareID />***
            <a:State>Tst</a:State>
            <a:TrackingStatus>MAILED</a:TrackingStatus>
           a:USPSReceipt>7192630000057</a:USPSReceipt>
            ***<a:UserID />***
            <a:Zip>123456</</a:Zip>
            <a:lsCMRN />
            <a:order>1325661</a:order>
          </a:CertMailReceiptNumbers>
        </a:lsCMRN>
        <a:order>0</a:order>
      </GetCertMailReceiptNumbersResult>
    </GetCertMailReceiptNumbersResponse>
  • 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:38:26+00:00Added an answer on May 13, 2026 at 10:38 pm

    Show us your classes that are being sent back as response from your WCF service! Without them, it’s at best a guessing game….

    You can put certain DataContract-related attributes on properties to include or exclude them from the serialization process in WCF.

    Basically, with WCF in .NET 3.5 SP1, you don’t have to specifically label your classes and their properties with special attributes anymore. If you don’t, the DataContract serializer will act like the XML serializer : all public properties are being serialized.

    If you don’t want to include certain properties in the serialization, you don’t really have a choice but to

    • put the [DataContract] attribute on your classes, and
    • put the [DataMember] attribute on your fields and properties that you do want to be serialized

    Anything you do not adorn with a [DataMember] attribute will then be skipped and not included in the WCF response message.

    So in your case, you would have to do something like

    [DataContract]
    class GetCertMailReceiptNumbersResult
    {
        // no DataMember attribute --> will not be included!
        int AccountNumber {get;set;}
        string Address1 {get;set;}
       ......
        string Password {get;set;}
    
        // here, include DataMember attributes --> will be included
        [DataMember]
        int ReturnCode {get;set;}
        [DataMember]
        string ReturnMessage {get;set;}
    
        // and so forth
     }
    

    Basically, for each type in your WCF service, you need to make a decision which fields and properties to include – mark those with the [DataMember] attribute. Anything else will not be included in your serialized message.

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

Sidebar

Related Questions

I am using a Generic Class as a Response Data Contract. All is good
I have a Silverlight Project which passes data using the Data Contract to a
I'm using System.Data.Linq.DataContext file for accessing a mdf Database I want to use the
I'm using System.Data.OracleClient.OracleCommand to create a table and fill it out with some data.
I am programmatically exporting data (using PHP 5.2) into a .csv test file. Example
I have a very simple WPF application in which I am using data binding
I am using temp data as follow in my controllers - very simple, when
I'm using the data mapper pattern in a PHP app I'm developing and have
Generally I connect and retrieve data using the standard way (error checking removed for
Is SSL secure enough for using sensitive data (like password) in query string? Is

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.