Call web service from SQL Server stored procedure -


i had used query call web service in local system .. getting response "null"

the web service working fine ....

  declare @obj int   declare @surl varchar(200)   declare @response varchar(8000)    set @surl = 'http://localhost/myworks/samplewebservice.asmx/helloworld'   exec sp_oacreate 'msxml2.serverxmlhttp', @obj out   exec sp_oamethod @obj,'open',null,'get',@surl,false   exec sp_oamethod @obj,'send'   exec sp_oagetproperty @obj,'responsetext',@response out   select @response [response]   exec sp_oadestroy @obj 

web service code:

 public class samplewebservice : system.web.services.webservice  {             [webmethod]         public string helloworld()         {             string constring = configurationmanager.connectionstrings["rajeevconnectionstring"].connectionstring;             using (sqlconnection con = new sqlconnection(constring))             {                 sqlcommand cmd = new sqlcommand("update employees set firstname = 'jhon' id=7", con);                 con.open();                 cmd.executenonquery();                 con.close();             }             return "updated";             //sending mail code.         }     } 


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -