CODING:
Web Service:
using System;
using
System.Collections;
using
System.ComponentModel;
using
System.Data;
using
System.Linq;
using
System.Web;
using
System.Web.Services;
using
System.Web.Services.Protocols;
using
System.Xml.Linq;
namespace exp6
{
///
/// Summary description for Service1
///
[WebService(Namespace
= "http://tempuri.org/")]
[WebServiceBinding(ConformsTo
= WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
// 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 Service1 :
System.Web.Services.WebService
{
[WebMethod]
public string mymailid(string
firstname,string lastname)
{
String
strjoin,a,b;
a = firstname;
b = lastname;
strjoin = a + "@" + b;
return strjoin;
}
}
}
Client Code:
<%@page contentType="text/html"
pageEncoding="UTF-8"%>
"http://www.w3.org/TR/html4/loose.dtd">
Hello World!
<%-- start web service invocation --%>
<%
try {
s1.Service1 service = new s1.Service1();
s1.Service1Soap port = service.getService1Soap();
// TODO initialize WS operation arguments here
java.lang.String firstname = "kannan";
java.lang.String lastname = "gmail.com";
// TODO process result here
java.lang.String result = port.mymailid(firstname, lastname);
out.println("My Mail id is "+result);
} catch (Exception ex) {
// TODO handle custom exceptions here
}
%>
<%-- end web service invocation --%>
No comments:
Post a Comment