I want to save data into sql server from eclips is there any solution? Is it possible with web service or json.. i have made one asp.net website and made web service for method...and cath that data into eclips by json...so now how to cath data from elips?
Asked
Active
Viewed 533 times
2 Answers
0
I am used belove code for get data from asp.net SOAP webservice in android try this
public static String SOAP_NAMESPACE = "http://myweb.com/";
public static String SOAP_METHOD_GetQuestionAnswer = "GetQuestionAnswer";
// GetQuestionAnswer Method
public static String GetQuestionAnswer(String GameIDValue, String QuestionIDValue) {
String responce = null;
SoapObject request = new SoapObject(SOAP_NAMESPACE, SOAP_METHOD_GetQuestionAnswer);
PropertyInfo GameID = new PropertyInfo();
PropertyInfo QuestionID = new PropertyInfo();
GameID.setName("gameid");
GameID.setValue(GameIDValue);
QuestionID.setName("queid");
QuestionID.setValue(QuestionIDValue);
request.addProperty(GameID);
request.addProperty(QuestionID);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE aht = new HttpTransportSE(SOAP_URL);
try {
aht.call(SOAP_ACTION_GetQuestionAnswer, envelope);
SoapPrimitive LoginResult;
LoginResult = (SoapPrimitive)envelope.getResponse();
System.out.println("=================GetQuestion Results: "+LoginResult);
System.out.println(LoginResult.toString());
responce = LoginResult.toString();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (XmlPullParserException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return responce;
}

Hemantvc
- 2,111
- 3
- 30
- 42
-
i want to pass data from android to web service – shivani patel Nov 30 '12 at 04:53
-
which web service used , rest full or soap ? – Hemantvc Nov 30 '12 at 05:18
-
ok try above code i am used this in my android application. – Hemantvc Nov 30 '12 at 05:35
-
yes i hv done the same dear...bt now i want to send data from android to server – shivani patel Nov 30 '12 at 05:37
-
i have a list of data that i want to save into sql server – shivani patel Nov 30 '12 at 05:39
-
@shivanipatel can you pls tell me whats you way of sending the data to the server, are you using SOAP, XML, JSON, or HTTP POST...?? – Hemantvc Nov 30 '12 at 05:43
-
@shivanipatel there is no method to save direct data to ms sql server.you can use webservice to save data. – Hemantvc Nov 30 '12 at 05:47
-
...thanx i m trying in this way only – shivani patel Nov 30 '12 at 05:49
-
Why should a developer use web services instead of direct connections to a db? http://stackoverflow.com/questions/2142070/why-should-a-developer-use-web-services-instead-of-direct-connections-to-a-db – Hemantvc Nov 30 '12 at 06:29
0
In android you can create a JSON object
and POST
in to your asp web service
, which eventually send data to your remote sql database
.
JSONObject obj = new JSONObject();
obj.put("val1",val1);
obj.put("val2",val2);
obj.put("val3",val3);

Robin Chander
- 7,225
- 3
- 28
- 42
-
@shivanipatel hey dear i check my answer it will help regarding your problem.. – Jatinkumar Patel Nov 30 '12 at 06:04
-