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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T00:41:38+00:00 2026-05-12T00:41:38+00:00

Let’s say I have a WCF contract such as [ServiceContract] public interface IContract {

  • 0

Let’s say I have a WCF contract such as

[ServiceContract]
public interface IContract
{
    [OperationContract]
    [WebInvoke(Method="POST", RequestFormat=WebMessageFormat.Xml, BodyStyle=WebMessageBodyStyle.Wrapped)]
    string ComplexPost(string name, ComplexType data);
}

And a data contract:

[DataContract(Name="ComplexType", Namespace="")] // don't know if those atts are req'd or not but saw them in another example
public class ComplexType
{
    public string StringData { get; set; }
    public int IntData { get; set; }
    public DateTime DateValue { get; set; }
}

I know that the request has to be wrapped in order to have more than one input parameter, obviously you cannot have an XML document with more than one root.

The problem is, the documentation is really sparse about what you have to wrap it WITH.

The goal is not to consume this with WCF, it needs to be accessible to clients as a generic XML web service. They may not have any knowledge of WCF or even use .NET.

Obviously I can tell from the exceptions I’ve been receiving that it is expecting an Element with name ComplexPost (the same as the method name) with namespace http://tempuri.org/ because I haven’t specified anything else yet, so I know I need this:

<ComplexPost xmlns="http://tempuri.org/">

...what exactly?

</ComplexPost>

The goal is not specifically to adhere to REST principles. I’m not looking for answers that embed some of the parameters in the UriTemplate leaving only one complex object, making Bare work. I’m looking for a generalized solution to including all of the data within the POST body.

Found with Fiddler

Here is approximately what the result would be, based on what I found using Fiddler.

<ComplexPost xmlns="http://tempuri.org/">
    <name>Value of name parameter</name>
    <data xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
        <StringData>The StringData property value</StringData>
        <IntData>10</IntData>
        <DateValue>2009-07-07T15:38:39.7738012-05:00</DateValue>
    </data>
<ComplexPost>

So the wrapper element is the method name, with the XML namespace that’s specified on your ServiceContract, or the temppuri.org if not.

Each parameter becomes, in order, a child element, with base types serialized very easily into string representations.

I did my tests with nullable values, including a nullable DateTime. Apparently the declaration that xmlns:i=”http://www.w3.org/2001/XMLSchema-instance&#8221; must occur before it’s needed, and then for a null value, it’s a closed element with i:nil=”true”, for example

<NullableDateProperty i:nil="true" />

It was also very easy for a DataContract object to have child complex types, or even a list of complex objects.

....
<ChildObjectPropertyName>
    <PropertyOfChildObject>value</PropertyOfChildObject>
    ...
</ChildObjectPropertyName>
<ListProperty>
    <ObjectType>
        <ObjectProperty>value</ObjectProperty>
        ....
    </ObjectType>
    ...
</ListProperty>

This may not be complete, but the lesson is definitely get a WCF client working and then examine the exchanges with Fiddler. Thank you Cheeso!

  • 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-12T00:41:39+00:00Added an answer on May 12, 2026 at 12:41 am

    If I were doing this, publishing a WCF-based REST/POX service, and I Wanted to make it consumable by “anyone and anything” I would use a debugging HTTP Proxy, like Fiddler2, and capture a successful request going from a WCF REST client to the WCF REST Server.

    That can be the basis for the beginning of documentation and examples, as well as a set of scripted tests.

    There’s also a way to turn on message tracing in WCF itself, but I don’t know it. I always use Fiddler. In fact I have it open right now.

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

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Since the Master page is not actually inherited, but rather… May 12, 2026 at 8:46 am
  • Editorial Team
    Editorial Team added an answer Can you explain a little? I think you want to… May 12, 2026 at 8:46 am
  • Editorial Team
    Editorial Team added an answer What about something of the ilk? Math.Truncate(date.DayOfYear/7) +1 Giving you:… May 12, 2026 at 8:46 am

Related Questions

Let's say you create a wizard in an HTML form. One button goes back,
Let's say I'm building a data access layer for an application. Typically I have
Let's say you have a class called Customer, which contains the following fields: UserName
Let me try to explain what I need. I have a server that is
Let's say we have a simple function defined in a pseudo language. List<Numbers> SortNumbers(List<Numbers>

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.