Search code examples
c#visual-studioweb-servicessoapwsdl

SOAP client in .NET referencing existing WSDL


I've already read this useful thread about SOAP and WSDL in .NET

I'm trying to build a C# SOAP client, I've followed the instructions and added a "service reference" to the WSDL, but the client side proxy that is supposed to be generated, is not generated. I can only see classes, interfaces, enums, etc... I can't declare anything. I just can't:

MyService.MyWebServiceSoapClient ws = new MyService.MyWebServiceSoapClient();

Because I have no client to initialize.

So I tried to open a developer console and type

wsdl.exe <url_to_my_wsdl>

but it returned an error I can't understand. Something along the line:

Impossible to import operation 'someOperation'.
Element parameters, belonging to the namespace urn:my:namespace, imported in 2 differents context: PrimitiveMapping, MembersMapping.

Any idea? Thank you.


Solution

  • I found the solution to this problem by myself. After lots of trial and error modifications I came to the conclusion that the word "parameters" is not very welcome into .NET environment. So I changed it with "params" and now it is correctly imported by wsdl.exe

    So part of my previous WSDL was something like:

    <wsdl:message name="isServiceOnline">
        <wsdl:part name="parameters" element="MyElement"></wsdl:part>
    </wsdl:message>
    

    The new version of it is:

    <wsdl:message name="isServiceOnline">
        <wsdl:part name="params" element="MyElement"></wsdl:part>
    </wsdl:message>