Search code examples
.netsoapwsdl

svcutil does not generate soap client


I have a web service I would like to connect to and I can't figure out what goes wrong with the wsdl.

The wsdl is at "http://marketplacebylaredoute.fr/spapi/SellerOrderService?wsdl". I then try to run svcutil http://marketplacebylaredoute.fr/spapi/SellerOrderService?wsdl and it fails. The error is the following (extract only)

Error: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.Se
rviceModel.Description.XmlSerializerMessageContractImporter
Error: These members may not be derived.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://Redcats/Order
/SellerOrder/2.0']/wsdl:portType[@name='portType']

Any idea what could be wrong with this wsdl ?


Solution

  • The problem comes from the <wsdl:part>s like this one:

    <wsdl:part element="ns5:UpdateSellerOrderRequest_2.0" name="parameters">
    

    When name="parameters", svcutil.exe thinks that the service is doc/literal/wrapped.

    If you change it to something else than parameters, svcutil.exe will interprete it as doc/literal/bare.

    The solution is:

    Use Fiddler to create a proxy that change parameters to parameters1.

    Quick and dirty code for that:

    static function OnBeforeResponse(oSession: Session) {
        if (m_Hide304s && oSession.responseCode == 304) {
            oSession["ui-hide"] = "true";
        }
        oSession.utilDecodeResponse();
        oSession.utilReplaceInResponse('parameters', 'parameters1');
    
    }