Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static final String SOAP_ACTION_DISCOVER_SERVICES = "http://tempuri.org/DiscoverService";
- public static final String METHOD_NAME_DISCOVER_SERVICES = "DiscoverService";
- public AsyncTask<String, Void, String> discoverServices() {
- return new AsyncTask<String, Void, String>() {
- @Override
- protected void onPreExecute() {
- super.onPreExecute();
- }
- @Override
- protected String doInBackground(String... params) {
- String resultData = "null";
- try {
- SoapObject request = new SoapObject(Splash.NAMESPACE,
- METHOD_NAME_DISCOVER_SERVICES);
- PropertyInfo pi = new PropertyInfo();
- pi.setName("user");
- User user = new User();
- user.setName("Alka Shukla");
- user.setUserId("[email protected]");
- user.setPassword("demeler@123");
- user.setEmail("[email protected]");
- user.setRole("admin");
- pi.setValue(user);
- pi.setType(User.USER_CLASS);
- request.addProperty(pi);
- SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
- SoapEnvelope.VER11);
- envelope.dotNet = true;
- System.setProperty("http.keepAlive", "true");
- envelope.setOutputSoapObject(request);
- HttpTransportSE androidHttpTransport = new HttpTransportSE(
- Splash.SERVICE_URL, 10000);
- androidHttpTransport.call(SOAP_ACTION_DISCOVER_SERVICES, envelope);
- SoapPrimitive result = (SoapPrimitive) envelope.getResponse();
- resultData = result.toString();
- Log.e("DiscoverServices", "ResultData: " + resultData);
- //JSONObject ja = new JSONObject(resultData);
- } catch (Exception e) {
- e.printStackTrace();
- }
- return resultData;
- }
- @Override
- protected void onPostExecute(String result) {
- if (result.contains("Err:"))
- dialog(TransactionActivity.this, "Info", "Unable to update Meeting.", true);
- else {
- dialog(TransactionActivity.this, "Info", "Your meeting " + _meetingNameEditText.getText().toString().trim() + " from " + _timeBookingEditText.getText().toString().replace("-", "to")
- + " updated successfully.", true);
- super.onPostExecute(result);
- }
- }
- };
- }
- }
- class User implements KvmSerializable {
- public static Class USER_CLASS = new User().getClass();
- public String Name, UserId, Password, Email, Role;
- public String getName() {
- return Name;
- }
- public void setName(String name) {
- Name = name;
- }
- public String getUserId() {
- return UserId;
- }
- public void setUserId(String userId) {
- UserId = userId;
- }
- public String getPassword() {
- return Password;
- }
- public void setPassword(String password) {
- Password = password;
- }
- public String getEmail() {
- return Email;
- }
- public void setEmail(String email) {
- Email = email;
- }
- public String getRole() {
- return Role;
- }
- public void setRole(String role) {
- Role = role;
- }
- @Override
- public Object getProperty(int i) {
- switch (i) {
- case 0:
- return Name;
- case 1:
- return UserId;
- case 2:
- return Password;
- case 3:
- return Email;
- case 4:
- return Role;
- default:
- return null;
- }
- }
- @Override
- public int getPropertyCount() {
- return 5;
- }
- @Override
- public void setProperty(int i, Object value) {
- switch (i) {
- case 0:
- Name = value.toString();
- break;
- case 1:
- UserId = value.toString();
- break;
- case 2:
- Password = value.toString();
- break;
- case 3:
- Email = value.toString();
- break;
- case 4:
- Role = value.toString();
- break;
- default:
- break;
- }
- }
- @Override
- public void getPropertyInfo(int i, Hashtable hashtable, PropertyInfo info) {
- switch (i)
- {
- case 0:
- info.type = PropertyInfo.STRING_CLASS;
- info.name = "Name";
- break;
- case 1:
- info.type = PropertyInfo.STRING_CLASS;
- info.name = "UserId";
- break;
- case 2:
- info.type = PropertyInfo.STRING_CLASS;
- info.name = "Password";
- break;
- case 3:
- info.type = PropertyInfo.STRING_CLASS;
- info.name = "Email";
- break;
- case 4:
- info.type = PropertyInfo.STRING_CLASS;
- info.name = "Role";
- break;
- default:
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment