BUG: Incorrect proxy is generated when the WSDL file contains multiple bindings (816636)



The information in this article applies to:

  • Microsoft Web Services (included with the .NET Framework 1.1)
  • Microsoft Web Services (included with the .NET Framework) 1.0
  • Microsoft Visual Basic .NET (2003)
  • Microsoft Visual Basic .NET (2002)
  • Microsoft Visual C# .NET (2003)
  • Microsoft Visual C# .NET (2002)

SYMPTOMS

You can generate a proxy class for your Web Service Description Language (WSDL) file that has multiple bindings. All the bindings use SOAP headers. In the SoapHeaderAttribute of the generated proxy class, you may find that only the first binding class has all the required parameters. The remaining classes may not have all the expected parameters in the SoapHeaderAttribute.

WORKAROUND

To work around this problem, you can manually add the parameters to the SoapHeaderAttribute for the classes that are missing parameters. An example is described in the "More Information" section of this article.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

For the example that is described in this section, you must add the Direction parameter and the Required parameter to the SoapHeaderAttribute. To do this, locate the following SoapHeaderAttribute in the proxy file:

Visual Basic .NET
<System.Web.Services.Protocols.SoapHeaderAttribute("Object2IDValue")>
Replace the existing SoapHeaderAttribute with the following SoapHeaderAttribute attribute:
<System.Web.Services.Protocols.SoapHeaderAttribute("Object2IDValue",  _
Direction:=System.Web.Services.Protocols.SoapHeaderDirection.Out, Required:=false)>

Visual C# .NET
[System.Web.Services.Protocols.SoapHeaderAttribute("Object2IDValue")]
Replace the existing SoapHeaderAttribute with the following SoapHeaderAttribute attribute:
[System.Web.Services.Protocols.SoapHeaderAttribute("Object2IDValue", 
Direction=System.Web.Services.Protocols.SoapHeaderDirection.Out, Required=false)]

