title: Why doesn't Add Web Reference use the schema targetNamespace specified in the wsdl
body: <p>I have 2 sets of webservices I need to call from C#. Both these group of webservices  come from the same provider &amp; both share one complexType which exists in both the wsdls.</p>
  
  <p>This is what the complex type defn looks like</p>
  
  <pre><code>&lt;wsdl:types&gt;
      &lt;schema targetNamespace="http://abc.com/ws/myutil" xmlns="http://www.w3.org/2001/XMLSchema"&gt;
          &lt;complexType name="mytype"&gt;
              &lt;sequence&gt;
                  &lt;element name .....
                  &lt;element name ....
                  &lt;element name .....
              &lt;/sequence&gt;
          &lt;/complexType&gt;
      &lt;/schema&gt;
      .....
  &lt;/wsdl:types&gt;
  </code></pre>
  
  <p>The above complex type exists in both the wsdls and the targetNamespace for the type mytype is the same in both the wsdls.</p>
  
  <p>This doesn't cause any issues in <code>java</code>.
  I use <code>Axis</code> for generating the stubs and the <code>class</code> for the type mytype is written in a directory <code>com\abc\ws\myutil</code> And it it's put in a <code>package</code> <code>com.abc.ws.myutil</code> as specified by the targetNamespace attribute in the wsdl.</p>
  
  <p>So if I want to call only webservices from the 1st wsdl, I run axis on the first wsdl &amp; generate the classes and then create the jar.</p>
  
  <p>If I want to call only webservices from the 2nd wsdl, I run axis on the 2nd wsdl &amp; generate the classes and then create the jar.</p>
  
  <p>If I want to call webservices from both the wsdl, I run axis first on the first wsdl &amp; then the 2nd wsdl &amp; then create the jar.</p>
  
  <p>Running Axis on the 2nd wsdl overwrites the mytype.java class file generated in com\abc\ws\myutil. But this doesn't matter because the class file generated for mytype.java from the first wsdl is identical to the one generated from the 2nd wsdl. The combined jar I create contains only one mytype &amp; it can be used with webservices from both the wsdls.</p>
  
  <p>However, this identical scenario gives me problems in C#. I add a webreference for the first wsdl URL, it puts the generated classes in the first namespace &amp; then when I add a webreference for the 2nd wsdl URL, it puts the generated classes in a 2nd namespaces.</p>
  
  <p><em><strong>So I end up with 2 mytype classes in 2 namespaces.</em></strong></p>
  
  <p>So my questions is why doesn't <code>Add Webreference</code> use the <code>targetNamespace</code> specified in the wsdl? Is there a way for me to make it do that, so that I have just one mytype class?</p>
  
  <p>Have the same issue with ASP.NET VB programs also.</p>