项目需求 用Java WebService作为数据查询端(服务器端)
 用.Net C#作为数据展示端(客户端)现在数据查询出来的数据格式为XML型
<root>
<code>0</code>
<info>success</info>
<count>2</count>
<total>0</total>
<current_page>1</current_page>
<page_size>2</page_size>
<record>
<shopcd>000800</shopcd>
<shopname>双阳店</shopname>
<productcd>1000</productcd>
<productname>软性饮料</productname>
<salesamount>3387.1000</salesamount>
<salesamountpercent>0.004120</salesamountpercent>
<grosspro>171.3500</grosspro>
<grosspropercent>19.7671</grosspropercent>
<quantity>825.0000</quantity>
<quantitypercent>0.02</quantitypercent>
<receiptqty>571.0</receiptqty>
<receiptpi>14.75</receiptpi>
<unitpriceaverage>4.106</unitpriceaverage>
<receiptamountaverage>5.932</receiptamountaverage>
<totalsalesamount>822019.3300</totalsalesamount>
<totalquantity>52423.0000</totalquantity>
<totalreceiptqty>38700.0</totalreceiptqty>
</record>
<record>
<shopcd>000800</shopcd>
<shopname>双阳店</shopname>
<productcd>1001</productcd>
<productname>啤酒</productname>
<salesamount>153.9000</salesamount>
<salesamountpercent>0.000187</salesamountpercent>
<grosspro>4.1400</grosspro>
<grosspropercent>37.1739</grosspropercent>
<quantity>22.0000</quantity>
<quantitypercent>0.00</quantitypercent>
<receiptqty>17.0</receiptqty>
<receiptpi>0.44</receiptpi>
<unitpriceaverage>6.995</unitpriceaverage>
<receiptamountaverage>9.053</receiptamountaverage>
<totalsalesamount>822019.3300</totalsalesamount>
<totalquantity>52423.0000</totalquantity>
<totalreceiptqty>38700.0</totalreceiptqty>
</record>
<record>
<shopcd>000800</shopcd>
<shopname>双阳店</shopname>
<productcd>1002</productcd>
<productname>果酒</productname>
<salesamount>280.0000</salesamount>
<salesamountpercent>0.000341</salesamountpercent>
<grosspro>1.8400</grosspro>
<grosspropercent>152.1739</grosspropercent>
<quantity>30.0000</quantity>
<quantitypercent>0.00</quantitypercent>
<receiptqty>6.0</receiptqty>
<receiptpi>0.16</receiptpi>
<unitpriceaverage>9.333</unitpriceaverage>
<receiptamountaverage>46.667</receiptamountaverage>
<totalsalesamount>822019.3300</totalsalesamount>
<totalquantity>52423.0000</totalquantity>
<totalreceiptqty>38700.0</totalreceiptqty>
</record>
</root>
现在要求客户端显示为对金额进行统计  软性饮料      啤酒       果酒
双阳店      3387.1000    153.9000   280.0000三冲店      2482.1000    553.9000   230.0000  这样类型的,这样的数据转换要在Java中进行操作,返回给客户端调用,
我该怎么办呢?各位有什么好的方法吗?

解决方案 »

  1.   

    webService间交换数据应该使用与语言无关的基本类型传递
    看楼主的xml应该是一个表的3条记录,建议在webService规定字段顺序,然后返回基本类型的2维数组
      

  2.   

    返回的字段定义和字段顺序,都是已经定义到了的,返回的时候是以String字段返回过去,但格式是XML类型的
      

  3.   

    String字段是指什么?你应该先解析xml然后再将其中的值组成基本类型数组返回给客户端,而不是直接将xml字符串给客户端。