skip to main |
skip to sidebar
RSS Feeds
Nope. nothing .. just some random thoughts come to my mind ...
Nope. nothing .. just some random thoughts come to my mind ...
10:01 AM | Sunday, June 23, 2013
Posted by harshadura
2:52 PM | Saturday, June 22, 2013
Posted by harshadura
SSH into Open-Shift instances:
https://www.openshift.com/blogs/access-your-application-gear-using-ssh-with-putty
How to deploy WAR files inside Open-Shift:
http://whyjava.wordpress.com/2012/11/25/deploy-war-on-tomcat-running-on-openshift/
How to restart Open-Shift without Git pushes:
ctl_app : control your application (start, stop, restart, etc)https://www.openshift.com/kb/kb-e1055-how-to-restart-an-application
5:41 PM | Sunday, June 9, 2013
Posted by harshadura
Whoever getting started to learn Web services - Android app interaction I hope this tutorial may be helpful, You can download the full source from here: https://github.com/harshadura/RDA-Android-ASP.WS-interact/archive/master.zip
Prerequisites:
.NET framework, SQL server 2008, Android device/emulator
How to run.
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; using System.Data; using System.Data.Sql; using System.Data.SqlClient; [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService { public Service () { //Uncomment the following line if using designed components //InitializeComponent(); } [WebMethod] public String GetEmployeeByID(String id) { DataSet2TableAdapters.EmployeeTableAdapter dt1 = new DataSet2TableAdapters.EmployeeTableAdapter(); String ename = "" + dt1.getEmpByID(id); return ename; } [WebMethod] public Employee[] GetEmployees() { var employees = new List(); try { string connect = @"Data Source=HARSHADURA-AZUS\SQLEXPRESS;Initial Catalog=RDA;Integrated Security=True"; string query = "SELECT eid, ename FROM Employee"; SqlConnection thisConnection = new SqlConnection(connect); thisConnection.Open(); SqlCommand thisCommand = thisConnection.CreateCommand(); thisCommand.CommandText = query; SqlDataReader thisReader = thisCommand.ExecuteReader(); while (thisReader.Read()) { var emp = new Employee(); emp.eid = thisReader["eid"].ToString(); emp.ename = thisReader["ename"].ToString(); employees.Add(emp); } thisReader.Close(); thisConnection.Close(); } catch (SqlException e) { Console.WriteLine(e.Message); } return employees.ToArray(); } }
private SoapObject result = null; private static String SOAP_ACTION = "http://tempuri.org/GetEmployeeByID"; private static String NAMESPACE = "http://tempuri.org/"; private static String METHOD_NAME = "GetEmployeeByID"; private static String URL = "http://192.168.123.100:8080/Service.asmx?WSDL"; public void connectSOAP(String empid) { SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); request.addProperty("id", empid); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( SoapEnvelope.VER11); envelope.dotNet = true; envelope.setOutputSoapObject(request); HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); try { androidHttpTransport.call(SOAP_ACTION, envelope); } catch (Exception e) { e.printStackTrace(); } result = (SoapObject) envelope.bodyIn; }