user787312
user787312

Reputation: 71

svcutil generated unneccesary wrapper classes

I am working on a project that uses the contract first approach. I was given a WSDL and three xsd's. When I use svcutil it generates a wrapper around the response class like so:

public partial class getDataByIdResponse1 {

    public getDataByIdResponse getDataByIdResponse;

    public getDataByIdResponse1() {
    }

    public getDataByIdResponse1(getDataByIdResponse getDataByIdResponse) {
        this.getDataByIdResponse = getDataByIdResponse;
    }
}

The getDataByIdResponse is wrapped inside a getDataByIdResponse1 object. This is done by svcutil and I have no idea why. The getDataByIdResponse1 object does not exist in the WSDL:

<wsdl:message name="getDataById">
    <wsdl:part name="response" element="tns:getDataByIdResponse"/>
</wsdl:message>

<xs:element name="getDataByIdResponse">
    <xs:complexType>
        <xs:sequence>
            <xs:element name="data" type="sbc:DataType" minOccurs="1" maxOccurs="1" />
        </xs:sequence>
    </xs:complexType>
</xs:element>

Why is the type getDataByIdResponse wrapped in getDataByIdResponse1? Is there a switch for svcutil I should have used?

Upvotes: 7

Views: 3769

Answers (1)

ThatAintWorking
ThatAintWorking

Reputation: 1360

I am in the same situation (contract-first) and svcutil is generating this same kind of code for me but I just closed my eyes took a deep breath and accepted it :-)

Just use the types without the numeric postfix and it just works.

Upvotes: 0

Related Questions