views:

326

answers:

1

I Integrate a web service that returns several DataTables.

When I update webservice reference, sometimes some methods' return type changes from DataTable to a class that looks like an array of 2 items (one for schema other for datatable).

In browser we look at the reference datatable looks like that :

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
  <soap:Body>
    <NormalMethodResponse xmlns="http://abc.com"&gt;
      <NormalMethodResult>
        <xsd:schema>schema</xsd:schema>xml</NormalMethodResult>
    </NormalMethodResponse>
  </soap:Body>
</soap:Envelope>

but the problemmatic methods look like :

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
  <soap:Body>
    <ProblemmaticMethodResponse xmlns="http://abs.com"&gt;
      <ProblemmaticMethodResult>xmlxml</ProblemmaticMethodResult>
    </ProblemmaticMethodResponse>
  </soap:Body>
</soap:Envelope>

normally this problemmatic method returns a datatable and it's not changed between web reference updates.

Anyone knows why this happens ?

EDIT : I solved the problem after updating Web Reference in another machine. Method now returns DataTable. But still don't know why this happens.

+1  A: 

First of all, returning DataTable or DataSet is not a best practice, as these types are specific to .NET.

Secondly, it sounds like the DataSet of which the DataTable is a part has changed to have its mode set to include the schema. You might try explicitly creating the DataTable as part of a DataSet with SchemaSerializationMode set to ExcludeSchema.

John Saunders