Advertisement
Guest User

Untitled

a guest
Jun 30th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. playOnlineButton.setOnClickListener( new View.OnClickListener() {
  2. public void onClick( View v ) {
  3. final String username = usernameInput.getText().toString();
  4. final String password = passwordInput.getText().toString();
  5.  
  6. final String DBIP = "192.168.2.137";
  7.  
  8. new Thread( new Runnable() {
  9. public void run( ) {
  10. try {
  11. String NAMESPACE = "http://QuizWS.gawhisper.com/";
  12. String URL = "http://" + DBIP + ":8080/QuizWebService/QuizWS";
  13. String METHOD_NAME = "CheckLogin";
  14. String SOAP_ACTION = "http://QuizWS.gawhisper.com/QuizWS/CheckLogin";
  15.  
  16. SoapObject request = new SoapObject( NAMESPACE, METHOD_NAME );
  17.  
  18. PropertyInfo usernameProperty = new PropertyInfo();
  19. usernameProperty.type = PropertyInfo.STRING_CLASS;
  20. usernameProperty.setName( "username" );
  21. usernameProperty.setValue( username );
  22.  
  23. PropertyInfo passwordProperty = new PropertyInfo();
  24. passwordProperty.type = PropertyInfo.STRING_CLASS;
  25. passwordProperty.setName( "password" );
  26. passwordProperty.setValue( password );
  27.  
  28. request.addProperty( usernameProperty );
  29. request.addProperty( passwordProperty );
  30.  
  31. SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( SoapEnvelope.VER11 );
  32.  
  33. envelope.setOutputSoapObject( request );
  34.  
  35.  
  36. HttpTransportSE androidHttpTransport = new HttpTransportSE( URL );
  37.  
  38.  
  39. androidHttpTransport.call( SOAP_ACTION, envelope );
  40.  
  41. SoapPrimitive response = ( SoapPrimitive ) envelope.getResponse();
  42.  
  43. answer = response.toString();
  44. Toast.makeText( StartActivity.this, "ANSWER IS: " + answer, Toast.LENGTH_SHORT ).show();
  45. } catch ( Exception e ) {
  46. Log.e( "", "ERROR ----------------->" + e.getMessage() );
  47. }
  48. }
  49. } ).start();
  50. }
  51. } );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement