labmanual updated 2012.pdf

82
 1 Ex.No: EXPERIMENTING C# .NET COMPONENT Date: AIM: To Develop Components Such As Order Processing,Payment Processing Using .Net PROCEDURE:  File New Project Class Library-(Name: computer).

Upload: orchid21

Post on 04-Apr-2018

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 1/82

  1

Ex.No: EXPERIMENTING C# .NET COMPONENT

Date:

AIM:

To Develop Components Such As Order Processing,Payment Processing Using .Net

PROCEDURE:

•  FileNewProjectClass Library-(Name: computer).

Page 2: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 2/82

  2

•  Enter the code below in the coding window opened.

•  Code:

using System;

using System.Collections.Generic;

using System.Text;

namespace computer

{

public class com

{int a;

public void display1()

{

Console.WriteLine("COMPUTERS");

Console.WriteLine("1.dell");

Console.WriteLine("2.hcl");

Console.WriteLine("3.lava");

Console.WriteLine("4.sony");Console.WriteLine("5.samsung");

}

}

}

•  Save Build Solution.

•  Create four more such class libraries of:

Com_det:

using System;

using System.Collections.Generic;

using System.Text;

Page 3: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 3/82

  3

namespace com_det

{

public class co_det{

int d;

string w;

public void detail3()

{

Console.WriteLine("SELECTED YOUR DESIRED COMPUTER");

w=Console.ReadLine();

d=int.Parse(w);switch (d)

{

case 1:

{

Console.WriteLine("YOU HAVE BEEN SELECTED DELL");

Console.WriteLine("ITEM ID:09");

Console.WriteLine("ITEM PRICE:34,000");

Console.WriteLine("MODEL:INSPIRON");

}

break;

case 2:

{

Console.WriteLine("YOU HAVE BEEN SELECTED HCL");

Console.WriteLine("ITEM ID:59");

Console.WriteLine("ITEM PRICE:24,000");

Console.WriteLine("MODEL:ASPIRE");

}

break;

case 3:

{

Console.WriteLine("YOU HAVE BEEN SELECTED LAVA");

Console.WriteLine("ITEM ID:05");

Console.WriteLine("ITEM PRICE:55,000");

Page 4: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 4/82

  4

Console.WriteLine("MODEL:LAVAW");

}break;

case 4:

{

Console.WriteLine("YOU HAVE BEEN SELECTED SONY");

Console.WriteLine("ITEM ID:75");

Console.WriteLine("ITEM PRICE:23,000");

Console.WriteLine("MODEL:DEVINE");}

break;

case 5:

{

Console.WriteLine("YOU HAVE BEEN SELECTED

SAMSUNG");

Console.WriteLine("ITEM ID:03");

Console.WriteLine("ITEM PRICE:65,000");Console.WriteLine("MODEL:GALLERY");

}

break;

case 6:

break;

}

}

}

}

Customer:

using System;

using System.Collections.Generic;

using System.Text;

namespace customer

Page 5: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 5/82

  5

{

public class cus

{string name;

string add;

string phno;

string email;

public void display()

{

int q;

string v;

Console.WriteLine("if you are conformed with this product fill thecustomer form");

Console.WriteLine("1.yes/2.no");

v=Console.ReadLine();

q=int.Parse(v);

switch(q)

{

case 1:{

Console.WriteLine("enter your name:");

name = Console.ReadLine();

Console.WriteLine("enter your address:");

add = Console.ReadLine();

Console.WriteLine("enter your phone number:");

phno = Console.ReadLine();

Console.WriteLine("enter your email id:");

email = Console.ReadLine();

Console.WriteLine("CHECK YOUR DETAILS");

Console.WriteLine("");

Console.WriteLine("NAME={0}", name);

Console.WriteLine("ADDRESS={0}", add);

Console.WriteLine("PHONE NUMBER={0}", phno);

Console.WriteLine("EMAIL ID={0}", email);

Page 6: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 6/82

  6

Console.WriteLine("");

Console.ReadLine();

}break;

case 2:

break;

}

}

}

}

Invoice:

using System;

using System.Collections.Generic;

using System.Text;

namespace invoice

{

public class inv

{public void display5()

{

Console.WriteLine("YOUR PRODUCT WILL BE DELIVERED ON

14.9.2011");

Console.ReadLine();

}

}}

OrderClass:

using System;

using System.Collections.Generic;

using System.Text;

namespace orderclass

Page 7: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 7/82

  7

{

public class Corder

{int s;

string f;

public void display4()

{

Console.WriteLine("select payment method");

Console.WriteLine("1.CHEQUE/2.CASH");

f = Console.ReadLine();

s = int.Parse(f);switch (s)

{

case 1:

{

Console.WriteLine("enter your account no:");

Console.ReadLine();

Console.WriteLine("name of bank:");

Console.ReadLine();

Console.WriteLine("your order conformed");

}

break;

case 2:

{

Console.WriteLine("your order conformed");

}

break;

case 3:

break;

}

}

}

}

Page 8: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 8/82

  8

•  FileNewProjectConsole ApplicationOk.

Code:

class Program

{

static void Main(string[] args)

{

string i;

int h;

Page 9: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 9/82

  9

Console.WriteLine("ONLINE SHOPPING");

Console.WriteLine("COMPUTER SALE");Console.WriteLine("1.VIEW CATALOGUE");

Console.WriteLine("2.EXIT");

Console.WriteLine("ENTER YOUR CHOICE");

i = Console.ReadLine();

h = int.Parse(i);

switch (h)

{

case 1:{

computer.com o2 = new computer.com();

o2.display1();

com_det.co_det O3 = new com_det.co_det();

O3.detail3();

customer.cus o1 = new customer.cus();

o1.display();

orderclass.Corder o4 = new orderclass.Corder();

o4.display4();

invoice.inv o5=new invoice.inv();

o5.display5();

Console.ReadLine();

}

break;

case 2:

break;

}

}

}

}

Page 10: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 10/82

