KSOAP和.Net Web服务,它返回一个DataSet [英] kSoap and .Net webservice that returns a DataSet

查看:357
本文介绍了KSOAP和.Net Web服务,它返回一个DataSet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道,用数据集是一个大恶人,但由于服务是不是我的控制之下,并创建一个代理服务的前景是一个没有去....

我想要看到的是,如果有人已经创建了可以使用KSOAP串行反序列化,还是我吸了错误的东西类结构。

去启动它的平均时间,看看它是否是可能的。

下面是如预期所产生的数据(Schema和的DiffGram):

 <?XML版本=1.0编码=UTF-8&GT?;
<肥皂:信封的xmlns:SOAP =htt​​p://schemas.xmlsoap.org/soap/envelope/的xmlns:XSI =htt​​p://www.w3.org/2001/XMLSchema-instance的xmlns:XSD = http://www.w3.org/2001/XMLSchema\">
  <肥皂:身体与GT;
    < SearchCustomerResponse的xmlns =HTTP:// NCBI / WS / CRM>
      < SearchCustomerResult>
        < XS:模式ID =NewDataSet的xmlns =的xmlns:XS =htt​​p://www.w3.org/2001/XMLSchema中的xmlns:MSDATA =瓮:架构 - 微软COM:XML-MSDATA >
          < XS:元素的名称=NewDataSetMSDATA:IsDataSet =真MSDATA:UseCurrentLocale =真正的>
            < XS:复杂类型>
              < XS:选择的minOccurs =0的maxOccurs =无界>
                < XS:元素的名称=表>
                  < XS:复杂类型>
                    < XS:序列>
                      < XS:元素的名称=cussurKey类型=XS:INT的minOccurs =0/>
                      < XS:元素的名称=cusKey类型=XS:INT的minOccurs =0/>
                      < XS:元素的名称=全名类型=XS:字符串的minOccurs =0/>
                      < XS:元素的名称=CIS类型=XS:长的minOccurs =0/>
                      < XS:元素的名称=DCARKey类型=XS:INT的minOccurs =0/>
                      < XS:元素的名称=empBM类型=XS:字符串的minOccurs =0/>
                      < XS:元素的名称=IDRegNo类型=XS:字符串的minOccurs =0/>
                      < XS:元素的名称=RankCount类型=XS:长的minOccurs =0/>
                      < XS:元素的名称=源类型=XS:字符串的minOccurs =0/>
                      < XS:元素的名称=GOICategory类型=XS:字符串的minOccurs =0/>
                      < XS:元素的名称=cusperbanKey类型=XS:INT的minOccurs =0/>
                      < XS:元素的名称=GOIAmount类型=XS:INT的minOccurs =0/>
                    < / XS:序列>
                  < / XS:复杂类型>
                < / XS:组件>
              < / XS:选择>
            < / XS:复杂类型>
          < / XS:组件>
        < / XS:架构>
        < diffgr:的DiffGram的xmlns:MSDATA =瓮:架构 - 微软COM:XML-MSDATA的xmlns:diffgr =瓮:架构 - 微软COM:XML-的DiffGram-V1>
          < NewDataSet的xmlns =>
            <表diffgr:ID =表1MSDATA:rowOrder =0>
              < cussurKey> 211806< / cussurKey>
              &所述; cusKey大于0&下; / cusKey>
              <全名> * AMA WIESE H / A PLANTWISE SHADENET< /全名>
              <独联体> 191004669827< / CIS>
              < D​​CARKey> 3171< / DCARKey>
              < empBM> 0007974 - 斯科特,约翰·肖恩< / empBM>
              &所述; IDRegNo大于0&下; / IDRegNo>
              &所述; RankCount→1&下; / RankCount>
              <信源>本地及LT; /来源>
              < GOICategory>零< / GOICategory>
              &所述; cusperbanKey大于7&下; / cusperbanKey>
            < /表>
            &所述;表diffgr:ID =表2MSDATA:rowOrder =1>
              < cussurKey> 115457< / cussurKey>
              &所述; cusKey大于0&下; / cusKey>
              <全名> *] C H WIESE EN J A作何感想< /全名>
              <独联体> 110587519304< / CIS>
              < D​​CARKey> 33351< / DCARKey>
              < empBM> 0135570 - Kriel,沃纳< / empBM>
              &所述; IDRegNo大于0&下; / IDRegNo>
              &所述; RankCount→2&下; / RankCount>
              <信源>本地及LT; /来源>
              < GOICategory>零< / GOICategory>
              &所述; cusperbanKey大于7&下; / cusperbanKey>
            < /表>
          < / NewDataSet>
        < / diffgr:&的DiffGram GT;
      < / SearchCustomerResult>
    < / SearchCustomerResponse>
  < / SOAP:身体与GT;
< / SOAP:信封>


解决方案

数据集被当作对象的数组,就我所看到的,所以你可能要考虑如何返回复杂对象的数组教程与KSOAP。您可能需要创建一个Android的表类,并实现KVMSerializable接口。

http://seesharpgears.blogspot.com/2010/10/web-service-that-returns-array-of.html

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>

解决方案

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

这篇关于KSOAP和.Net Web服务,它返回一个DataSet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