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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:07:35+00:00 2026-06-08T03:07:35+00:00

I have a class file generated from an XML Schema document supplied from a

  • 0

I have a class file generated from an XML Schema document supplied from a third party by our customer. I should be able to use this generated class to the customer’s SOAP web service, but I’m having some problems.

I’ve created a ServiceContract interface so I can use the WCF ChannelFactory to connect to the web service, like follows:

[ServiceContract(Namespace = "http://theircompany.co.uk/theirapp/v1")]
[XmlSerializerFormat]
public interface IWebService
{
    [OperationContract]
    EPSStatus serviceNotifyDataEventSet(
        [XmlElement(Namespace = "http://www.thirdparty.org/thirdapp")] DataEventSet dataSet
    );
}

Both EPSStatus and DataEventSet are in my generated class file. The important bits of DataEventSet:

[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.thirdparty.org/thirdapp")]
[System.Xml.Serialization.XmlRootAttribute(Namespace="http://www.thirdparty.org/thirdapp", IsNullable=false)]
public partial class DataEventSet {
    //...
}

When I now try to call IWebService.serviceNotifyDataEventSet I get the following SOAP body (found with WCF Trace enabled on their server):

<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <serviceNotifyDataEventSet xmlns="http://theircompany.co.uk/theirapp/v1">
        <dataSet>
            <dataEvents xsi:type="q1:DAInt" xmlns="" xmlns:q1="http://www.thirdparty.org/thirdapp">
                <id>47245361157</id>
                <time>
                    <tick_time>141728877218</tick_time>
                    <time>2012-06-28T10:07:57.218+01:00</time>
                    <time_type>OSACBM_TIME_MIMOSA</time_type>
                </time>
                <value>42</value>
            </dataEvents>
            <id xmlns="">0</id>
            <site xmlns="">
                <category>SITE_SPECIFIC</category>
            </site>
            <time xmlns="">
                <tick_time>141728877218</tick_time>
                <time>2012-06-28T10:07:57.218+01:00</time>
                <time_type>OSACBM_TIME_MIMOSA</time_type>
            </time>
        </dataSet>
    </serviceNotifyDataEventSet>
</s:Body>

So, I’m able to call the web service and it appears as though my data is serialising properly, however on the server side dataSet is coming up null. I’ve also got a trace from a client that does work with the following body:

<soap:Body>
    <serviceNotifyDataEventSet xmlns="http://theircompany.co.uk/theirapp/v1">
        <dataSet xmlns="http://www.thirdparty.org/thirdapp">
            <dataEvents xmlns:q1="http://www.thirdparty.org/thirdapp" xsi:type="q1:DAReal" xmlns="">
                <id>47245361408</id>
                <time>
                    <tick_time>141730618844</tick_time>
                    <time>2012-06-28T10:36:58.843+01:00</time>
                    <time_type>OSACBM_TIME_MIMOSA</time_type>
                </time>
                <value>12.34</value>
            </dataEvents>
            <id xmlns="">0</id>
            <site xmlns="">
                <category>SITE_SPECIFIC</category>
            </site>
            <time xmlns="">
                <tick_time>141730618843</tick_time>
                <time>2012-06-28T10:36:58.843+01:00</time>
                <time_type>OSACBM_TIME_MIMOSA</time_type>
            </time>
        </dataSet>
    </serviceNotifyDataEventSet>
</soap:Body>

The only difference I can see is that the root namespace is set on the dataSet on the working packet: <dataSet xmlns="http://www.thirdparty.org/thirdapp">. On my packet, the namespace is not specified at all.

My question is, does my analysis sound reasonable and if so, is there any way I can get the root xmlns to output properly on my dataSet?

  • 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-08T03:07:36+00:00Added an answer on June 8, 2026 at 3:07 am

    I’ve now managed to get this to work using a relatively straightforward approach. Fortunately, the code generated from the XML Schemas by xsd marks all the classes as partial with no constructors. I’ve added my own partial class to define a default constructor that overrides the namespaces, as follows:

    public partial class DataEventSet 
    {
        [XmlNamespaceDeclarations]
        public XmlSerializerNamespaces _xmlns;
    
        /// <summary>
        /// Constructor for DataEventSet that sets up default namespaces
        /// </summary>
        public DataEventSet()
        {
            _xmlns = new XmlSerializerNamespaces();
            _xmlns.Add("", "http://www.thirdparty.org/thirdapp");
            _xmlns.Add("o", "http://www.thirdparty.org/thirdapp");
        }
    }
    

    This now serialises as follows:

    <?xml version="1.0" encoding="utf-8"?>
    <s:Body xmlns:s="http://www.w3.org/2003/05/soap-envelope">
      <serviceNotifyDataEventSet xmlns="http://theircompany.co.uk/theirapp/v1">
        <dataSet xmlns="http://www.thirdparty.org/thirdapp" xmlns:o="http://www.thirdparty.org/thirdapp">
          <dataEvents xsi:type="o:DABool" xmlns="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <id>47245361157</id>
            <value>true</value>
          </dataEvents>
          <id xmlns="">0</id>
          <site xmlns="">
            <category>SITE_SPECIFIC</category>
          </site>
          <time xmlns="">
            <tick_time>396106152171</tick_time>
            <time>2012-07-20T13:29:12.171Z</time>
            <time_type>OSACBM_TIME_MIMOSA</time_type>
          </time>
        </dataSet>
      </serviceNotifyDataEventSet>
    </s:Body>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble deserializing my XML file from a MemoryStream. I have a generated
I have a class that unmarshals xml from a 3rd party source (I have
i have generated a cs-classes with the xsd-tool from some xml scheme. The scheme
OK, I generated C# classes from my huge XSD file. Now I have a
I have a datagridview populated with data from an .xml file. The data is
We have XML generated from an external program that needs to be read into
I have a class A that can be generated from two different ways. a
I have an xml schema (generated automatically using trang) which keeps changing. These changes
I have this class file call SMSHelper.cs First I just wanted to know is
I currently have a class file with the following enumeration: using System; namespace Helper

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.