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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:20:06+00:00 2026-05-20T08:20:06+00:00

We’ve built a webservice with Spring-WS, and are trying to access it from a

  • 0

We’ve built a webservice with Spring-WS, and are trying to access it from a C# .NET client. the service works OK with all the tests we’ve done from SoapUI and other java clients, but gets stuck in .NET.

It seems this is a problem with namespaces.

For example, this request works, when the namespace is declared only in the envelope tag, and no element has namespace or prefix in it:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"     xmlns="http://mycompany.org/schemas">
<soapenv:Header/>
<soapenv:Body>
  <authenticationRequest>
    <username>user</username>
    <password>password</password>
</authenticationRequest>
</soapenv:Body>
</soapenv:Envelope>

However, this seemingly equivalent request does NOT work:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://mycompany.org/schemas">
<soapenv:Header/>
<soapenv:Body>
  <authenticationRequest xmlns="http://mycompany.org/schemas">
    <username>user</username>
    <password>password</password>
</authenticationRequest>
</soapenv:Body>
</soapenv:Envelope>

Notice that in this case, the namespace is declared again in authenticationRequest element.
The error given is that the request does not validate against the XML schema, complaining that the ‘username’ element is not defined.

Unfortunately, when adding a service reference (and also a web reference) in .NET, the code generated by wsdl.exe always creates the request in the second case.

Could someone, please, explain why these two pieces of XML are not equivalent, and how we could, in the C# client…
– remove the second namespace declaration?
– or add a namespace prefix to every element in the request?
– or add a namespace declaration without prefix to each element?

We’ve been trying for hours 🙁

Thanks!

  • 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-20T08:20:07+00:00Added an answer on May 20, 2026 at 8:20 am

    I’ve had similar problems with accessing a Java WS from .NET client. I havent found an elegant solution to the problem, but I did solve it by changing the outgoing/incoming SOAP messages with a SoapExtension:

    1. Implement a SoapExtensionAttribute, like this:

      class SoapExtAttribute : SoapExtensionAttribute
      {
          int priority = 0;
      
          public override Type ExtensionType
          {
              get { return typeof(SoapExt); }
          }
      
          public override int Priority
          {
              get
              {
                  return priority;
              }
              set
              {
                  priority = value;
              }
          }
      }
      
    2. Implement a SoapExtension, like this:

      class SoapExt : SoapExtension
      {
          private Stream mWireStream = null;
          private Stream mApplicationStream = null;
      
          public override object GetInitializer(Type serviceType)
          {
              return serviceType;
          }
      
          public override object GetInitializer(LogicalMethodInfo methodInfo, SoapExtensionAttribute attribute)
          {
              return (SoapExtAttribute)attr;
          }
      
          public override void Initialize(object initializer)
          {
          }
      
          public override Stream ChainStream(Stream stream)
          {
              mWireStream = stream;
              mApplicationStream = new MemoryStream();
              return mApplicationStream;
          }
      
      
          public override void ProcessMessage(SoapMessage message)
          {
              StreamWriter writer = null;
              bool fIsServer = (message.GetType() == typeof(SoapServerMessage));
              switch (message.Stage)
              {
                  case SoapMessageStage.BeforeDeserialize:
                      string resp = new StreamReader(mWireStream).ReadToEnd();
                      StreamWriter w = new StreamWriter(mApplicationStream);
                      w.WriteLine(resp);
                      w.Flush();
                      mApplicationStream.Seek(0, SeekOrigin.Begin);
                      break;
                  case SoapMessageStage.AfterSerialize:
                      mApplicationStream.Seek(0, SeekOrigin.Begin);
                      string reqXml = new StreamReader(mApplicationStream).ReadToEnd();
      
                      XmlDocument doc = new XmlDocument();
                      doc.LoadXml(reqXml);
      
                      Modify(doc);
      
                      reqXml = doc.InnerXml;
      
                      mApplicationStream.Seek(0, SeekOrigin.Begin);
                      writer = new StreamWriter(mWireStream);
                      writer.WriteLine(reqXml);
                      writer.Flush();
      
                      XmlDocument d = new XmlDocument();
                      d.LoadXml(reqXml);
                      ServiceManager.RequestSoap = d.LastChild.OuterXml;
                      break;
              }
          }
      
          private void Modify(XmlDocument doc)
          {
              // Change the doc in whatever way you want, e.g. remove/add the prefixes
          }
      }
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
I've got a string that has curly quotes in it. I'd like to replace
Seemingly simple, but I cannot find anything relevant on the web. What is the
this is what i have right now Drawing an RSS feed into the php,
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

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.