问题
I know that using DataSets are a big evil, but as the service is not under my control and the prospect of creating a proxy service is a no go....
What i'm trying to see is if anyone has created class structure that can be deserialized using the kSoap serializer, or am i smoking the wrong stuff.
Going to start it in the mean time and see if it is possible.
Below is the resulting data as expected (Schema and Diffgram):
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<SearchCustomerResponse xmlns="http://NCBI/WS/CRM">
<SearchCustomerResult>
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="Table">
<xs:complexType>
<xs:sequence>
<xs:element name="cussurKey" type="xs:int" minOccurs="0" />
<xs:element name="cusKey" type="xs:int" minOccurs="0" />
<xs:element name="FullName" type="xs:string" minOccurs="0" />
<xs:element name="CIS" type="xs:long" minOccurs="0" />
<xs:element name="DCARKey" type="xs:int" minOccurs="0" />
<xs:element name="empBM" type="xs:string" minOccurs="0" />
<xs:element name="IDRegNo" type="xs:string" minOccurs="0" />
<xs:element name="RankCount" type="xs:long" minOccurs="0" />
<xs:element name="Source" type="xs:string" minOccurs="0" />
<xs:element name="GOICategory" type="xs:string" minOccurs="0" />
<xs:element name="cusperbanKey" type="xs:int" minOccurs="0" />
<xs:element name="GOIAmount" type="xs:int" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
<NewDataSet xmlns="">
<Table diffgr:id="Table1" msdata:rowOrder="0">
<cussurKey>211806</cussurKey>
<cusKey>0</cusKey>
<FullName>*AMA WIESE H/A PLANTWISE SHADENET </FullName>
<CIS>191004669827</CIS>
<DCARKey>3171</DCARKey>
<empBM>0007974 - Scott, Sean John</empBM>
<IDRegNo>0</IDRegNo>
<RankCount>1</RankCount>
<Source>Local</Source>
<GOICategory>Zero</GOICategory>
<cusperbanKey>7</cusperbanKey>
</Table>
<Table diffgr:id="Table2" msdata:rowOrder="1">
<cussurKey>115457</cussurKey>
<cusKey>0</cusKey>
<FullName>*C H WIESE EN J A BAARD </FullName>
<CIS>110587519304</CIS>
<DCARKey>33351</DCARKey>
<empBM>0135570 - Kriel, Werner</empBM>
<IDRegNo>0</IDRegNo>
<RankCount>2</RankCount>
<Source>Local</Source>
<GOICategory>Zero</GOICategory>
<cusperbanKey>7</cusperbanKey>
</Table>
</NewDataSet>
</diffgr:diffgram>
</SearchCustomerResult>
</SearchCustomerResponse>
</soap:Body>
</soap:Envelope>
回答1:
The Dataset is treated like an array of objects, as far as I can see, so you might want to consider a tutorial on how to return arrays of complex objects with KSOAP . You might need to create a Table class in Android and implement the KVMSerializable interface.
http://seesharpgears.blogspot.com/2010/10/web-service-that-returns-array-of.html
来源:https://stackoverflow.com/questions/4215960/ksoap-and-net-webservice-that-returns-a-dataset