Professional Documents
Culture Documents
Pratham Shindes Ws 49
Pratham Shindes Ws 49
Pratham Shindes Ws 49
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;
1 Signature:
Sathish Pradhan Dnynasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
O/P: -
FtoC
2 Signature:
Sathish Pradhan Dnynasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
CtoF
3 Signature:
Sathish Pradhan Dnynasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
namespace Practical2
{
/// <summary>
/// Summary description for WebService1
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.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 WebService1 : System.Web.Services.WebService
{
[WebMethod]
public int Addition (int x, int y)
{
return x + y;
}
[WebMethod]
public int Subtraction (int x, int y)
{
4 Signature:
Sathish Pradhan Dnynasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
return x - y;
}
[WebMethod]
public int Multiplication (int x, int y)
{
return x * y;
}
[WebMethod]
public int Division (int x, int y)
{
return x / y;
}
}
}
O/P: -
5 Signature:
Sathish Pradhan Dnynasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
6 Signature:
Sathish Pradhan Dnynasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
7 Signature:
Sathish Pradhan Dnynasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
8 Signature:
Sathish Pradhan Dnynasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table border="1">
<tr>
<td>Enter number 1:</td>
<td><asp:TextBox ID="TextBox1"
runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>Enter number 2:</td>
<td><asp:TextBox ID="TextBox2"
runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>Display Result:</td>
<td><asp:TextBox ID="TextBox3"
runat="server"></asp:TextBox></td>
</tr>
<tr>
<td><asp:Button ID="Button1" runat="server" Text="Add(+)"
onclick="Button1_Click"/></td>
<td><asp:Button ID="Button2" runat="server" Text="Mul(*)"
onclick="Button2_Click"/></td>
</tr>
<tr>
9 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
WebForm1.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Practical2B
{
public partial class WebForm1 : System.Web.UI.Page
{
int a, b, c;
WebService1 obj = new WebService1();
protected void Page_Load(object sender, EventArgs e)
{
10 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
TextBox3.Text = c.ToString();
}
}
}
WebService1.asmx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
namespace Practical2B
{
/// <summary>
/// Summary description for WebService1
11 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.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 WebService1 : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
12 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
O/P: -
13 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
Addition:
Subtraction:
14 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
Multiplication:
Division:
15 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;
@WebService(serviceName = "Practical4")
public class Practical4 {
@WebMethod(operationName = "hello")
public String hello(@WebParam(name = "name") String txt) {
return "Hello " + txt + " !";
}
}
16 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
O/P: -
17 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
namespace WebApplication1
{
/// <summary>
/// Summary description for WebService1
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.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 WebService1 : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
}
}
18 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
WebForm1.aspx
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
WebService Communication With Different Paltform
<table>
<tr>
<td>Enter Your Name:</td>
<td> <asp:TextBox ID="TextBox1"
runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>
<asp:Button ID="Button1" runat="server" Text="Clear"
OnClick="Button1_Click" /></td>
<td>
<asp:Button ID="Button2" runat="server" Text="Submit"
OnClick="Button2_Click" /></td>
</tr>
<tr>
<td><asp:Label ID="Label1" runat="server"
Text="Welcome:"></asp:Label></td>
<td><asp:Label ID="Label2" runat="server"
Text="Label"></asp:Label></td>
</tr>
</table>
</div>
</form>
</body>
</html>
19 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
WebForm1.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication1
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
20 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
O/P: -
21 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;
@WebService(serviceName = "StudentWebService")
public class StudentWebService {
@WebMethod(operationName = "StudentDetails")
public String StudentDetails(@WebParam(name = "Roll No") String RollNo,
@WebParam(name = "Student Name") String StudentName,
@WebParam(name = "Student Class") String StudentClass) {
return "Welcome: Roll No: " +RollNo+ "\t Student Name: "
+StudentName+ "\t Student Class: " +StudentClass;
}
}
22 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
ProgramServlet
import java.io.*;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import server.UserWebService;
23 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
Program1.jsp
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>Web Service User Form Details</h1>
<hr size = "4" color = "orange">
<form action="ProgramServlet">
Roll No: <input type="text" name="SRN" value="" /><br>
Student Name: <input type="text" name="SName" value="" /><br>
Student Class: <input type="text" name="SClass" value="" /><br><br>
<input type="submit" value="Submit" />
</form> <hr size = "4" color = "orange">
</body>
</html>
24 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
O/P: -
25 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
26 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
O/P: -
27 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
</webServices>
<compilation debug="true" targetFramework="4.7.1" />
<httpRuntime targetFramework="4.7.1" />
</system.web>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodePro
vider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform,
Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
warningLevel="4" compilerOptions="/langversion:default
/nowarn:1659;1699;1701" />
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvide
r, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4"
compilerOptions="/langversion:default /nowarn:41008
/define:_MYTYPE=\"Web\" /optionInfer+" />
</compilers>
</system.codedom>
</configuration>
Employees.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Practical6
{
public class Employees
{
public int id { get; set; }
public string name { get; set; }
public string gender { get; set; }
public int salary { get; set; }
}}
28 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
EmployeesService.asmx
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.Script.Serialization;
using System.Web.Services;
namespace Practical6
{
/// <summary>
/// Summary description for EmployeesService
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.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 EmployeesService : System.Web.Services.WebService
{
[WebMethod]
public void GetAllEmployees()
{
List<Employees> listEmployees = new List<Employees>();
string cs =
ConfigurationManager.ConnectionStrings["MyDB"].ConnectionString;
using (SqlConnection con = new SqlConnection(cs))
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.CommandText = "AngularDB";
con.Open();
29 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
30 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
O/P: -
31 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
32 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
33 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
out.println("</table>");
}catch(Exception ex){out.println(ex.getMessage());}
}
}
HelloWorld:
package com.mycompany.helloworldapplication;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.UriInfo;
import javax.ws.rs.Consumes;
import javax.ws.rs.Produces;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PUT;
import javax.ws.rs.core.MediaType;
@Path("generic")
public class HelloWorld {
@Context
private UriInfo context;
private String username;
34 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
@GET
@Produces(MediaType.TEXT_HTML)
public String getHtml() {
return username;
}
@PUT
@Consumes(MediaType.TEXT_HTML)
public void putHtml(String uname) {
this.username = uname;
}
}
O/P: -
35 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
namespace Practical8
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to
change the interface name "IService1" in both code and config file together.
[ServiceContract]
public interface IService1
{
[OperationContract]
int sum(int a, int b);
[OperationContract]
int Subtract(int a, int b);
[OperationContract]
int Multiply(int a, int b);
[OperationContract]
int Divide(int a, int b);
}
}
36 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
Service1.svc.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
namespace Practical8
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to
change the class name "Service1" in code, svc and config file together.
// NOTE: In order to launch WCF Test Client for testing this service, please
select Service1.svc or Service1.svc.cs at the Solution Explorer and start
debugging.
public class Service1 : IService1
{
public void DoWork()
{
}
public int sum(int a, int b)
{
return a + b;
}
37 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
{
return a * b;
}
O/P: -
38 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
Subtraction:
Addition:
39 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
Multiplication:
Division:
40 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Scripts>
<asp:ScriptReference Path="~/Service.svc" />
</Scripts>
</asp:ScriptManager>
</div>
<div class="auto-style1">
Enter UserName <asp:TextBox ID="TextBox1" runat="server"
Height="24px"></asp:TextBox> <br />
<br />
<asp:Button ID="Button1" runat="server" Height="24px"
OnClick="Button1_Click" Text="Button" />
<br />
<br />
<asp:Label ID="Label1" runat="server" Text="Welcome"
Height="24px"></asp:Label>
:
41 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
Default.aspx.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication4
{
public partial class Default : System.Web.UI.Page
{
Service1 ss = new Service1();
protected void Page_Load(object sender, EventArgs e)
{
42 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
Service1.svc:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.ServiceModel.Web;
using System.Text;
namespace WebApplication4
{
[ServiceContract(Namespace = "MCNSOLUTION")]
[AspNetCompatibilityRequirements(RequirementsMode =
AspNetCompatibilityRequirementsMode.Allowed)]
public class Service1
{
[OperationContract]
public void DoWork()
{
return;
}
[OperationContract]
public string MCNUSER(string UNAME)
{
return "HELLO MCN " + UNAME;
}
}
}
43 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
O/P: -
44 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
45 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
O/P: -
GetData:
46 Signature:
Sathish Pradhan Dnyanasadhana College, Thane [A.Y. 2022-2023]
Pratham A. Shinde WS Practical Journal Roll Number: -49
GetDataUsingDataContract:
Client.dll.config:
47 Signature: