无法从webservice返回字节数组

时间:2013-07-12 08:36:18

标签: java android web-services

我有一个网络服务,其响应为

    <Category>
     <cat_id>1</cat_id>
    <cat_image xmlns:a="http://schemas.datacontract.org/2004/07/System.Data.Linq">
    <a:Bytes>
     /9j/4AAQSkZJRgABAgEAYABgAAD/7gAOQWRvYmUAZAAAAAAB/+ETXUV4aWYAAE1NACoAAAAIA
 </a:Bytes>
    </cat_image>
    </Category>

现在,当我使用soap对象访问此服务时,我无法访问image.This是我的代码。

试         {

          SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
   SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    envelope.dotNet = true;
    envelope.setOutputSoapObject(request);
    HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
    androidHttpTransport.call(SOAP_ACTION,envelope);
    Object soap =(SoapObject)envelope.getResponse();

     c = new Category[((SoapObject) soap).getPropertyCount()];
    for (int i = 0; i < c.length; i++) {
        SoapObject pii = (SoapObject) ((SoapObject) soap).getProperty(i);
       Category t=new Category();
       t.Catid=pii.getProperty(0).toString();
       t.Catname=pii.getProperty(2).toString();
       t.Catimage= Base64.decode((String) pii.getProperty(1), Base64.DEFAULT) ;
        c[i] =t;
    }

    }
    catch (Exception E) {
        E.printStackTrace();
    }

我没有获得Catimage.Its显示未知类型

0 个答案:

没有答案