Professional Documents
Culture Documents
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 () {
public Hello () {
[WebMethod]
public string HelloWorld(string name) {
return "Hello " + name;
}
}
Testing Web Service
For any type of client- either a web client or a console based application
invoke web service as shown below
Console application
Change the Web reference to some other meaningful name other than the
local host
Console application
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
HelloDotNetWS.HelloGreetings h = new
HelloDotNetWS.HelloGreetings();
Console.WriteLine(h.SayHello("Narada"));
Console.Read();
}
}
}
<add key="HelloDotNetWS.Hello"
value="http://localhost:49237/WebService/Hello.asmx"/>
is automatically added
Label1.Text = h.SayHello(TextBox1.Text);
}
Similarly try web services from Jboss application also
using System.Text;
namespace FromJbossWS
{
class Program
{
static void Main(string[] args)
{
JbossWS.HelloService s = new JbossWS.HelloService();
Console.WriteLine(s.hello("Gayatri"));
Console.Read();
}
}
}