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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:37:17+00:00 2026-06-10T06:37:17+00:00

We have noted that WCF DataContractSerializer isn’t very efficient when it comes to serializing

  • 0

We have noted that WCF DataContractSerializer isn’t very efficient when it comes to serializing null values during an SOAP call. For audit purposes, we also record the exact message as sent to disk, so this wastes storage. A typical message with more than one nil element is sent like so:

<MyMessage xmlns="myXmlns">
    <field0>1234567</field0>
    <field1 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
    <field2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
    <field3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
    // etc
</MyMessage>

What would be an immeasurable improvement for bandwidth and disk considerations would be to generate a SOAP body such as:

<MyMessage xmlns="myXmlns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <field0>1234567</field0>
    <field1 xsi:nil="true" />
    <field2 xsi:nil="true" />
    <field3 xsi:nil="true" />
    //etc 
</MyMessage>

So my question is, how can I change my WCF client to consolidate the XSI namespace on the root element, to prevent it from being repeated on each nil element?

  • 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-06-10T06:37:19+00:00Added an answer on June 10, 2026 at 6:37 am

    You can’t tweak the serializer, however if you implement a message inspector you can manipulate to your hearts content.

    If you want to drop the nulls altogether though, and never see if it’s not present you could decorate it

    [DataMember(EmitDefaultValue=false)]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a .NET application running on WCF. In that application, I have a
I have a WCF Service running SOAP and allowing Flex / Flash to connect
I have a solution (WCF service) that has many Entity Framework modules in it.
I have a WCF chat service that accepts duplex tcp connections. A single duplex
I have the following snippet of code in my WCF web service that builds
I have a WCF service that is hosted in IIS6. The important part of
Hi! I have a WCF Service that runs over TCP with Certificate security like
I have a WCF service running on the sharepoint server that will generate a
I have a WCF service that can return several different collections. Objects in each
(Please note that I have seen a similar question on StackOverflow recently, however I

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.