I have web service that I can consume successfully, but I am sharing my webservice with someone else who wants to input the parameters via the URL eg: //localhost:12345/Lead.asmx?op=SendFiles&Id=1234678&Name=Joe&Surname=Kevin
I added :
<webServices>
<protocols>
<add name="HttpGet"/>
</protocols>
</webServices>
to my Web.Config file and my SendFile.asmx.cs code looks like this:
namespace SendFiles
{
/// <summary>
/// Summary description for Service1
/// </summary>
[WebService(Namespace = "http://testco.co.za/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class SendFile : System.Web.Services.WebService
{
[WebMethod]
public bool PostToDB(LoadEntity _lead)
{
ConnectToSQLDB(ConfigurationManager.AppSettings["Server"], ConfigurationManager.AppSettings["DB"],
ConfigurationManager.AppSettings["UserName"], ConfigurationManager.AppSettings["Password"], ref connectionRef);
if (LI.ImportFiles(_lead, ref (error)) == true)
{
return true;
}
else
return false;
}
I tried adding :
[OperationContract]
[WebGet]
bool PostToDB(string IDNo, string FName, string SName);
But I get an error that I must declare a body because it is not marked abstract, extern or partial. Can anyone help?