locked
WSDL question RRS feed

  • Question

  • User1374521686 posted

    Hi,

    I've succesfully created a standard interface to a well known Document Management System using SOAP-XML. The standard WSDL issued by the manufacturer contains a basic set of classes including methods and properties. So far so good. However, the DMS is based on a standard model which means that customers are free to add non-standard features. For example, the method "GetDocument" returns a document object with several properties with corresponding values. During reception of the message, VB.Net raises an execption stating that there is an invalid property value in the message. This is correct, the value is not in the standard WSDL (used in our development service reference) but is available in the .asmx file on the customers webserver. I am looking for an elegant and flexible way to deal with non-standard messages at my customers' sites without recompiling the application.

    Tuesday, July 23, 2013 7:38 AM

Answers

  • User-742633084 posted

    Hi j.keulen,

    I think such kind of compatible issue does occurs whenever either service or client-side has involved some non-standard changes.

    Personally, I would suggest you consider the following options:

    1) Since the error is due to the generated client proxy type (the certain classes to mapping the WSDL schema types) doesn't match the data be received at runtime, we can consider manually adjust the generated code (via Add WebReference or Add ServiceReference). Or we can use Wsdl.exe or Svcutil.exe tool to generate the client service proxy at commandline and modify the generated code accordingly.

    2) Both ASP.NET ASMX webservice or WCF service provides means to intercept the underlying raw SOAP message and modify it (before the runtime deserialize it into .NET code objects). For example, ASMX webservice provide SoapExtension to do such work. While WCF provide message inspector or message encoder to do so. But creating such an extension component is complicated and will cost more effort.

    SoapExtension Class
    http://msdn.microsoft.com/en-us/library/system.web.services.protocols.soapextension.aspx

    Message Inspectors
    http://msdn.microsoft.com/en-us/library/aa717047.aspx

    3) In some cases, if the webservice is not too complicated and large, we can consider using raw HttpWebRequest or HttpClient (.NET 4.5) classes to consume it. We can send the raw HTTP POST with SOAP XML content and receive the raw SOAP XML response. Thus, we can use .NET XML processing components (such as LINQ to XML) to process the response XML data.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, July 26, 2013 4:38 AM

All replies

  • User-306750178 posted

    Can you reproduce your code so that I will help you better.

    Tuesday, July 23, 2013 7:42 AM
  • User1374521686 posted

    Hi,

    Here is the part of the WSDL that causes errors:

     <s:simpleType name="LWijzeaanname">
            <s:restriction base="s:string">
              <s:enumeration value="Telefonisch" />
              <s:enumeration value="Mondeling" />
              <s:enumeration value="Schriftelijk" />
              <s:enumeration value="Eigen_waarneming" />
              <s:enumeration value="_Nog__niet_bekend" />
              <s:enumeration value="Doorgestuurde_melding" />
              <s:enumeration value="E_mail" />
              <s:enumeration value="Webformulier" />
            </s:restriction>
          </s:simpleType>

    This is the standard WSDL, used as Service Ref in our application (VB.Net 2012). In one of my clients configurations, the webservice sends the value "Brief" back which is not in the list.

    If you need more code, please specify.

     

    Wednesday, July 24, 2013 7:17 AM
  • User-742633084 posted

    Hi j.keulen,

    I think such kind of compatible issue does occurs whenever either service or client-side has involved some non-standard changes.

    Personally, I would suggest you consider the following options:

    1) Since the error is due to the generated client proxy type (the certain classes to mapping the WSDL schema types) doesn't match the data be received at runtime, we can consider manually adjust the generated code (via Add WebReference or Add ServiceReference). Or we can use Wsdl.exe or Svcutil.exe tool to generate the client service proxy at commandline and modify the generated code accordingly.

    2) Both ASP.NET ASMX webservice or WCF service provides means to intercept the underlying raw SOAP message and modify it (before the runtime deserialize it into .NET code objects). For example, ASMX webservice provide SoapExtension to do such work. While WCF provide message inspector or message encoder to do so. But creating such an extension component is complicated and will cost more effort.

    SoapExtension Class
    http://msdn.microsoft.com/en-us/library/system.web.services.protocols.soapextension.aspx

    Message Inspectors
    http://msdn.microsoft.com/en-us/library/aa717047.aspx

    3) In some cases, if the webservice is not too complicated and large, we can consider using raw HttpWebRequest or HttpClient (.NET 4.5) classes to consume it. We can send the raw HTTP POST with SOAP XML content and receive the raw SOAP XML response. Thus, we can use .NET XML processing components (such as LINQ to XML) to process the response XML data.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, July 26, 2013 4:38 AM