Microsoft KB Archive/816636

= BUG: Incorrect proxy is generated when the WSDL file contains multiple bindings =

Article ID: 816636

Article Last Modified on 1/11/2007

-

APPLIES TO


 * Microsoft Web Services Enhancements for Microsoft .NET 1.1
 * Microsoft Web Services Enhancements for Microsoft .NET 2.0
 * Microsoft Visual Basic .NET 2003 Standard Edition
 * Microsoft Visual Basic .NET 2002 Standard Edition
 * Microsoft Visual C# .NET 2003 Standard Edition
 * Microsoft Visual C# .NET 2002 Standard Edition

-



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 &quot;More Information&quot; 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  Replace the existing SoapHeaderAttribute with the following SoapHeaderAttribute attribute: 

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

Steps to Reproduce the Problem
 Open a text editor such as Notepad.  Copy and then paste the following code to a new file:  <definitions xmlns:s1=&quot;urn:tempuri-org:Object2&quot; xmlns:http=&quot;http://schemas.xmlsoap.org/wsdl/http/&quot; xmlns:soap=&quot;http://schemas.xmlsoap.org/wsdl/soap/&quot; xmlns:s=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:s0=&quot;urn:tempuri-org:Object1&quot; xmlns:soapenc=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot; xmlns:tns=&quot;urn:tempuri-org&quot; xmlns:tm=&quot;http://microsoft.com/wsdl/mime/textMatching/&quot; xmlns:mime=&quot;http://schemas.xmlsoap.org/wsdl/mime/&quot; targetNamespace=&quot;urn:tempuri-org&quot; name=&quot;Object1&quot; xmlns=&quot;http://schemas.xmlsoap.org/wsdl/&quot;>      </s:complexType> </s:schema> <s:schema elementFormDefault=&quot;unqualified&quot; targetNamespace=&quot;urn:tempuri-org:Object2&quot;> <s:complexType name=&quot;Object2ID&quot;>  <s:element name=&quot;UUID&quot; type=&quot;s:string&quot; /> </s:sequence> </s:complexType> </s:schema> <message name=&quot;Object1ID&quot;> <part name=&quot;Object1ID&quot; type=&quot;s0:Object1ID&quot; /> <message name=&quot;Object1Connect&quot;> <part name=&quot;userId&quot; type=&quot;s:string&quot; /> <part name=&quot;password&quot; type=&quot;s:string&quot; /> <part name=&quot;appServerInfo&quot; type=&quot;s:string&quot; /> <message name=&quot;Object1ConnectResponse&quot; /> <message name=&quot;Object2ID&quot;> <part name=&quot;Object2ID&quot; type=&quot;s1:Object2ID&quot; /> <message name=&quot;Object2&quot;> <part name=&quot;input1&quot; type=&quot;s:int&quot; /> <message name=&quot;Object2Response&quot;> <part name=&quot;result&quot; type=&quot;s:string&quot; /> <message name=&quot;Object2Release&quot; /> <message name=&quot;Object2ReleaseResponse&quot; /> <portType name=&quot;Object1Obj&quot;> <operation name=&quot;Connect_Object1&quot; parameterOrder=&quot;userId password appServerInfo&quot;> <input message=&quot;tns:Object1Connect&quot; /> <output message=&quot;tns:Object1ConnectResponse&quot; /> <operation name=&quot;CreatePO_Object2&quot; parameterOrder=&quot;input1&quot;> <input message=&quot;tns:Object2&quot; /> <output message=&quot;tns:Object2Response&quot; /> </portType> <portType name=&quot;Object2Obj&quot;> <operation name=&quot;Release_Object2&quot;> <input message=&quot;tns:Object2Release&quot; /> <output message=&quot;tns:Object2ReleaseResponse&quot; /> </portType> <binding name=&quot;Object1Obj&quot; type=&quot;tns:Object1Obj&quot;> <soap:binding transport=&quot;http://schemas.xmlsoap.org/soap/http&quot; style=&quot;rpc&quot; /> <operation name=&quot;Connect_Object1&quot;> <soap:operation soapAction=&quot;&quot; style=&quot;rpc&quot; /> <soap:body use=&quot;encoded&quot; namespace=&quot;urn:tempuri-org:Object1&quot; encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot; /> <soap:header message=&quot;tns:Object1ID&quot; part=&quot;Object1ID&quot; use=&quot;encoded&quot; encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot; namespace=&quot;urn:tempuri-org:Object1&quot; /> <soap:body use=&quot;encoded&quot; namespace=&quot;urn:tempuri-org:Object1&quot; encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot; /> <operation name=&quot;CreatePO_Object2&quot;> <soap:operation soapAction=&quot;&quot; style=&quot;rpc&quot; /> <soap:header d5p1:required=&quot;true&quot; message=&quot;tns:Object1ID&quot; part=&quot;Object1ID&quot; use=&quot;encoded&quot; encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot; namespace=&quot;urn:tempuri-org:Object1&quot; xmlns:d5p1=&quot;http://schemas.xmlsoap.org/wsdl/&quot; /> <soap:body use=&quot;encoded&quot; namespace=&quot;urn:tempuri-org:Object1&quot; encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot; /> <soap:header message=&quot;tns:Object2ID&quot; part=&quot;Object2ID&quot; use=&quot;encoded&quot; encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot; namespace=&quot;urn:tempuri-org:Object1&quot; /> <soap:body use=&quot;encoded&quot; namespace=&quot;urn:tempuri-org:Object1&quot; encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot; /> <binding name=&quot;Object2Obj&quot; type=&quot;tns:Object2Obj&quot;> <soap:binding transport=&quot;http://schemas.xmlsoap.org/soap/http&quot; style=&quot;rpc&quot; /> <operation name=&quot;Release_Object2&quot;> <soap:operation soapAction=&quot;&quot; style=&quot;rpc&quot; /> <soap:header d5p1:required=&quot;true&quot; message=&quot;tns:Object2ID&quot; part=&quot;Object2ID&quot; use=&quot;encoded&quot; encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot; namespace=&quot;urn:tempuri-org:Object2&quot; xmlns:d5p1=&quot;http://schemas.xmlsoap.org/wsdl/&quot; /> <soap:body use=&quot;encoded&quot; namespace=&quot;urn:tempuri-org:Object2&quot; encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot; /> <soap:body use=&quot;encoded&quot; namespace=&quot;urn:tempuri-org:Object2&quot; encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot; /> <service name=&quot;Object1Service&quot;> <port name=&quot;Object1Obj&quot; binding=&quot;tns:Object1Obj&quot;> <soap:address location=&quot;http://www.tempuri.org/wsa/wsa1&quot; /> <port name=&quot;Object2Obj&quot; binding=&quot;tns:Object2Obj&quot;> <soap:address location=&quot;http://www.tempuri.org/wsa/wsa1&quot; /> </li> Save the text file as C:\MyWsdl.wsdl .</li> Move to the Visual Studio .NET command prompt.</li> 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</li> In the generated proxy class you may not find the Direction property and the Required property for SoapHeaderAttribute in class Object2Obj.</li></ol>

<div class="references_section">