我需要在后台将文件上传到服务器,我在 asynctask 中进行此操作,但是,如果我没有互联网,我想稍后再上传。实际上,如果没有网络,asynctask 就会崩溃。
request.addProperty(file);
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER12);
new MarshalBase64().register(envelope); // serialization
envelope.encodingStyle = SoapEnvelope.ENC;
envelope.bodyOut = request;
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
envelope.setAddAdornments(false);
envelope.implicitTypes = true;
HttpTransportSE transporte = new HttpTransportSE(URL);
transporte.setXmlVersionTag("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
transporte.debug = true;
try {
transporte.call(SOAP_ACTION, envelope);
result = (SoapObject) envelope.getResponse();
应该是什么?检查互联网连接以及何时打开文件的服务?其他想法?
请问有人有例子吗?谢谢