Prasad Bhagat

Prasad Bhagat

  • NA
  • 516
  • 236.4k

how to create web service with request and responce in josn?

Aug 27 2015 6:51 AM
Dear all,
 
i want create a web service that will send the data and recives the data in json,
 when i was create a web service it will autometically tacking soap formatt for post operation please expline me how to pass data in json formatt using sql stored procedures .please help me . 
 
my operation like bellow
 
[webmethod]
public string savedata(string name,string city,string country ,string pin)
{
sqlconnection conn=new sqlconnection(connection object);
sqlcommand cmd=new sqlcommand("sp_register",conn);
cmd.commandtype=commandtype.stroredprocedure;
cmd.parameters.addwithvalue("@name",name);
cmd.parameters.addwithvalue("@city"city);
cmd.parameters.addwithvalue("@country"country);
string STATUSMSG = (string)cmd.ExecuteScalar();
return new JavaScriptSerializer().Serialize(STATUSMSG);
 
by defalut am getting post operation in soap formatt i need to change it into json please help me 
 

Answers (1)