public static final String name_space = "http://webService.sxthnet/";
public static String URL = "Http://100.123.68.166:8080/wbs1/Server1Port";
public static String method2= "Sayhello2";
Public final String Action2=name_space+method2;
@Override
protected void OnCreate (Bundle savedinstancestate) {
Super.oncreate (savedinstancestate);
Setcontentview (R.layout.activity_main);
ed1= (EditText) Findviewbyid (R.ID.EDITTEXT1);
btn1= (Button) Findviewbyid (R.id.button1);
Btn1.setonclicklistener (New Onclicklistener () {
@Override
public void OnClick (View v)
{
Ed1.settext ("BKKD");
Soapserializationenvelope envelope = new Soapserializationenvelope (SOAPENVELOPE.VER11);
Soapobject request = new Soapobject (NAME_SPACE,METHOD2);
//Pass parameter must be the beginning of ARG,//write the real variable name is not used, it must be arg0, Arg1 has been queued, as if only 10 parameters are supported. Everyone else said it was a weak one.
Request.addproperty ("arg0", "Zhang Mu Sheng");
Request.addproperty ("username", "my");
Envelope.setoutputsoapobject (Request);
Envelope.bodyout = Request;
Envelope.dotnet = false;
Httptransportse ht = new Httptransportse (URL);
Androidhttptransport ht=new Androidhttptransport (URL);
try{
Ht.call (fullurl, envelope);
Ht.call (Null,envelope);
if (Envelope.getresponse ()!=null) {
Ed1.settext (Envelope.getresponse (). toString ());
}
Else
Ed1.settext ("No");
} catch (Exception e) {
System.out.println (E.tostring ());
E.printstacktrace ();
Ed1.settext (E.tostring ());