请任何人帮助我解决这个错误......这是ma Java代码:
public class MainActivity extends Activity implements Serializable {
private static final String Url = "http://c.knotbiz.com/knotbizjob.asmx";
private static final String Namespace = "http://tempuri.org/";
private static final String methodName = "UploadFile";
private static final String Soap_Action = "http://tempuri.org/UploadFile";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
handlerobj.post(runnableobj);
}
private Handler handlerobj = new Handler();
private Runnable runnableobj = new Runnable() {
public void run() {
// TODO Auto-generated method stub
Bitmap bitmapOrg = BitmapFactory.decodeResource(getResources(),
R.drawable.ic_launcher);
ByteArrayOutputStream bao = new ByteArrayOutputStream();
bitmapOrg.compress(Bitmap.CompressFormat.PNG, 90, bao);
byte[] ba = bao.toByteArray();
Log.v("Base64>>>>>>>",""+ Base64.encodeBase64(ba) );
long user_id = 3;
boolean Is_Created = false,Is_Overwrite = true,Is_resize = true;
String FileName = "Hishamdocument";
String FileType = "png";
//Base64.encodeBase64(ba)
SoapObject req = new SoapObject(Namespace, methodName);
req.addProperty("UserId", user_id);
req.addProperty("File", FileName);
req.addProperty("FileName", FileName);
req.addProperty("FileType", FileType);
req.addProperty("isCreated", Is_Created);
req.addProperty("Abspath", "");
req.addProperty("FullPath", "");
req.addProperty("IsOverwrite", Is_Overwrite);
req.addProperty("IsResize", Is_resize);
req.addProperty("Id", user_id);
req.addProperty("SendEmailId", user_id);
Log.v("Request>>>>>>>", req.toString());
//SoapEnvelope
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(req);
try{
Log.v("envelope body in", envelope.bodyIn.toString());
Log.v("envelope", envelope.toString());
Log.v("envelope body Out", envelope.bodyOut.toString());
}
catch(Exception e) {
Log.e("errror", ""+e);
}
//httpTransportSe
try{
HttpTransportSE httpreq = new HttpTransportSE(Url);
httpreq.debug = true;
Log.v("inside httpreq"," envelope.bodyOut.toString()");
httpreq.call(Soap_Action, envelope);
Log.v("inside httpreq"," envelope.bodyOut.toString()");
Log.v("After call httpreq",httpreq.responseDump.toString());
}
catch(Exception e){
e.printStackTrace();
}
}
};
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
抛出空指针异常......我不知道为什么会抛出它......我怎样才能得到正确的响应?请任何1帮助我吗?...在此先感谢。