  10

 

•  Solution ExplorerRight Click Project NameAdd ReferenceBrowse

TabProject NameBinDebugDll FileOk.

•  Add all five components as reference as above.

•  SaveRun.

Page 11: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 11/82

  11

 

OUTPUT:

Page 12: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 12/82

  12

Ex.No: Developing EJB Components

Date:

Aim:

To Create Components in EJB using EJB Componet Technology 

Procedure:

1. Creating a Project: 

In the NetBeans IDE 7.0, choose File –> New Project. In the New Project Dialog select the java

EE category, and choose Enterprise Application from the projects list. Then, Click Next.

Page 13: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 13/82

  13

In the Name and Location page, set the location where you want to create the web application,

and provide a name for the project. Click Next. 

Select GlassFish Server3.x & Java EE…

Page 14: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 14/82

  14

2. Creating a Bean

Give a name your choice (“simpleBean”) select “Stateless” as session type and give thepackage name as “stateless”. 

In the main tab, the simpleBean.java will be opened automatically..  

(1) SIMPLE INTREST

simpleBean.java

package stateless;

import javax.ejb.Stateless;

import javax.jws.WebService;

 /**

*

* @author XPPRESP3

*/ 

@Stateless

@WebService

public class simpleBean implements simpleRemote {

public int simpleint(int p, int n, int r) {

int si=p*n*r/100;

return si;

}

 // Add business logic below. (Right-click in editor and choose // "Insert Code > Add Business Method" or "Web Service > Add Operation")

}

Right Click simpleEJB, New–>Javaclass. Give name simpleRemote.

Page 15: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 15/82

  15

 

simpleRemote.java

package stateless;

import javax.ejb.Remote;

 /**

*

* @author XPPRESP3

*/ @Remote

public interface simpleRemote {

int simpleint(int p, int n, int r);

}

•  Deploy The Project

In web servie there is simpleBean and right click test web service

Page 16: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 16/82

  16

 

OUTPUT 

Page 17: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 17/82

  17

 

2 STUDENT REGISTER

stuEJBbean.java

package Stateless;

import javax.ejb.Stateless;

import javax.jws.WebService;

 /**

*

* @author XPPRESP3

*/ 

@Stateless

@WebService

public class stuEJBBean implements stuEJBRemote {

public int stureg(int sregno, String sname, int subj1, int subj2, int subj3) {

int total=subj1+subj2+subj3;

return total;

}

 // Add business logic below. (Right-click in editor and choose

 // "Insert Code > Add Business Method" or "Web Service > Add Operation")

}

Page 18: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 18/82

  18

 

Right Click simpleEJB, New–>Javaclass. Give name stuEJBRemote.

stuEJBRemote.java

package stateless;

import javax.ejb.Remote;

 /**

*

* @author XPPRESP3

*/ 

@Remote

public interface stuEJBRemote {

public int stureg(int sregno, String sname, int subj1, int subj2, int subj3);

}

Page 19: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 19/82

  19

 

OUTPUT

Page 20: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 20/82

  20

Ex.No: INVOKE .NET COMPONENTS AS WEB SERVICE

Date:

AIM:

To Develop .NET Components As Web Services.

Procedure:

Step 1: Open Microsoft visual studio 2010.

Step 2: Click On…File->New->Project

Select project Templates: Visual C# Projects->ASP.NET Web Service ApplicationClick Ok.

Page 21: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 21/82

  21

Step 3: Right click Service1.asmx

Click on view code

Enable the methods to use by removing comments and adding the new methods.

Code As Main Web Method:

[WebMethod]

public string mymailid(string firstname,string lastname)

{

String strjoin;

String[] inputstring=new String[2];

inputstring[0] = firstname;

inputstring[1] = lastname;

strjoin = string.Join("@", inputstring);return strjoin;

}

Step 4: Build solution 

Debug->start without debugging.

Page 22: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 22/82

  22

OUTPUT

Page 23: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 23/82

  23

 

Page 24: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 24/82

  24

Ex.No: INVOKE EJB COMPONENTS AS WEB SERVICES

Date:

AIM:

To create a web service for adding few numbers using NetBeans.

PROCEDURE:

STEPS TO CREATE ADDITION WEB SERVICE:

I.STEPS FOR CREATING SERVER SIDE PROJECT:

1.OPEN File->New->NewProject->Web->Web App..click next

Page 25: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 25/82

  25

2.Give Project Name->Addserver…then Click Finish

3.The addserver project will be created in right side.Right click it and choose the following.

Give the web service name as addweb.

Page 26: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 26/82

Page 27: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 27/82

  27

@WebService()

public class addweb {

 /**

* Web service operation

*/ 

@WebMethod(operationName = "add")

public int add(@WebParam(name = "a")

int a, @WebParam(name = "b")

int b) {

int k=a+b;

return k;

}

}

7.Then right click on add addserver and perform Deploy Operation…after that right click on

addweb and do test web service to see the SOAP request and response message.

Page 28: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 28/82

  28

Give some integers and click add.

Page 29: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 29/82

  29

Ex.No: CREATION OF A BPEL MODULE AND A COMPOSITE

Date: APPLICATION 

AIM:

To Create a SOA project with BPEL Module To Compose A Web Service.

PROCEDURE:

STEPS TO CREATE A BPEL MODULE

Creating a new BPEL Module Project

The following sections use the Synchronous sample project, and provide step-by-step directions

for creating a simple BPEL module project, using the Synchronous sample project.

To Create a BPEL Module Project

1.  In the NetBeans IDE, choose File > New Project.

The New Projects wizard appears.

2.  Under Categories, select Service Oriented Architecture.

3.  Under Projects, select BPEL Moduleand click Next.

Page 30: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 30/82

  30

4.  In the Name and Location page, enter the project name (for this example HelloWorld)

and specify the project location or accept the defaults.

5.  Click Finish.

The Projects window now contains a project node for the BPEL Module project.

Creating a BPEL Process Using the BPEL Designer

Now that you have created your XML Schema and WSDL Document, you can create your BPEL

process.

To Create the BPEL Process

Page 31: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 31/82

