Hi All below is a WebService Class which i would like to use (i wrote it). The problem is i am not quite sure how to go about using it. I have a WinForm that Connects to a DB through another instance of DataAccessObject.
The user must be able to click a button which will open the website version of the form and modify the database from there.
The Problem is i don’t know how to Use The Service To Do so
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Xml.Linq;
using System.Configuration;
/// <summary>
/// Summary description for DataManager
/// </summary>
[WebService(Namespace = "/201103578Site//Default.aspx")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// 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 DataManager : System.Web.Services.WebService
{
XElement[] xmlCompany = null;
XElement[] xmlCandidate = null;
XElement[] xmlQualification = null;
public DataManager ()
{
//Uncomment the following line if using designed components
//InitializeComponent();
DataAccessObject.DataAccessObject daoDataBase = new DataAccessObject.DataAccessObject(ConfigurationManager.ConnectionStrings[1].ToString());
daoDataBase.openConnection();
xmlCompany = daoDataBase.sqlSelectCompany(new SQL.SqlImplementation(), "Select * From Company");
xmlCandidate = daoDataBase.sqlSelectCandidate(new SQL.SqlImplementation(), "Select * From Candidate");
xmlQualification = daoDataBase.sqlSelectQualification(new SQL.SqlImplementation(), "Select * From Qualification");
daoDataBase.closeConnection();
}
[WebMethod]
public XElement[] getXmlCompany()
{
return xmlCompany;
}
[WebMethod]
public XElement[] getXmlCandidate()
{
return xmlCandidate;
}
[WebMethod]
public XElement[] getXmlQualification()
{
return xmlQualification;
}
}
I would like to call the getXmlCompany and any of the other methods from the Company.aspx.cs file like one would any other method – if possible
Kind Regards
Markus
When you debug the web service, if everything is right, you will see a list of your web methods there. Now, copy the url in the browser, go to the project that need to use it, add web reference and past the url in. It will look and display your webserivice.
Further more, you can look into hosting your webservice in IIS so you don’t have to run debug every time.