Steps to Reproduce the Problem

  1. Open a text editor such as Notepad.
  2. Copy and then paste the following code to a new file:
    <?xml version="1.0" encoding="utf-8"?>
    <definitions xmlns:s1="urn:tempuri-org:Object2" 
       xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" 
       xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
       xmlns:s="http://www.w3.org/2001/XMLSchema" 
       xmlns:s0="urn:tempuri-org:Object1" 
       xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
       xmlns:tns="urn:tempuri-org" 
       xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" 
       xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" 
       targetNamespace="urn:tempuri-org" name="Object1" 
       xmlns="http://schemas.xmlsoap.org/wsdl/">
      <types>
        <s:schema elementFormDefault="unqualified" targetNamespace="urn:tempuri-org:Object1">
          <s:complexType name="Object1ID">
            <s:sequence>
              <s:element name="UUID" type="s:string" />
            </s:sequence>
          </s:complexType>
        </s:schema>
        <s:schema elementFormDefault="unqualified" targetNamespace="urn:tempuri-org:Object2">
          <s:complexType name="Object2ID">
            <s:sequence>
              <s:element name="UUID" type="s:string" />
            </s:sequence>
          </s:complexType>
        </s:schema>
      </types>
      <message name="Object1ID">
        <part name="Object1ID" type="s0:Object1ID" />
      </message>
      <message name="Object1Connect">
        <part name="userId" type="s:string" />
        <part name="password" type="s:string" />
        <part name="appServerInfo" type="s:string" />
      </message>
      <message name="Object1ConnectResponse" />
      <message name="Object2ID">
        <part name="Object2ID" type="s1:Object2ID" />
      </message>
      <message name="Object2">
        <part name="input1" type="s:int" />
      </message>
      <message name="Object2Response">
        <part name="result" type="s:string" />
      </message>
      <message name="Object2Release" />
      <message name="Object2ReleaseResponse" />
      <portType name="Object1Obj">
        <operation name="Connect_Object1" parameterOrder="userId password appServerInfo">
          <input message="tns:Object1Connect" />
          <output message="tns:Object1ConnectResponse" />
        </operation>
        <operation name="CreatePO_Object2" parameterOrder="input1">
          <input message="tns:Object2" />
          <output message="tns:Object2Response" />
        </operation>
      </portType>
      <portType name="Object2Obj">
        <operation name="Release_Object2">
          <input message="tns:Object2Release" />
          <output message="tns:Object2ReleaseResponse" />
        </operation>
      </portType>
      <binding name="Object1Obj" type="tns:Object1Obj">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc" />
        <operation name="Connect_Object1">
          <soap:operation soapAction="" style="rpc" />
          <input>
            <soap:body use="encoded" namespace="urn:tempuri-org:Object1" 
                encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
          </input>
          <output>
            <soap:header message="tns:Object1ID" part="Object1ID" use="encoded" 
                encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
                namespace="urn:tempuri-org:Object1" />
            <soap:body use="encoded" namespace="urn:tempuri-org:Object1" 
                encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
          </output>
        </operation>
        <operation name="CreatePO_Object2">
          <soap:operation soapAction="" style="rpc" />
          <input>
            <soap:header d5p1:required="true" message="tns:Object1ID" part="Object1ID" 
                use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
                namespace="urn:tempuri-org:Object1" 
                xmlns:d5p1="http://schemas.xmlsoap.org/wsdl/" />
            <soap:body use="encoded" namespace="urn:tempuri-org:Object1" 
            encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
          </input>
          <output>
            <soap:header message="tns:Object2ID" part="Object2ID" use="encoded" 
                encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
                namespace="urn:tempuri-org:Object1" />
            <soap:body use="encoded" namespace="urn:tempuri-org:Object1" 
                encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
          </output>
        </operation>
      </binding>
      <binding name="Object2Obj" type="tns:Object2Obj">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc" />
        <operation name="Release_Object2">
          <soap:operation soapAction="" style="rpc" />
          <input>
            <soap:header d5p1:required="true" message="tns:Object2ID" part="Object2ID" 
                use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
                namespace="urn:tempuri-org:Object2" 
                xmlns:d5p1="http://schemas.xmlsoap.org/wsdl/" />
            <soap:body use="encoded" namespace="urn:tempuri-org:Object2" 
                encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
          </input>
          <output>
            <soap:body use="encoded" namespace="urn:tempuri-org:Object2" 
                encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
          </output>
        </operation>
      </binding>
      <service name="Object1Service">
        <port name="Object1Obj" binding="tns:Object1Obj">
          <soap:address location="http://www.tempuri.org/wsa/wsa1" />
        </port>
        <port name="Object2Obj" binding="tns:Object2Obj">
          <soap:address location="http://www.tempuri.org/wsa/wsa1" />
        </port>
      </service>
    </definitions>
    
  3. Save the text file as C:\MyWsdl.wsdl.
  4. Move to the Visual Studio .NET command prompt.
  5. To generate the proxy, type the following command at the command prompt and then press ENTER.

    To generate the proxy in Visual Basic .NET:

    wsdl /l:VB /out:C:\MyProxy.vb C:\MyWsdl.wsdl

    To generate the proxy in Visual C# .NET:

    wsdl /l:CS /out:C:\MyProxy.cs C:\MyWsdl.wsdl
  6. In the generated proxy class you may not find the Direction property and the Required property for SoapHeaderAttribute in class Object2Obj.

REFERENCES

For more information about Web Services Description Language, visit the following Microsoft Web site:

http://msdn.microsoft.com/library/en-us/dnwebsrv/html/wsdlexplained.asp?frame=true

Modification Type:MinorLast Reviewed:9/13/2005
Keywords:kbvs2002sp1sweep kbBug kbCodeGen kbXML kbWebServices KB816636 kbAudDeveloper