  31

1.  In the Projects window, expand your BPEL module project node, right-click the Process

Files node, and choose New -> BPEL Process.

The New BPEL Process dialog box appears.

2.  Enter a name for the process file name (HelloWorldProcess for this example), and click Finish.

The new BPEL file opens in the Design view of the BPEL Designer.

If the Palette and Properties windows are not displayed in your current view, click Windows ->

Reset Windows on the NetBeans menu.

Page 32: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 32/82

  32

 

3.  Add a partner link to the BPEL Process.

a.  In the Projects window, expand your project's Process Files node and select the

.wsdl file (Synchronous.wsdl for this example).b.  Drag the WSDL file from the Projects window to the left side of the Design view

canvas.

The IDE provides visual prompts to show you where you can drop the selection.

The BPEL Editor adds a partner link to the canvas.

Page 33: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 33/82

  33

 

4.  Add a Receive activity to the BPEL Process.

a.  From the Web Service section of the Palette window, select the Receive activity.

b.  Drag the Receive activity to the HelloWorldProcess process box in the Design

view canvas, between the Process Start and the Process End activities.The Receive1 activity is added to the process box.

c.  Click the Receive1 activity's Edit icon.

The Receive1 Property Editor appears.

d.  On the Main tab, change the value in the Name field to start.e.  From the Partner Link drop-down list, choose PartnerLink1.

The IDE populates the Operation field with NewWSDLOperation.

f.  Click the Create button next to the Input Variable Field.

The New Input Variable dialog box appears.

g.  Click OK to accept the default values.

h.  Click OK to close the Receive1 Property Editor.

The Design view displays the new connection between PartnerLink1 and the Start activity in the

process box.

Page 34: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 34/82

  34

 

5.  Add a Reply activity to the BPEL Process.

a.  Select the Reply activity in the Web Service section of the Palette. Drag and dropthe Reply to the prompt between the Start activity and the Process End activity in

the process box on the design view canvas.

A Reply1 activity is added to the design view canvas.

b.  Click the Reply1 activity's Edit icon.

The Reply1 Property Editor appears.

c.  On the Main tab, change the value in the Name field to End.d.  From the Partner Link drop-down list, choose PartnerLink1.

The IDE populates the Operation field with NewWSDLOperation.

e.  To create anew output variable, make sure that Normal Response is selected, and

click the Create button next to the Input Variable Field.

The New Input Variable dialog box appears. Click OK to accept the default values.

f.  Click OK to close the Reply1 Property Editor.

The Design view displays the new connection between the End activity in the process box and

PartnerLink1.

Page 35: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 35/82

  35

 

6.  Add a Assign activity to the BPEL Process.a.  Select the Assign activity in the Basic Activities section of the Palette. Drag and

drop the Assign to the prompt between the Start activity and the End activity in

the process box on the design view canvas.

The Assign1 activity is added to the design view canvas.

b.  Select the Assign1 activity and click the Mapper button on the editors toolbar.

The BPEL Mapper appears.

c.  Map the paramA node under Variables -> NewWSDLOperationIn -> inputType

in the Output pane of the BPEL Mapper, to the paramA node under Variables ->

NewWSDLOperationOut -> resultType in the Input pane of the Mapper. To dothis, select theparamA node under Variables -> NewWSDLOperationIn ->inputType in the Output pane, and drag your cursor to the paramA node under

Variables -> NewWSDLOperationOut -> resultType in the Input pane.

This assignment copies the input statement into the output.

Page 36: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 36/82

  36

 

7. 

To save your changes click the Save All icon in the IDE menu bar.Creating a Composite Application Project

A BPEL Module project is not directly deployable. You must first add a BPEL Module project,

as a JBI module, to a Composite Application project. You can then deploy the Composite

Application project. Deploying the project makes the service assembly available to the

application server and enables its service units to run.

To Create a New Composite Application Project

1.  Choose File > New Project (Ctrl-Shift-N).

2. 

In the Categories list choose Service Oriented Architecture, in the Projects list chooseComposite Application, and click Next.

3.  In the Name and Location page, change the project name to HelloWorldApplication, and

specify the location of project files.4.  To set the new Composite Application the main project as main, leave the Set as Main

Project checkbox selected, and click Finish.

5.  To add the BPEL Module as a JBI module to the Composite Application project, right-

click the new Composite Application and choose Add JBI Module.

The Select Project dialog box opens.

6.  Select the HelloWorld project you created earlier and click Add Project JAR Files.

The Select Project dialog box closes and the HelloWorld.jar file is added to the JBI Modules

node of the HelloWorldApplication Composite Application

Building and Deploying the Composite Application Project

Building a project compiles the BPEL source file and packages the BPEL file and web service

artifacts, including WSDL and XSD files, into a JAR archive. Deploying the project compiles

the files in the Composite Application project, packages the compiled BPEL and related web

service artifacts (including WSDL and XSD files) into an archive, and deploys them to the

Application Server.

Page 37: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 37/82

  37

To Build and Deploy the Composite Application Project

1.  Right-click the Composite Application project's node, and choose Build.

When the build is complete the Output window reports Build Successful. If the Output window

is not visible, choose Window -> Output -> Output.

2.  Right-click the Composite Application project's node, and choose Deploy.3.  Deployment has succeeded when you see a Build successful message in the GlassFish tab

of the Output window.

4.  Open the Services window and expand Servers -> GlassFish V2 -> JBI -> Service

Assemblies to see your new deployed Service Assembly.

If you do not see the deployed project, right-click the Service Assemblies node and choose

Refresh.

Testing the Composite Application

You can test your Composite Application project by adding test cases, binding to the operation,

supplying input, and then using the tester.

Test the HelloWorldApplication Composite Application Project

1.  In the Projects window, expand the HelloWorldApplication project node, right-click theTest node, and choose New Test Case.

The New Test Case wizard opens.

2.  Accept the default test case name, TestCase1, and click Next.

3.  From the Select the WSDL Document page, expand the HelloWorld - Proecss Files node,

select Synchronous.wsdl, and click Next.

4.  From the Select the Operation to Test page, select the Operation1 and click Finish.

Page 38: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 38/82

Page 39: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 39/82

