How to access the Web service Class after, I have in my SL 2.0 project, added references to Web services?
This is the Page.xaml.cs:
using SilverlightApplication4.ServiceReference1;
namespace SilverlightApplication4
{
public partial class Page : UserControl
{
public Page ()
{
InitializeComponent ();
}
private void Button_MouseLeftButtonDown ( object sender, MouseButtonEventArgs e )
{
/* If this was aspx page I would do only this:
WebService ws = new WebService();
ws.HelloWorld ( "some args" );
}
}
}
This is the WebService.cs:
/// <summary>
/// Summary description for WebService
/// </summary>
[WebService ( Namespace = "http://tempuri.org/" )]
[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 WebService : System.Web.Services.WebService
{
public WebService ()
{
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public string HelloWorld ( string x)
{
return x;
}
}