views:

6

answers:

0

I'm using WCF to call a SOAP service.

I created a c# interface from the service with svcutil

svcutil /language:cs /CollectionType:System.Collections.Generic.List`1 /targetclientversion:Version35 /namespace:*,Company.Generated /out:Generated\Soapservice.cs http://www.company.se/soapservice.asmx?WSDL

Now the SOAP service suddenly changed(*) but I did not get any error/exception. What happened was that all fields after the change was uninitialized.

Before the reply from a method looked like

<Invoice>
    <InvoiceNo>1234</InvoiceNo>
    <CustomerNo>123</CustomerNo>
    <Address1>xxx</Address1>
    ...
    <InvoiceRow>
        <ArticleNo>Art</ArticleNo>
    </InvoiceRow>
    ...
</Invoice>

Now the reply looks like

<Invoice>
    <InvoiceNo>1234</InvoiceNo>
    <CustomerNo>123</CustomerNo>
    <PONumber>po</PONumber>
    <Address1>xxx</Address1>
    ...
    <InvoiceRow>
        <ArticleNo>Art</ArticleNo>
    </InvoiceRow>
    ...
</Invoice>

InvoiceNo and CustomerNo were correctly deserialized but the rest of the fields were null.

Is it possible to have WCF generate an exception if the contract has changed?

(*) I know soap interfaces should not be changed like this but it is a 3rd party webservice.