  39

When the Overwrite Empty Output dialog box appears, click Yes to accept new output. The first

test run populates the Output.xml file displayed in the Source Editor.

The test compares the output to the contents of the output file. Because the first run of the test

has nothing to compare itself to, the first test fails. Subsequent test runs will compare their output

with the contents of Output.xml and should succeed.

8.  Run the test again.

The test case is compared to the current output file and succeeds.

Page 40: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 40/82

  40

Ex.No: DEVELOP A J2EE CLIENT TO ACCESS A .NET WEB SERVICE

Date:

AIM:To Development of a J2EE Application for consuming the .NET web service.

Procedure:

Step 1: Open Microsoft visual studio 2010.

Step 2: Click On….File->New->Project

Select Project Templates:Visual C# Projects->ASP.Net Web Service ApplicationClick ok.

Step 3: Right click Service1.asmx

Click on view code

Page 41: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 41/82

  41

Enable the methods to use by removing comments and adding the new methods.

Code As Main Web Method:

[WebMethod]

public string mymailid(string firstname,string lastname)

{

String strjoin;

String[] inputstring=new String[2];

inputstring[0] = firstname;

inputstring[1] = lastname;

strjoin = string.Join("@", inputstring);return strjoin;

}

Step 4: Build Solution

Debug->Start Without Debugging.

Page 42: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 42/82

  42

 

Copy The Wsdl Link.

Page 43: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 43/82

  43

 

Step 5: In NetBeans IDE 7.0,Creating Web Service Client

Click on New -> New Web Service Client 

Page 44: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 44/82

  44

Paste The Wsdl Link

Give the name of the package

Click finish

Step 6: Browse the file “index.jsp”

Right Click->Select Call Web Service

Select the operation and click ok 

Write the required code

This creates the client

Step 7: Right Click the index.jsp and run.

Page 45: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 45/82

