Beruflich Dokumente
Kultur Dokumente
NET
Proyecto N CAPAS
3.- diseñar interfaz visual en la capa de presentación Windows forms
4.- agregar nueva capa tipo Class Library para la capa de la Logica de Negocios (Procseos)
5.- Definir métodos en la capa de la Lógica de Negocios
/// <summary>
/// Descripción breve de WSCalculadora
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// Para permitir que se llame a este servicio web desde un script, usando ASP.NET
AJAX, quite la marca de comentario de la línea siguiente.
// [System.Web.Script.Services.ScriptService]
public class WSCalculadora : System.Web.Services.WebService {
public WSCalculadora () {
public WSCalculadora () {
[WebMethod]
public string HelloWorld() {
return "Hola a todos";
}
[WebMethod]
public Int32 sumar(Int32 n1, Int32 n2)
{
return n1 + n2;
}
}
9.3 Probar el Servicio Web
10.1 UBICARSE EN LA INTERFAZ WEB y agregar la referencia del servicio web desde el
local host
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LogicaNegocio;
using localhost;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LogicaNegocio;
using localhost;
}
protected void btnSumarLogicaNegocio_Click(object sender, EventArgs e)
{
TextBox3.Text=(operaciones.sumar(Convert.ToInt32(TextBox1.Text),
Convert.ToInt32(TextBox2.Text)).ToString());
}
protected void btnWebServices_Click(object sender, EventArgs e)
{
}
}
10.3 consumir el servicio web desde la aplicación web
10.3 Llamar al servicio web