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

  • Home
  • SEARCH
  • 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 6925895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:50:54+00:00 2026-05-27T10:50:54+00:00

Say I have a Person object that has a first name, a last name

  • 0

Say I have a Person object that has a first name, a last name and an age. I want to send this person object to a web service that only knows and cares about a person object with a first and last name. But I want the xml that represents the full person object including the age to be sent back.

I already have a mechanism for storing the xml in the object behind the scenes and can simply serve that xml up to WCF, but I don’t want to use the normal XmlSerializer. I want to be able to say “here is the xml. wrap it in soap and send it”.

I plan on using WCF. Where would I hook into this process to control the serialization?

More Details

While the example in this question is contrived. It clearly illustrates my problem. Lets say I have an application with a class like so:

/* person A */
class Person {
  public string FirstName { get; set; }
  public string LastName { get; set; }
  public int Age { get; set; }
}

I am passing this to a web service. The web service knows about a different Person class written as:

/* person B */
class Person {
  public string FirstName { get; set; }
  public string LastName { get; set; }
}

The service has a method with the following method signature:

Person SomeOperation(Person p);

When I call this web service from my application and pass it my person A version, the web service receives it just fine. It ignores the Age property. But when it recreates the response the Age property disappears.

I understand why this is happening. WCF is deserializing the response into an actual c# object so the extra XML that was sent with the request is discarded. Because of this, there is no Age property to send back.

I have a mechanism to actually use the XML as the backing store for my objects. If there is XML in the backing store that the object does not need, it just sits there and is not used. I want the full XML used as the backing store to be sent back in the response.

If this were a basic c# application I could simply create an IBasicPerson interface that contains the FirstName and LastName property and have a Person class implement the interface like the below code:

public interface IBasicPerson {
  string FirstName { get; set; }
  string LastName { get; set; }
}

public class Person : IBasicPerson {
  public string FirstName { get; set; }
  public string LastName { get; set; }
  public int Age { get; set; }
}

then I could create an operation in some other class that takes and returns the IBasicPerson interface:

public SomeClass {
  public IBasicPerson SomeOperation(IBasicPerson p) {
    /* do stuff */
    return p;
  }
}

When i call this, it doesn’t care about the Age property and the information does not get lost. This is because both the IBasicPerson in SomeOperation and the actual Person instance passed in refer to the exact same object. However, this is not the case when making WCF calls across the wire.

From the application calling the WCF services point of view the object in the return value of the method is not the same object that was passed in.

My XML backing store solves this problem, but only if I can figure out how to keep it from getting lost. This is why I’m trying to figure out where I should hook into the WCF serialization process.

  • 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-27T10:50:55+00:00Added an answer on May 27, 2026 at 10:50 am

    Check out the IExtensibleDataObject interface – that might just be what you need!

    It allows the WCF service to “stash away” any extra info that comes in, and pass it back to the caller when responding to the service call, without knowing what exactly it is that it’s storing. It is often used for versioning your services – so if a new version of the service requires additional parameters, those can be passed to the older service, too, and will be temporarily stored in the ExtensionDataObject of your service implementation.

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

Sidebar

Related Questions

Say I have a model object 'Person' defined, which has a field called 'Name'.
Let's say I have a WCF service which has a method returning object Person.
I have a basic domain object, say like Person or Campaign or Event that
This is a winform C# problem. I have an data object, say, Person. It
If I have a form-backing object that has a complicated object tree -- say
Let's say you have a Person object and it has a method on it,
Say I have this table: Person table -------------- PersonId Address table ------------ AddressId PersonAddressId
Say I have my class @interface Person : NSObject { NSString *name; } I
Say I have a class which represents a person, a variable within that class
I have a fairly large CRUD WinForm app that has numerous objects. Person, Enrollment,

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.