km4gedan
km4gedan
2016-04-21 03:17
采纳率: 58.3%
浏览 1.6k
已采纳

android 调用wcf,byte[] Cannot serialize

 public class UpLoadService implements ISoapService {

    private static final String NameSpace = "http://tempuri.org/";
    private static final String URL = "http://www.xxx.com/PhotoUp.svc";
    private static final String SOAP_ACTION = "http://tempuri.org/IPhotoUp/GetPic";
    private static final String MethodName = "GetPic";


    private byte[] updata;
    public UpLoadService(byte[] updata) {
        this.updata = updata;
    }





    public SoapObject LoadResult() {
        SoapObject soapObject = new SoapObject(NameSpace, MethodName);
        soapObject.addProperty("data", updata);

        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); // 版本
        envelope.bodyOut = soapObject;
        envelope.dotNet = true;
        envelope.setOutputSoapObject(soapObject);

        HttpTransportSE trans = new HttpTransportSE(URL);
        trans.debug = true; // 使用调试功能

        try {
            trans.call(SOAP_ACTION, envelope);
            System.out.println("Call Successful!");
        } catch (IOException e) {
            System.out.println("IOException");
            e.printStackTrace();
        } catch (XmlPullParserException e) {
            System.out.println("XmlPullParserException");
            e.printStackTrace();
        }

        SoapObject result = (SoapObject) envelope.bodyIn;

        return result;
    }

错误: java.lang.RuntimeException: Cannot serialize: [B@426abe90
我就是想把图片搞成byte[] 提交到wcf去,但是问题多多。 求留言解答

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • km4gedan
    km4gedan 2016-04-23 03:04
    已采纳

    跟android 没啥关系。费劲。。。问题都没确定

    点赞 评论

相关推荐