hi,
My webservice code is,
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
{
public Service () {
}
[WebMethod]
public string HelloWorld() {
return "Hello World";
}
[WebMethod]
public int Addtion(int x, int y)
{
return x + y;
}
}
and my application code is:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace SimpleApplication
{
public partial class Form1 : Form
{
localhost.Service loc = new SimpleApplication.localhost.Service();
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int a, b, c;
a = Convert .ToInt16 ( textBox1.Text);
b = Convert.ToInt16 ( textBox2.Text);
c = loc.Addtion(a, b);
textBox3.Text = c.ToString();
MessageBox.Show("" + c);
}
}
}
in REFERENCE.CS page i will get error like this "Could not establish connection to network"
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/Addtion", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public int Addtion(int x, int y) {
object[] results = this.Invoke("Addtion", new object[] {
x,
y});
return ((int)(results[0]));
}