我有一个网络服务,它给出的响应为
<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>
现在,当我使用肥皂对象访问此服务时,我无法访问图像。这是我的代码。
尝试 {
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。它显示未知类型