1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
public final String SOAP_ACTION = "http://tempuri.org/PratList";
public final String OPERATION_NAME = "PratList";
public final String WSDL_TARGET_NAMESPACE = "http://tempuri.org/";
public final String SOAP_ADDRESS = "http://10.0.2.2:53539/xml/PPE3.asmx?WSDL ";
EditText username;
EditText passeword;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
username = findViewById(R.id.username);
passeword = findViewById(R.id.password);
final Button log = findViewById(R.id.pute);
log.setOnClickListener(this);
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
}
public String call(){
String a = username.getText().toString();
String b = passeword.getText().toString();
SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE, OPERATION_NAME);
// PropertyInfo email = new PropertyInfo();
// PropertyInfo pass = new PropertyInfo();
//
//
// email.setName("email");
// email.setValue(a);
// email.setType(String.class);
// request.addProperty(email);
//
// pass.setName("pass");
// pass.setValue(b);
// pass.setType(String.class);
// request.addProperty(pass);
SoapSerializationEnvelope envel = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envel.dotNet = true;
envel.setOutputSoapObject(request);
HttpTransportSE httpTransportSE = new HttpTransportSE(SOAP_ADDRESS);
Object resp = null;
try{
httpTransportSE.call(SOAP_ACTION, envel);
resp = envel.getResponse();
}
catch (Exception e){
resp = e.toString();
}
Log.e("tets", resp.toString());
return resp.toString();
} |
Partager