Note that there are some explanatory texts on larger screens.

plurals
  1. POJava Webservice from a .NET C# client - Namespaces glitch?
    primarykey
    data
    text
    <p>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. </p> <p>It seems this is a problem with namespaces.</p> <p>For example, this request works, when the namespace is declared only in the envelope tag, and no element has namespace or prefix in it:</p> <pre><code>&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://mycompany.org/schemas"&gt; &lt;soapenv:Header/&gt; &lt;soapenv:Body&gt; &lt;authenticationRequest&gt; &lt;username&gt;user&lt;/username&gt; &lt;password&gt;password&lt;/password&gt; &lt;/authenticationRequest&gt; &lt;/soapenv:Body&gt; &lt;/soapenv:Envelope&gt; </code></pre> <p>However, this seemingly equivalent request does NOT work:</p> <pre><code>&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://mycompany.org/schemas"&gt; &lt;soapenv:Header/&gt; &lt;soapenv:Body&gt; &lt;authenticationRequest xmlns="http://mycompany.org/schemas"&gt; &lt;username&gt;user&lt;/username&gt; &lt;password&gt;password&lt;/password&gt; &lt;/authenticationRequest&gt; &lt;/soapenv:Body&gt; &lt;/soapenv:Envelope&gt; </code></pre> <p>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. </p> <p>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.</p> <p>Could someone, please, explain why these two pieces of XML are not equivalent, and how we could, in the C# client...<br> - remove the second namespace declaration?<br> - or add a namespace prefix to every element in the request?<br> - or add a namespace declaration without prefix to each element? </p> <p>We've been trying for hours :(</p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload