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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:06:52+00:00 2026-05-15T21:06:52+00:00

I have a web service that returns a simple object: [System.CodeDom.Compiler.GeneratedCodeAttribute(System.Xml, 2.0.50727.4927)] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()]

  • 0

I have a web service that returns a simple object:

[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.4927")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.SoapTypeAttribute(Namespace="urn:CHAMADO")]
public partial class STRUCCHAMADOOUT : object, System.ComponentModel.INotifyPropertyChanged {

    private string cODField;

    private string mSGField;

    /// <remarks/>
    public string COD {
        get {
            return this.cODField;
        }
        set {
            this.cODField = value;
            this.RaisePropertyChanged("COD");
        }
    }

    /// <remarks/>
    public string MSG {
        get {
            return this.mSGField;
        }
        set {
            this.mSGField = value;
            this.RaisePropertyChanged("MSG");
        }
    }

    public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

    protected void RaisePropertyChanged(string propertyName) {
        System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
        if ((propertyChanged != null)) {
            propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
        }
    }
}

this class was generated by wsdl.exe, based on a wsdl file provided by the client. This is the web method:

[WebMethod(MessageName="CHAMADORequest")]
[SoapRpcMethod(
 Action = "urn:CHAMADO#CHAMADO",
 RequestNamespace = "urn:CHAMADO",
 RequestElementName = "CHAMADO",
 ResponseNamespace = "",
 ResponseElementName = "return",
 Use = SoapBindingUse.Literal
)]
[return: XmlElement("return")]
public STRUCCHAMADOOUT CHAMADO(STRUCCHAMADOIN ENTRADA)
{
    STRUCCHAMADOOUT result = new STRUCCHAMADOOUT();
    try {
        string str = Util.GetRequestXML();
        persist(getResult<Entidades.Chamado>(str, "ENTRADA", string.Empty));

        result.COD = "1";
        result.MSG = "Operação realizada com sucesso";
    } catch (Exception ex) {
        result.COD = "0";
        result.MSG = ex.Message + Environment.NewLine + ex.StackTrace;
    }

    return result;
}

The client is saying that his system is raising an error because the service response has namespaces declaration, just like this:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> 
<CHAMADOResponse xmlns="urn:CHAMADO" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <return xmlns="">
        <COD xmlns="urn:CHAMADO">1</COD> 
        <MSG xmlns="urn:CHAMADO">Operação realizada com sucesso</MSG> 
    </return>
</CHAMADOResponse>

Now, I managed to remove the namespaces from COD and MSG by applying the attriute WebServiceBinding(ConformsTo = WsiProfiles.None) to the service’s class and setting ResponseNamespace to an empty string. But CHAMADOResponse still have the namespaces declaration.
I’m pretty sure that it should not be done like that. In fact, I don’t believe that the namespaces are the problem at all. This project has been hard since the begining, as we had to create services that matched legacy wsdl.

My question is: is there a way that I could remove all that namespaces declaration from the web service response?

Edit

I’ve logged the server’s response and got this:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
        <CHAMADOResponse>
            <return>
                <COD>1</COD>
                <MSG>Operação realizada com sucesso</MSG>
            </return>
        </CHAMADOResponse>
    </soap:Body>
</soap:Envelope>

There’s no namespace declaration in the message’s body. But the client says that he received this:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!-- Request Message Mapping --> 
<CHAMADOResponse xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>
    <return>
        <COD>1</COD>
        <MSG>Operação realizada com sucesso</MSG>
    </return>
</CHAMADOResponse>

Am I missing something here?

  • 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-15T21:06:52+00:00Added an answer on May 15, 2026 at 9:06 pm

    Fernando,

    I have run into a similar situtation with one our legacy systems (UniVerse) in which it does not have a true XML parser but a homegrown system that works via raw string matching. The solution we found to work is to implement IXmlSerializable in the classes that will be transmitted to the system and when writing out to the XmlWriter we can control what namespaces get added. An example of one of these implementations is below.

    /// <summary>
    /// Serialize the state to XML
    /// </summary>
    /// <param name="writer">The writer to write the state</param>
    public void WriteXml(XmlWriter writer)
    {
        writer.WriteElementString("TERMINATION_STATUS", Status);
        writer.WriteElementString("TRANS_SEQ_NUM", Sequence.ToString());
        writer.WriteElementString("INTRN_SEQ_NUM", Id.ToString());
        writer.WriteElementString("CMRCL_FLAG", IsCommercialCard.ToString());
        writer.WriteElementString("AUTH_CODE", Authorization);
        writer.WriteElementString("CMRCL_TYPE", CommericalFlag.ToString());
        writer.WriteElementString("RESULT_CODE", ResultCode.ToString());
        writer.WriteElementString("TROUTD", RoutingId.ToString());
        writer.WriteElementString("RESPONSE_TEXT", Message);
        writer.WriteElementString("REFERENCE", ProcessorReferenceCode);
        writer.WriteElementString("PAYMENT_MEDIA", PaymentMedia);
        writer.WriteElementString("RESULT", Result.ToString().ToUpper());
        if (Error != null)
        {
            writer.WriteStartElement("ERROR");
            writer.WriteElementString("ERROR_CODE", Error.Code);
            writer.WriteElementString("ERROR_DESCRIPTION", Error.Description);
            writer.WriteEndElement();
        }
    }
    

    Again since it is a custom situtation it my not help but it is easy enough to try.

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

Sidebar

Related Questions

I have a very simple web service that returns a string (hardcoded at that).
I have a web service that returns the binary array of an object. Is
I have a basic web service that returns the following object as JSON: public
I have a web service that returns a super simple list of objects MyObject[]
I have a WCF web service method that returns a List<> object and also
I have a web service, that simply returns a lot of data over a
I have a web service that returns this string via the jQuery $.ajax() call
I'm dealing with times formats in Restkit, I have a web service that returns
I have a Web Service call that returns reporting data using Linq-To-Entity (strongly type
I have a WSE web service that returns a list of items in a

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.