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 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

Related Questions

Let's say that I have a method with the signature: public static bool ValidDateToSend(DateTime
Let's say I have a structure named vertex with a method that adds two
Let's say I have a drive such as C:\ , and I want to
Let's say i have two tables in db: Car and Part. Car owns arbitrialy
Let’s say I have a number like 0x448 . In binary this is 0100
Let's say I have a 12-bit Analog to Digital Converter (4096 bins). And let's
Let's say I have two tables orgs and states orgs is (o_ID, state_abbr) and
Let's say on a page I have alot of this repeated: <div class=entry> <h4>Magic:</h4>
Let's say I can call a method like this: core::get() . What is the
Let's say I have window.open (without name parameter), scattered in my project and 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.