locked
Modifying auto generated .net's WSDL to take actual types instead of wrapper elements? RRS feed

  • Question

  • Hi,

    I am wring a ASPX (C# webservice) that will be consumed by a Java application. Java application takes this .net generated WSDL and uses apache axis to generate the classes. The auto-generated .net service's SOAP input and output uses wrapper elements but these wrapper elements throw SAXParserException in the Java side. Is it Ok to modify the auto generated .NET WSDL's SOAP input and output objects to use actual types instead of wrapper elements? Find below the SOAP part of the WSDL, original one that has wrapper elements and the modified new one has actual types

    Original:

      <wsdl:message name="GenerateDocumentSoapIn">
        <wsdl:part name="parameters" element="tns:GenerateDocument"/>   // this GenerateDocument is defined to take a object
      </wsdl:message>
      <wsdl:message name="GenerateDocumentSoapOut">
        <wsdl:part name="parameters" element="tns:GenerateDocumentResponse"/> // GenerateDocumentResponse is wrapped over a string
      </wsdl:message>

    Modified:  here instead of wrapper objects, actual elements are used

      <wsdl:message name="GenerateDocumentSoapIn">
        <wsdl:part name="parameters" type="tns:Document"/>
      </wsdl:message>
      <wsdl:message name="GenerateDocumentSoapOut">
        <wsdl:part name="parameters" type="s:string"/>
      </wsdl:message>

    Is this Ok to do this?


    Also I am using Visual Studio 2008, the WSDL is generated using the IDE i.e. URL?wsdl. I am wondering if I can modify my web service methods to declare something above the method and avoid generation of this wrapper itself i.e. use some thing like [System.Web.Services.WebServiceBinding] and tell the IDE's WSDL.exe to generate WSDL without any wrapper object and instead use only the actual elements?
    Raja
    Tuesday, July 15, 2008 5:49 PM

Answers

  • I figured this out, at the method level instead of [webmehtod] I used [SoapDocumentMethod(ParameterStyle=SoapParameterStyle.Bare), WebMethod) this fixed the issue.
    Raja
    Tuesday, July 15, 2008 10:55 PM