  45

Client Code:

<%@page contentType="text/html" pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>JSP Page</title>

</head>

<body>

<h2>Hello World!</h2><%-- start web service invocation --%><hr/>

<% try {

Man.Service1 service = new Man.Service1();Man.Service1Soap port = service.getService1Soap();

 // TODO initialize WS operation arguments here java.lang.String firstname = "deepu7";

 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 --%><hr/>

</body>

</html>

Page 46: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 46/82

  46

OUTPUT:

Page 47: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 47/82

  47

Ex.No: .NET CLIENT TO ACESS A J2EE WEBSERVICE

Date:

AIM:

To develop .Net Client To Acess A J2EE Web Service

PROCEDURE:

Create a Java Web Service (Java EE, JAX-WS)

1. Create a new Web Application

In the NetBeans IDE 7.0, choose File –> New Project. In the New Project Dialog select theWeb category, and choose Web Application from the projects list. Then, Click Next.

In the Name and Location page, set the location where you want to create the web application,

and provide a name for the project. Click Next. 

In the Server and Settings page, leave the default settings (Java EE 5, Use GlassFish V3) and

Click Finish.

Page 48: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 48/82

  48

 

This creates the initial web application and opens the project for editing.

2. Create the Web Service

Add a new web service to the project. Right click the project node and choose

New –> Web Service.

* Notice that the location of the Web Service option in the menu may change from this imageand your IDE.

In the New Web Service dialog, provide the Web Service Name, and the Package. The name of 

the service will affect the final URL For Calling The Service, and the package name will be the

namespace of the service contract. Click Finish.

Page 49: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 49/82

  49

 

The Web Service now appears in the project tree.

To implement the service, double click the service node in the project tree (in the figure above –

CalculatorService). This will open the Web Service in Design mode, that lets you graphically

design your service.

Change to Source View by clicking on the Source button in the upper toolbar, and this will open

CalculatorService.Java file for editing. Here is a sample implementation of the service.

Page 50: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 50/82

  50

Notice how Java Annotations are similar to .Net Attributes, especially how similar they are to

the Web Services attributes we know…

“CalculatorService.Java”  

package org.bursteg.calculator;

import javax.jws.WebMethod;

import javax.jws.WebParam;

import javax.jws.WebService;

@WebService

public class CalculatorService

{

@WebMethod

public int Add(@WebParam(name="a") int a,

@WebParam(name="b") int b)

{

return a + b;

}

}

Deploy the web service to the web application server. From the NetBeans IDE this is done by

right clicking the project node, and choosing Undeploy and Deploy.

Page 51: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 51/82

  51

 

After the web application has been deployed, just to make sure the web service works as

expected, you can right click the web service node, and choose Test Web Service.

This will open the browser and navigate to a test page with the url of the service

(http://localhost:8080/Calculator/CalculatorServiceService?Tester suffix.)

Page 52: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 52/82

  52

Call the Java Web Service from a .Net Client

In Visual Studio 2010, Create A New Console Application.

This creates a new solution with a single Console Application project in it.

Right click the project node and choose Add Service Reference.

In the Add Service Reference Dialog, paste the address of the service metadata endpoint

(http://localhost:8080/Calculator/CalculatorServiceService?wsdl ), and click Go. The dialog will

get the service metadata and understand the service contract.

Page 53: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 53/82

  53

 

Provide a namespace for the service reference, and click OK.

This will generate the client side proxy that lets you consume the service easily, and the required

configuration settings into the configuration file.

To call the service using the generated client side proxy, open Program.cs and use the following

code:

static void Main(string[] args)

{

CalculatorService.CalculatorServiceClient proxy = new 

CalculatorService.CalculatorServiceClient();

int result = proxy.Add(2, 3);

Console.WriteLine("Calculator Service returned: " + result.ToString());

}

Page 54: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 54/82

  54

Run the program and see that the web service is being called and the result is correct.

Page 55: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 55/82

  55

Ex.No: JAVA WEB SERVICE AND INVOKE IT FROM ASP.NET

Date: APPLICATION

AIM:

To create Java web service and invoke it from ASP.Net application

PROCEDURE:

Create a Java Web Service:

There are a few steps involved in developing a web service using it. These steps can be

summarized as follows:

Create a web application project.

Add web service to the project.

Add operations to the web service.

Implementing the web methodes.

Deploy and test the web service.

Step 1. Create a web application project

In Netbeans IDE 7.0,Go To File->New Project. The New Project wizard opens.

Select the web from categories options and web application from project section and then press

the next button.

(i.e.,Java Web->Web Application)

Figure One: Create New Project Step 1

Page 56: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 56/82

  56

On the next screen mention the project name, select the project location. We can also mention

the server name in which we want to deploy our web application as well we can change thedefault context path.

Here we mention the project name JSimpCalcWebService and keep the context path same as

project name. We use GlassFish V2 application server for deployment.

Figure Two: Create New Project Step 2

Now, click the finish button.

Step 2. Add web service to the project

Page 57: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 57/82

  57

Right click on the project name in the Projects explorer window.

Figure Three: Web Service Menu Option

From the context menu options select the Web Service menu. A web service dialog opens.

Figure Four: Add New Web Service

Mention the web service name and the package name as mentioned in the image below, and thenclick the finish button.

In our example the web service name is JSimpCalcWebService and the package name is calc.ws.

Step 3. Add operations to the web service

Page 58: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 58/82

  58

After we add web service to our application, now it's time to add web service operation or

WebMethod. We can do it in two possible ways one is through design mode and another isthrough source mode. In our example we use design mode for creating skeleton of WebMethod

in easiest way.

Figure Five: Add Operation To Web Service 

As we can see from highlighted section in the figure five we can add web service operations by

clicking Add Operation button. It opens a Add Operation dialog box. Please refer to figure six.

Figure Six: Add Parameters To Web Operation 

In the Add Operation dialog we must mention name (which is actually a WebMethod name).

We can also enter parameter names and their types (these parameter are known as WebParam).

In the figure six we mention the WebMethod name as addition whose return type is

 java.lang.String and it takes two parameters (parameter1. and parameter2) of type double.

Page 59: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 59/82

  59

Similarly we create other operations as well like subtraction, multiplication, division, power,

maximum, minimum.

Step 4: Implementing the web methodes

Once we finish step three, a basic structure of our web service should be ready. Then we switch

from design mode to source mode as shown in figure seven to do rest of the implementation.

Figure Seven: Write The Code For The Web Service 

The code should look like as follows:

Collapse | Copy Code

package calc.ws;

import javax.jws.WebMethod;

import javax.jws.WebParam;

import javax.jws.WebService;

import calc.util.NumberFormater;

 /**

* @author Bikash Shaw

*/ 

@WebService()

public class JSimpCalcWebService {

 /**

* Web service operation

*/ 

@WebMethod(operationName = "addition")

public String addition(@WebParam(name = "parameter1")

double parameter1, @WebParam(name = "parameter2")

Page 60: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 60/82

  60

double parameter2) {

 //TODO write your implementation code here:

return NumberFormater.format((parameter1 + parameter2),0,6);

}

 /**

* Web service operation

*/ 

@WebMethod(operationName = "subtraction")

public String subtraction(@WebParam(name = "parameter1")

double parameter1, @WebParam(name = "parameter2")

double parameter2) {

 //TODO write your implementation code here:

return NumberFormater.format((parameter1 - parameter2),0,6);

}

 /**

* Web service operation

*/ @WebMethod(operationName = "multiplication")

public String multiplication(@WebParam(name = "parameter1")

double parameter1, @WebParam(name = "parameter2")

double parameter2) {

 //TODO write your implementation code here:

return NumberFormater.format((parameter1 * parameter2),0,6);

}

 /**

* Web service operation

*/ 

@WebMethod(operationName = "division")

public String division(@WebParam(name = "parameter1")

double parameter1, @WebParam(name = "parameter2")

Page 61: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 61/82

  61

double parameter2) {

 //TODO write your implementation code here:

return NumberFormater.format((parameter1 / parameter2),0,6);

}

 /**

* Web service operation

*/ 

@WebMethod(operationName = "power")

public String power(@WebParam(name = "parameter1")

double parameter1, @WebParam(name = "parameter2")

double parameter2) {

 //TODO write your implementation code here:

return NumberFormater.format(Math.pow(parameter1, parameter2),0,6);

}

 /**

* Web service operation*/ 

@WebMethod(operationName = "maximum")

public String maximum(@WebParam(name = "parameter1")

double parameter1, @WebParam(name = "parameter2")

double parameter2) {

 //TODO write your implementation code here:

return NumberFormater.format(Math.max(parameter1, parameter2),0,6);

}

 /**

* Web service operation

*/ 

@WebMethod(operationName = "minimum")

public String minimum(@WebParam(name = "parameter1")

Page 62: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 62/82

  62

double parameter1, @WebParam(name = "parameter2")

double parameter2) {

 //TODO write your implementation code here:

return NumberFormater.format(Math.min(parameter1, parameter2),0,6);

}

}

Source One: Java JSimpCalcWebService.java Web Service Source Code

Here we use NumberFormater.format(double number, int minFractionDigits,

int maxFractionDigits) method to format the double value to java.lang.String up to six decimalpoint. Refer to the source two.

Collapse | Copy Code

package calc.util;

import java.text.NumberFormat;

 /**

Page 63: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 63/82

  63

 

public class NumberFormater {

public static String format(double number, int minFractionDigits,

int maxFractionDigits) {

NumberFormat format = NumberFormat.getInstance();

format.setMaximumFractionDigits(maxFractionDigits);

format.setMinimumFractionDigits(minFractionDigits);

return format.format(number);

}

}

Source Two: NumberFormater.java Source Code

Step 5. Deploy and test the web service

Now our web service is ready deployment and test. With Netbeans 6 it can achieved very with

few steps. First make sure that the GlassFish server is running. To start the server we need toperform the following steps.

Go to Services explorer window.

Expand the Servers node.

Right click on the server name (in our case its GlassFish V2). A context menu pops up.

Select Start from the menu options.

Figure Eight: Start GlassFish V2 Application Server 

Now, as our server is running it's time to deploy the application and test the web service that we

have developed. Netbeans does the deployment for us with few mouse clicks, mentioned as

follows:

Go to Projects explorer window.

Page 64: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 64/82

  64

Expand the Web Services node.

Right click on the web services name (in our case its JSimpCalcWebService). A context menu

pops up.

Click the Test Web Service menu.

Figure Nine: Test Web Service 

The above mentioned steps deploy the application and lunch the default browser in which theweb service can be tested via SOAP request and response. Please refer to the figure ten for

sample output. We can also view the WSDL (Web Services Description Language) file by

clicking on the hyperlink.

Page 65: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 65/82

  65

 Figure Ten: Test Web Service

Alternatively we can test the web service and view its WSDL document through our GlassFish

application server’s admin consol as shown in figure eleven.

Figure Eleven: Test Web Service via Admin Consol

Once we click on the View WSDL link we can view a XML file for describing our web service.

The WSDL file should look like the figure twelve.

Page 66: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 66/82

  66

 Figure Twelve: WSDL File

The URL shown at the address bar will require invoking the web service. We shall demonstrate

its usage during creating of our web application using ASP.net.

Create ASP.net Web Site Using C#:

Now, our web service is ready to get invoked from non Java based development platform. In this

article we develop a sample ASP.net based client. Using Visual Studio 2008 it can be achieved infew steps, which can be summarized as follows:

Create ASP.net web site.

Add web reference.

Write code to invoke web service.

Test web service client application.

Step 1. Create ASP.net web site

Start Visual Studio 2008; go to the New →Web Site… which is available under File menu.

Page 67: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 67/82

  67

 Figure Thirteen: New Web Site Window 

Select ASP.net Web Site.

Select the folder in which we want to create the web site. In our case it’sJSimpCalcWebServiceWebSite

Select the language Visual C# and click OK button.

Step 2. Add web reference

Now we need to mention the WSDL file in our web site. To add the web service reference we

must perform the following steps:

Go to Solution Explorer window.

Right click on the project name (in our case its JSimpCalcWebServiceWebSite). A context menu

pops up.

Click the Add Web Reference menu. The Add Web Reference dialog opens.

Page 68: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 68/82

  68

 Figure Fourteen: Add Web Reference Context Menu 

Copy and paste the WSDL URL from our web brower’s address bar (refer to figure twelve) toAdd Web Reference dialog’s address bar and press go button (refer to figure fifteen).

Figure Fifteen: Add Web Reference Dialog 

We can see all the methods names of our web service. Give a name to the web reference (in this

example its JSimpCalcWebService) and click the Add Reference button.

Step 3. Write code to invoke web service

Using C# we can very easily invoke the web service with few lines of code:

We first design an ASP.net page. The default fie name is Default.aspx (the source is available inzip file).

Page 69: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 69/82

  69

Induce the web reference in to our code (i.e. Default.aspx.cs). For example:

using JSimpCalcWebServiceService;

Next, create the object of the web reference.

JSimpCalcWebServiceService.JSimpCalcWebServiceService proxy = new

JSimpCalcWebServiceService.JSimpCalcWebServiceService();

Now, we can access the WebMethod like any other method call. For example:

proxy.addition(10,20);

Code for Aspx.cs file

using System;

using System.Configuration;

using System.Data;

using System.Linq;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.HtmlControls;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Xml.Linq;

using JSimpCalcuWSService;

public partial class _Default : System.Web.UI.Page

{

JSimpCalcuWSService.JSimpCalcuWS proxy;

protected void Page_Load(object sender, EventArgs e)

{

Page 70: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 70/82

  70

proxy = new JSimpCalcuWSService.JSimpCalcuWS();

}

protected void btnAddition_Click(object sender, EventArgs e)

{

try

{

lblResultAddition.Text = "Result: " + proxy.addition(int.Parse(txtAdditionx.Text),

int.Parse(txtAdditiony.Text));

}

catch (FormatException)

{

lblResultAddition.Text = "Result: Invalide Input";

}

UpdatePanelAddition.Update();

}

protected void btnSubtraction_Click(object sender, EventArgs e)

{

try

{ lblResultSubtraction.Text = "Result: " +

proxy.subtraction(int.Parse(txtSubtractionx.Text), int.Parse(txtSubtractiony.Text));

}

catch (FormatException)

{

lblResultSubtraction.Text = "Result: Invalide Input";

}

UpdatePanelSubtraction.Update();

Page 71: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 71/82

  71

}

protected void btnMultiplication_Click(object sender, EventArgs e)

{

try

{

lblResultMultiplication.Text = "Result: " +

proxy.multiplication(int.Parse(txtMultiplicationx.Text), int.Parse(txtMultiplicationy.Text));

}

catch (FormatException)

{

lblResultMultiplication.Text = "Result: Invalide Input";

}

UpdatePanelMultiplication.Update();

}

protected void btnDivision_Click(object sender, EventArgs e)

{

try

{

lblResultDivision.Text = "Result: " + proxy.division(int.Parse(txtDivisionx.Text),

int.Parse(txtDivisiony.Text));

}

catch (FormatException)

{

lblResultDivision.Text = "Result: Invalide Input";

}

Page 72: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 72/82

  72

UpdatePanelDivision.Update();

}

protected void btnMaximum_Click(object sender, EventArgs e)

{

try

{

lblResultMaxMin.Text = "Result: " + proxy.maximum(int.Parse(txtMaxMinx.Text),

int.Parse(txtMaxMiny.Text));

}

catch (FormatException)

{

lblResultMaxMin.Text = "Result: Invalide Input";

}

UpdatePanelMaxMin.Update();

}

protected void btnMinimum_Click(object sender, EventArgs e)

{

try

{

lblResultMaxMin.Text = "Result: " + proxy.minimum(int.Parse(txtMaxMinx.Text),

int.Parse(txtMaxMiny.Text));

}

catch (FormatException)

{

lblResultMaxMin.Text = "Result: Invalide Input";

Page 73: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 73/82

  73

}

UpdatePanelMaxMin.Update();

}

protected void btnPower_Click(object sender, EventArgs e)

{

try

{

lblResultPower.Text = "Result: " + proxy.power(int.Parse(txtPowerx.Text),

int.Parse(txtPowery.Text));

}

catch (FormatException)

{

lblResultPower.Text = "Result: Invalide Input";

}

UpdatePanelPower.Update();

}

}

Code for Aspx file

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="JSimpcalc.aspx.cs"

Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head id="Head1" runat="server">

Page 74: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 74/82

  74

<title>Java simple Calculation Example</title>

</head>

<body>

<form id="form1" runat="server">

<asp:scriptmanager ID="Mano" runat="server"></asp:scriptmanager>

<asp:Table ID="Table1" runat="server" Width="372px" BorderWidth="1"

BorderStyle="Solid" Height="70px" HorizontalAlign="Left">

<asp:TableRow ID="TableRow1" runat="server">

<asp:TableCell ID="TableCell1" runat="server" ColumnSpan="3"

HorizontalAlign="Center" ForeColor="Blue" Font-Bold="true">

<asp:UpdatePanel ID="UpdatePanelAddition" runat="server" RenderMode="Inline">

<ContentTemplate>

<asp:Table ID="Table2" runat="server" Width="372px" BorderWidth="1"

BorderStyle="Solid" Caption="ADDITION">

<asp:TableRow ID="TableRow2" runat="server">

<asp:TableCell ID="TableCell2" runat="server">

<asp:Label ID="Label1" runat="server" Text="First Parameter">

<asp:TextBox ID="txtAdditionx" runat="server"

MaxLength="10"></asp:TextBox>

</asp:Label><br/>

<asp:Label ID="Label2" runat="server" Text="Scnd Parameter">

<asp:TextBox ID="txtAdditiony" runat="server"

MaxLength="10"></asp:TextBox>

</asp:Label><br/>

<asp:Label ID="Label3" runat="server"

Text="Result"><asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

<asp:Button ID="lblResultAddition" runat="server"

Text="Compute" OnClick="btnAddition_Click"></asp:Button>

Page 75: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 75/82

  75

</asp:Label>

</asp:TableCell>

</asp:TableRow>

</asp:Table>

</ContentTemplate>

</asp:UpdatePanel>

</asp:TableCell>

</asp:TableRow>

</asp:Table>

<asp:Table ID="Table3" runat="server" Width="372px" BorderWidth="1"

BorderStyle="Solid" Height="70px" HorizontalAlign="Justify">

<asp:TableRow ID="TableRow3" runat="server">

<asp:TableCell ID="TableCell3" runat="server" ColumnSpan="3"

HorizontalAlign="Center" ForeColor="Blue" Font-Bold="true">

<asp:UpdatePanel ID="UpdatePanelSubtraction" runat="server" RenderMode="Inline">

<ContentTemplate>

<asp:Table ID="Table4" runat="server" Width="372px" BorderWidth="1"

BorderStyle="Solid" Caption="SUBTRACTION">

<asp:TableRow ID="TableRow4" runat="server">

<asp:TableCell ID="TableCell4" runat="server">

<asp:Label ID="Label4" runat="server" Text="First Parameter"></asp:Label>

<asp:TextBox ID="txtSubtractionx" runat="server"

MaxLength="10"></asp:TextBox>

<br/>

<asp:Label ID="Label5" runat="server" Text="Scnd

Parameter"></asp:Label>

Page 76: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 76/82

  76

<asp:TextBox ID="txtSubtractiony" runat="server"

MaxLength="10"></asp:TextBox>

<br/>

<asp:Textbox ID="lblResultSubtraction"

runat="server"></asp:Textbox>

<asp:Button ID="Button1" runat="server" Text="Compute"

OnClick="btnSubtraction_Click"></asp:Button>

</asp:TableCell>

</asp:TableRow>

</asp:Table>

</ContentTemplate>

</asp:UpdatePanel>

</asp:TableCell>

</asp:TableRow>

</asp:Table>

<asp:Table ID="Table5" runat="server" Width="372px" BorderWidth="1"

BorderStyle="Solid" Height="70px" HorizontalAlign="Left">

<asp:TableRow ID="TableRow5" runat="server">

<asp:TableCell ID="TableCell5" runat="server" ColumnSpan="3"

HorizontalAlign="Center" ForeColor="Blue" Font-Bold="true">

<asp:UpdatePanel ID="UpdatePanelMultiplication" runat="server"

RenderMode="Inline">

<ContentTemplate>

<asp:Table ID="Table6" runat="server" Width="372px" BorderWidth="1"

BorderStyle="Solid" Caption="MULTIPLICATION">

<asp:TableRow ID="TableRow6" runat="server">

<asp:TableCell ID="TableCell6" runat="server">

<asp:Label ID="Label7" runat="server" Text="First Parameter">

Page 77: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 77/82

  77

<asp:TextBox ID="txtMultiplicationx" runat="server"

MaxLength="10"></asp:TextBox>

</asp:Label><br/>

<asp:Label ID="Label8" runat="server" Text="Scnd Parameter">

<asp:TextBox ID="txtMultiplicationy" runat="server"

MaxLength="10"></asp:TextBox>

</asp:Label><br/>

<asp:Label ID="lblResultMultiplication" runat="server"

Text="Result"><asp:TextBox ID="TextBox7" runat="server"></asp:TextBox>

<asp:Button ID="Button2" runat="server" Text="Compute"

UseSubmitBehavior="true"></asp:Button>

</asp:Label>

</asp:TableCell>

</asp:TableRow>

</asp:Table>

</ContentTemplate>

</asp:UpdatePanel>

</asp:TableCell>

</asp:TableRow>

</asp:Table>

<asp:Table ID="Table7" runat="server" Width="372px" BorderWidth="1"

BorderStyle="Solid" Height="70px" HorizontalAlign="Justify">

<asp:TableRow ID="TableRow7" runat="server">

<asp:TableCell ID="TableCell7" runat="server" ColumnSpan="3"

HorizontalAlign="Center" ForeColor="Blue" Font-Bold="true">

<asp:UpdatePanel ID="UpdatePanelDivision" runat="server" RenderMode="Inline">

<ContentTemplate>

Page 78: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 78/82

  78

<asp:Table ID="Table8" runat="server" Width="372px" BorderWidth="1"

BorderStyle="Solid" Caption="DIVISION">

<asp:TableRow ID="TableRow8" runat="server">

<asp:TableCell ID="TableCell8" runat="server">

<asp:Label ID="Label10" runat="server" Text="First Parameter">

<asp:TextBox ID="txtDivisionx" runat="server"

MaxLength="10"></asp:TextBox>

</asp:Label><br/>

<asp:Label ID="Label11" runat="server" Text="ScndParameter">

<asp:TextBox ID="txtDivisiony" runat="server"

MaxLength="10"></asp:TextBox>

</asp:Label><br/>

<asp:Label ID="lblResultDivision" runat="server"

Text="Result"><asp:TextBox ID="TextBox10" runat="server"></asp:TextBox>

<asp:Button ID="Button3" runat="server" Text="Compute"UseSubmitBehavior="true"></asp:Button>

</asp:Label>

</asp:TableCell>

</asp:TableRow>

</asp:Table>

</ContentTemplate>

</asp:UpdatePanel>

</asp:TableCell>

</asp:TableRow>

</asp:Table>

<asp:Table ID="Table9" runat="server" Width="372px" BorderWidth="1"

BorderStyle="Solid" Height="70px" HorizontalAlign="Left">

Page 79: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 79/82

  79

<asp:TableRow ID="TableRow9" runat="server">

<asp:TableCell ID="TableCell9" runat="server" ColumnSpan="3"

HorizontalAlign="Center" ForeColor="Blue" Font-Bold="true">

<asp:UpdatePanel ID="UpdatePanelPower" runat="server" RenderMode="Inline">

<ContentTemplate>

<asp:Table ID="Table10" runat="server" Width="372px" BorderWidth="1"

BorderStyle="Solid" Caption="POWER">

<asp:TableRow ID="TableRow10" runat="server">

<asp:TableCell ID="TableCell10" runat="server">

<asp:Label ID="Label13" runat="server" Text="First Parameter">

<asp:TextBox ID="txtPowerx" runat="server"

MaxLength="10"></asp:TextBox>

</asp:Label><br/>

<asp:Label ID="Label14" runat="server" Text="Scnd

Parameter">

<asp:TextBox ID="txtPowery" runat="server"

MaxLength="10"></asp:TextBox>

</asp:Label><br/>

<asp:Label ID="lblResultPower" runat="server"

Text="Result"><asp:TextBox ID="TextBox13" runat="server"></asp:TextBox>

<asp:Button ID="Button4" runat="server" Text="Compute"

UseSubmitBehavior="true"></asp:Button>

</asp:Label>

</asp:TableCell>

</asp:TableRow>

</asp:Table>

</ContentTemplate>

</asp:UpdatePanel>

Page 80: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 80/82

  80

</asp:TableCell>

</asp:TableRow>

</asp:Table>

<asp:Table ID="Table11" runat="server" Width="372px" BorderWidth="1"

BorderStyle="Solid" Height="70px" HorizontalAlign="Justify">

<asp:TableRow ID="TableRow11" runat="server">

<asp:TableCell ID="TableCell11" runat="server" ColumnSpan="3"

HorizontalAlign="Center" ForeColor="Blue" Font-Bold="true">

<asp:UpdatePanel ID="UpdatePanelMaxMin" runat="server" RenderMode="Inline">

<ContentTemplate>

<asp:Table ID="Table12" runat="server" Width="372px" BorderWidth="1"

BorderStyle="Solid" Caption="MAX_MIN">

<asp:TableRow ID="TableRow12" runat="server">

<asp:TableCell ID="TableCell12" runat="server">

<asp:Label ID="Label16" runat="server" Text="First Parameter">

<asp:TextBox ID="txtMaxMinx" runat="server"

MaxLength="10"></asp:TextBox>

</asp:Label><br/>

<asp:Label ID="Label17" runat="server" Text="Scnd

Parameter">

<asp:TextBox ID="txtMaxMiny" runat="server"

MaxLength="10"></asp:TextBox>

</asp:Label><br/>

<asp:Label ID="lblResultMaxMin" runat="server"

Text="Result"><asp:TextBox ID="TextBox16" runat="server"></asp:TextBox>

<asp:Button ID="Button5" runat="server" Text="Compute"

UseSubmitBehavior="true"></asp:Button>

</asp:Label>

Page 81: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 81/82

  81

</asp:TableCell>

</asp:TableRow>

</asp:Table>

</ContentTemplate>

</asp:UpdatePanel>

</asp:TableCell>

</asp:TableRow>

</asp:Table>

</form>

</body>

</html>

Figure Sixteen: Web Methods Invocation Code

Source Three: Default.aspx.cs Source Code

Step 4. Test web service client application

Now, it's time to test our web service client application by clicking on the Start Debugging

toolbar button or by pressing F5 key. The web page should look like the figure below.

Page 82: labmanual updated 2012.pdf

7/30/2019 labmanual updated 2012.pdf

http://slidepdf.com/reader/full/labmanual-updated-2012pdf 82/82

OUTPUT