Вы находитесь на странице: 1из 73

www.Vidyarthiplus.

com

Vijayamangalam,Tirupur-638056

Department of
INFORMATION TECHNOLOGY
IT2406-SERVICE ORIENTED ARCHITECTURE

LABORATORY RECORD
NAME: ROLL NO:.
CLASS:... BRANCH:..

University Register No.

Certified that this is a bonafide record of work done by the above student during
the year 20 -20

Staff in-Charge

Head of the Department

Submitted for the University Practical Examination held on

Internal Examiner

External Examiner

www.Vidyarthiplus.com

www.Vidyarthiplus.com

INDEX
EX NO
01(a)
01(b)
01(c)
01(d)
01(e)
02(a)
02(b)
02(c)
02(d)
02(e)
03
04

DATE

EXPREMENTS
TIME STAMP COMPONENT
USING .NET
INTEREST CALCULATION
COMPONENT USING .NET
ORDER PROCESSING
COMPONENT USING .NET
TEMPERATURE CONVERSION
COMPONENT USING .NET
CURRENCY CONVERTER
COMPONENT USING .NET
ORDERPROCESSING
COMPONENT USING EJB
INTEREST CALCULATION
COMPONENT USING EJB
PAYMENT PROCESSING
COMPONENT USING EJB
TEMPERATURECONVERSION
COMPONENT USING EJB
FINDING POWER ALUE
COMPONENT USING EJB
INVOKE .NET COMPONENTS AS
WEB SERVICES
INVOKE EJB COMPONENTS AS
WEB SERVICES.

05

DEVELOPING A SERVICE
ORCHESTRATION ENGINE
USING BPEL

06

DEVELOP A J2EE CLIENT TO


ACCESS A .NET WEB SERVICE.
DEVELOP A .NET CLIENT TO
ACCESS A J2EE WEB SERVICE.

07

www.Vidyarthiplus.com

MARK SIGNATURE

www.Vidyarthiplus.com

EX.NO:1(a)

TIME STAMP COMPONENT USING .NET

DATE:
AIM:
To Develop a component using .NET Technology For Time Stamp Component

PROCEDURE:
Creating the Component
1) Start Visual Studio .NET and open a new Class Library project. In the New
Project dialog box, name the project.
2) Change the name of the class from Class1 to Component name
3) Enter the Component code into the new class module.
4) Compile this class as a DLL by clicking Build on the Debug menu or by using the
Ctrl+Shift+B keystroke combination.
Creating the Application
1) Start Visual Studio .NET, select Windows Application as the new project type,
and name the project.
2) Set the Name property of the default Windows Form
3) Design the Form by placing controls and naming them.
4) You need to set a reference to the DLL so that this form will be able to consume
the components services.
5) From the Project menu, click Add Reference.
6) Click the Browse tab to locate the component DLL built.
7) Select the .DLL file, click Open, and then click OK.
8) Enter the Application code.
9) Run the application by pressing F5 function key or Start Debugging from Debug
Menu

www.Vidyarthiplus.com

www.Vidyarthiplus.com
COMPONENT CODE
Public Class ServerTime
Private mdtTime As DateTime
ReadOnly Property TimeStamp() As String
Get
mdtTime = Now()
Return CStr(mdtTime)
End Get
End Property
End Class

APPLICATION CODE
Public Class TimeFrm
Private Sub btnGetServerTime_Click( _ ByVal sender As System.Object, _ ByVal e As
System.EventArgs) _ Handles btnGetServerTime.Click
Dim st As New ServerTime.ServerTime
txtServerTime.Text = st.TimeStamp
End Sub
End Class

FORM DESIGNING

www.Vidyarthiplus.com

www.Vidyarthiplus.com

OUTPUT:

RESULT:
Thus the Program to Develop a component using .NET Technology For Time Stamp
Component was Executed Successfully.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

EX.NO:1(b)

INTERESTCALCULATIONCOMPONENT
USING.NET

DATE:
AIM:
To Develop a component using .NET Technology For INERESTCALCULATION
Component

PROCEDURE:
Creating the Component
1) Start Visual Studio .NET and open a new Class Library project. In the New Project
dialog box, name the project.
2) Change the name of the class from Class1 to Component name (for eg TimeComp,
InterestComp)
3) Enter the Component code into the new class module.
4) Compile this class as a DLL by clicking Build on the Debug menu or by using the
Ctrl+Shift+B keystroke combination.
Creating the Application
1) Start Visual Studio .NET, select Windows Application as the new project type, and name
the project.
2) Set the Name property of the default Windows Form(for eg frmConsumer, intrfrm)
3) Design the Form by placing controls and naming them.
4) You need to set a reference to the DLL so that this form will be able to consume the
components services.
5) From the Project menu, click Add Reference.
6) Click the Browse tab to locate the component DLL built.
7) Select the .DLL file, click Open, and then click OK.
8) Enter the Application code.
9) Run the application by pressing F5 function key or Start Debugging from Debug Menu

www.Vidyarthiplus.com

www.Vidyarthiplus.com
COMPONENT CODE
Public Class InterestComp
Private intSI As Double
Private intCI As Double
ReadOnly Property SimpleInt(ByVal p As Integer, ByVal n As Integer, ByVal r As
Integer) As String
Get
intSI = (p * n * r) / 100
Return CStr(intSI)
End Get
End Property
ReadOnly Property CompoundInt(ByVal p As Integer, ByVal n As Integer, ByVal r
As Integer) As String
Get
intCI = p * (((1 * r) ^ n) / 100)
Return CStr(intCI)
End Get
End Property
End Class

APPLICATION CODE
Public Class IntcalFrm
Private p As Integer
Private n As Integer
Private r As Integer
Dim intcal As New InterestComp.InterestComp
Private Sub butSI_Click(ByVal sender As
System.EventArgs) Handles butSI.Click
p = Integer.Parse(txtP.Text)
n = Integer.Parse(txtN.Text)
r = Integer.Parse(txtR.Text)
txtSI.Text = CStr(intcal.SimpleInt(p, n, r))
End Sub
Private Sub butCI_Click(ByVal sender As
System.EventArgs) Handles butCI.Click
p = Integer.Parse(txtP.Text)
n = Integer.Parse(txtN.Text)
r = Integer.Parse(txtR.Text)
txtCI.Text = CStr(intcal.CompoundInt(p, n, r))
End Sub
End Class

System.Object,

ByVal

As

System.Object,

ByVal

As

www.Vidyarthiplus.com

www.Vidyarthiplus.com

FORM DESIGNING

OUTPUT

Result:
Thus the Program To Develop a component using .NET Technology Component was
Executed Successfully.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

EX.NO:1(c)

ORDER PROCESSING COMPONENT


USING .NET

DATE:
AIM:
To Develop a component using .NET Technology order processing Component

PROCEDURE:
Creating the Component
1) Start Visual Studio .NET and open a new Class Library project. In the New Project
dialog box, name the project.
2) Change the name of the class from Class1 to Component name (for eg TimeComp,
InterestComp)
3) Enter the Component code into the new class module.
4) Compile this class as a DLL by clicking Build on the Debug menu or by using the
Ctrl+Shift+B keystroke combination.
Creating the Application
1) Start Visual Studio .NET, select Windows Application as the new project type, and name
the project.
2) Set the Name property of the default Windows Form(for eg frmConsumer, intrfrm)
3) Design the Form by placing controls and naming them.
4) You need to set a reference to the DLL so that this form will be able to consume the
components services.
5) From the Project menu, click Add Reference.
6) Click the Browse tab to locate the component DLL built.
7) Select the .DLL file, click Open, and then click OK.
8) Enter the Application code.
9) Run the application by pressing F5 function key or Start Debugging from Debug Menu

www.Vidyarthiplus.com

www.Vidyarthiplus.com
APPLICATION CODE
Public Class FillOrderForm
Dim inc As Integer
Dim con As New OleDb.OleDbConnection
Dim ds As New DataSet
Dim da As OleDb.OleDbDataAdapter
Dim sql As String
Dim dbProvider As String
Dim MaxRows As Integer
Dim dbSource As String
Dim cb As New OleDb.OleDbCommandBuilder(da)
Dim dsNewRow As DataRow
Private Sub FillForm_Load(ByVal sender As System.Object, ByVal
System.EventArgs) Handles MyBase.Load
con.ConnectionString
=
"PROVIDER=Microsoft.Jet.OLEDB.4.0;
Source=C:\Documents
and
Settings\student\My
Documents\Visual
2008\AddressBook.mdb"
con.Open()
Sql = "SELECT * FROM tblContacts"
da = New OleDb.OleDbDataAdapter(Sql, con)
da.Fill(ds, "AddressBook")
txtFirstName.Text = ds.Tables("AddressBook").Rows(0).Item(1)
txtSurname.Text = ds.Tables("AddressBook").Rows(0).Item(2)
Address1.Text = ds.Tables("AddressBook").Rows(0).Item(3)
Address2.Text = ds.Tables("AddressBook").Rows(0).Item(4)
Address3.Text = ds.Tables("AddressBook").Rows(0).Item(5)
PhoneTB.Text = ds.Tables("AddressBook").Rows(0).Item(6)
ItemCB.Text = ds.Tables("AddressBook").Rows(0).Item(7)
NoUTB.Text = ds.Tables("AddressBook").Rows(0).Item(8)
DateTimePicker1.Text = ds.Tables("AddressBook").Rows(0).Item(9)
CostTB.Text = ds.Tables("AddressBook").Rows(0).Item(10)
Totcost.Text = ds.Tables("AddressBook").Rows(0).Item(11)
MsgBox("Database is now open")
con.Close()
MaxRows = ds.Tables("AddressBook").Rows.Count
inc = -1
MsgBox("Database is now Closed")
End Sub
Private Sub NavigateRecords()
txtFirstName.Text = ds.Tables("AddressBook").Rows(inc).Item(1)
txtSurname.Text = ds.Tables("AddressBook").Rows(inc).Item(2)
Address1.Text = ds.Tables("AddressBook").Rows(inc).Item(3)
Address2.Text = ds.Tables("AddressBook").Rows(inc).Item(4)
Address3.Text = ds.Tables("AddressBook").Rows(inc).Item(5)
PhoneTB.Text = ds.Tables("AddressBook").Rows(inc).Item(6)

www.Vidyarthiplus.com

As

Data
Studio

www.Vidyarthiplus.com
ItemCB.Text = ds.Tables("AddressBook").Rows(inc).Item(7)
NoUTB.Text = ds.Tables("AddressBook").Rows(inc).Item(8)
DateTimePicker1.Text = ds.Tables("AddressBook").Rows(inc).Item(9)
CostTB.Text = ds.Tables("AddressBook").Rows(inc).Item(10)
Totcost.Text = ds.Tables("AddressBook").Rows(inc).Item(11)
End Sub
Private Sub Nextbtn_Click(ByVal sender As System.Object, ByVal
System.EventArgs) Handles Nextbtn.Click
If inc <> MaxRows - 1 Then
inc = inc + 1
NavigateRecords()
Else
MsgBox("No More Rows")
End If
End Sub
Private Sub Prevbtn_Click(ByVal sender As System.Object, ByVal
System.EventArgs) Handles Prevbtn.Click
If inc > 0 Then
inc = inc - 1
NavigateRecords()
Else
MsgBox("First Record")
End If
End Sub
Private Sub Lastbtn_Click(ByVal sender As System.Object, ByVal
System.EventArgs) Handles Lastbtn.Click
If inc <> MaxRows - 1 Then
inc = MaxRows - 1
NavigateRecords()
End If
End Sub
Private Sub Firstbtn_Click(ByVal sender As System.Object, ByVal
System.EventArgs) Handles Firstbtn.Click
If inc <> 0 Then
inc = 0
NavigateRecords()
End If
End Sub
Private Sub Updatebtn_Click(ByVal sender As System.Object, ByVal
System.EventArgs) Handles Updatebtn.Click
Dim cb As New OleDb.OleDbCommandBuilder(da)
ds.Tables("AddressBook").Rows(inc).Item(1) = txtFirstName.Text
ds.Tables("AddressBook").Rows(inc).Item(2) = txtSurname.Text
ds.Tables("AddressBook").Rows(inc).Item(3) = Address1.Text
ds.Tables("AddressBook").Rows(inc).Item(4) = Address2.Text
ds.Tables("AddressBook").Rows(inc).Item(5) = Address3.Text

www.Vidyarthiplus.com

As

As

e As

As

e As

www.Vidyarthiplus.com
ds.Tables("AddressBook").Rows(inc).Item(6) = PhoneTB.Text
ds.Tables("AddressBook").Rows(inc).Item(7) = ItemCB.Text
ds.Tables("AddressBook").Rows(inc).Item(8) = NoUTB.Text
ds.Tables("AddressBook").Rows(inc).Item(9) = DateTimePicker1.Text
ds.Tables("AddressBook").Rows(inc).Item(10) = CostTB.Text
ds.Tables("AddressBook").Rows(inc).Item(11) = Totcost.Text
da.Update(ds, "AddressBook")
MsgBox("Data was updated")
End Sub
Private Sub Addbtn_Click(ByVal sender As System.Object, ByVal
System.EventArgs) Handles Addbtn.Click
Commitbtn.Enabled = True
Addbtn.Enabled = False
Updatebtn.Enabled = False
Deletebtn.Enabled = False
txtFirstName.Clear()
txtSurname.Clear()
CostTB.Clear()
NoUTB.Clear()
Address1.Clear()
Address2.Clear()
Address3.Clear()
Totcost.Clear()
DateTimePicker1.Clear()
PhoneTB.Clear()
ItemCB.Clear()
End Sub
Private Sub Deletebtn_Click(ByVal sender As System.Object, ByVal
System.EventArgs) Handles Deletebtn.Click
Dim cb As New OleDb.OleDbCommandBuilder(da)
ds.Tables("AddressBook").Rows(inc).Delete()
MaxRows = MaxRows - 1
da.Update(ds, "AddressBook")
MessageBox.Show("The Current Record Was deleted", "Delete Dialog
MessageBoxButtons.OK)
inc = 0
NavigateRecords()
End Sub
Private Sub Clearbtn_Click(ByVal sender As System.Object, ByVal
System.EventArgs) Handles Clearbtn.Click
Commitbtn.Enabled = False
Addbtn.Enabled = True
Updatebtn.Enabled = True
Deletebtn.Enabled = True
inc = 0
txtFirstName.Clear()

www.Vidyarthiplus.com

e As

e As

Box",

e As

www.Vidyarthiplus.com
txtSurname.Clear()
CostTB.Clear()
NoUTB.Clear()
Address1.Clear()
Address2.Clear()
Address3.Clear()
Totcost.Clear()
PhoneTB.Clear()
DateTimePicker1.Clear()
ItemCB.Clear()
End Sub
Private Sub Commitbtn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Commitbtn.Click
If inc <> -1 Then
Dim cb As New OleDb.OleDbCommandBuilder(da)
Dim dsNewRow As DataRow
dsNewRow = ds.Tables("AddressBook").NewRow()
MessageBox.Show("welcome")
dsNewRow.Item("Fname") = txtFirstName.Text
dsNewRow.Item("Sname") = txtSurname.Text
dsNewRow.Item("Address1") = Address1.Text
dsNewRow.Item("Address2") = Address2.Text
dsNewRow.Item("Address3") = Address3.Text
dsNewRow.Item("Phone") = PhoneTB.Text
dsNewRow.Item("Item") = ItemCB.Text
dsNewRow.Item("NoOfUnits") = NoUTB.Text
dsNewRow.Item("datetime") = DateTimePicker1.Text
dsNewRow.Item("Cost") = CostTB.Text
dsNewRow.Item("Totcost") = Totcost.Text
ds.Tables("AddressBook").Rows.Add(dsNewRow)
da.Update(ds, "AddressBook")
MsgBox("New Record added to the Database")
Commitbtn.Enabled = False
Addbtn.Enabled = True
Updatebtn.Enabled = True
Deletebtn.Enabled = True
End If
End Sub
End Class

www.Vidyarthiplus.com

www.Vidyarthiplus.com
FORM DESIGNING

OUTPUT :
ADDING NEW ORDER

www.Vidyarthiplus.com

www.Vidyarthiplus.com

MODIFYING AN ORDER

DELETING AN ORDER

RESULT:
Thus the Program To Develop a component using .NET Technology Component was
Executed Successfully.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

EX.NO:1(d)

TEMPERATURECONVERSION COMPONENT
USING .NET

DATE:
AIM:
To Develop a component using .NET Technology For Time Stamp Component

PROCEDURE:
Creating the Component
1) Start Visual Studio .NET and open a new Class Library project. In the New Project
dialog box, name the project.
2) Change the name of the class from Class1 to Component name (for eg TimeComp,
InterestComp)
3) Enter the Component code into the new class module.
4) Compile this class as a DLL by clicking Build on the Debug menu or by using the
Ctrl+Shift+B keystroke combination.
Creating the Application
1) Start Visual Studio .NET, select Windows Application as the new project type, and name
the project.
2) Set the Name property of the default Windows Form(for eg frmConsumer, intrfrm)
3) Design the Form by placing controls and naming them.
4) You need to set a reference to the DLL so that this form will be able to consume the
components services.
5) From the Project menu, click Add Reference.
6) Click the Browse tab to locate the component DLL built.
7) Select the .DLL file, click Open, and then click OK.
8) Enter the Application code.
9) Run the application by pressing F5 function key or Start Debugging from Debug Menu

www.Vidyarthiplus.com

www.Vidyarthiplus.com

COMPONENT CODE (TempConv.vb)


Public Class TempConv
Private fah As Double
Private cel As Double
ReadOnly Property FahToCel(ByVal f As Integer) As String
Get
cel = (f - 32) * 5 / 9
Return CStr(cel)
End Get
End Property
ReadOnly Property CelToFah(ByVal c As Integer) As String
Get
fah = (c * 9 / 5) + 32
Return CStr(fah)
End Get
End Property
End Class
APPLICATION CODE (TempForm.vb)
Public Class TempForm
Dim temcal As New TempConv.TempConv
Dim f As Integer
Dim c As Integer
Private Sub butFtoC_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles butFtoC.Click
If txtConvert.Text = "" Then
MsgBox("Enter the value to convert")
txtConvert.Focus()
Else
butCtoF.Enabled = False
lblEnter.Text = "Temperature in Fahrenheit"
lblDisplay.Text = "Temperature in Celcius"
f = Integer.Parse(txtConvert.Text)
txtDisplay.Text = temcal.FahToCel(f)
End If
End Sub
Private Sub butCtoF_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles butCtoF.Click
If txtConvert.Text = "" Then
MsgBox("Enter the value to convert")
txtConvert.Focus()
Else

www.Vidyarthiplus.com

www.Vidyarthiplus.com
butFtoC.Enabled = False
lblEnter.Text = "Temperature in Celcius"
lblDisplay.Text = "Temperature in Fahrenheit"
c = Integer.Parse(txtConvert.Text)
txtDisplay.Text = temcal.FahToCel(c)
End If
End Sub
Private Sub butClear_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles butClear.Click
butCtoF.Enabled = True
butFtoC.Enabled = True
lblEnter.Text = "Enter the Temperature"
lblDisplay.Text = "Converted Temperature"
txtConvert.Text = ""
txtDisplay.Text = ""
End Sub
End Class

FORM DESIGNING

www.Vidyarthiplus.com

www.Vidyarthiplus.com
OUTPUT :
Fahrenheit to Celcius

Celcius to Fahrenheit

RESULT:
Thus the Program to Develop a component using .NET Technology Component was
Executed Successfully.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

EX.NO:1(e)

CURRENCY CONVERTER COMPONENT


USING .NET

DATE:
AIM:
To Develop a component using .NET Technology for currency conversion Component

PROCEDURE:
Creating the Component
1) Start Visual Studio .NET and open a new Class Library project. In the New Project
dialog box, name the project.
2) Change the name of the class from Class1 to Component name (for eg TimeComp,
InterestComp)
3) Enter the Component code into the new class module.
4) Compile this class as a DLL by clicking Build on the Debug menu or by using the
Ctrl+Shift+B keystroke combination.
Creating the Application
1) Start Visual Studio .NET, select Windows Application as the new project type, and name
the project.
2) Set the Name property of the default Windows Form(for eg frmConsumer, intrfrm)
3) Design the Form by placing controls and naming them.
4) You need to set a reference to the DLL so that this form will be able to consume the
components services.
5) From the Project menu, click Add Reference.
6) Click the Browse tab to locate the component DLL built.
7) Select the .DLL file, click Open, and then click OK.
8) Enter the Application code.
9) Run the application by pressing F5 function key or Start Debugging from Debug Menu

www.Vidyarthiplus.com

www.Vidyarthiplus.com

COMPONENT CODE
Public Class CurrConv
Public convAmt As Decimal
Public amount As Decimal
'1 Indian Rupee = 0.01558 Euro
'1 Euro(EUR) = 64.20290 Indian Rupee (INR)
'1 Indian Rupee = 0.00604 Kuwaiti Dinar
'1 Kuwaiti Dinar(KWD) = 165.61900 Indian Rupee (INR)
'1 Indian Rupee = 0.02206 US Dollar
'1 US Dollar(USD) = 45.32500 Indian Rupee (INR)
'1 Indian Rupee = 0.01367 British Pound
'1 British Pound(GBP) = 73.16090 Indian Rupee (INR)
'1 Euro = 0.38765 Kuwaiti Dinar
'1 Kuwaiti Dinar(KWD) = 2.57962 Euro (EUR
'1 Euro = 1.41650 US Dollar
'1 US Dollar(USD) = 0.70596 Euro (EUR)
'1 Euro = 0.87756 British Pound
'1 British Pound(GBP) = 1.13953 Euro (EUR)
' 1 Kuwaiti Dinar = 3.65403 US Dollar
'1 US Dollar(USD) = 0.27367 Kuwaiti Dinar (KWD)
'1 Kuwaiti Dinar = 2.26376 British Pound
'1 British Pound(GBP) = 0.44174 Kuwaiti Dinar (KWD)
'1 US Dollar = 0.61952 British Pound
'1 British Pound(GBP) = 1.61414 US Dollar (USD)
ReadOnly Property ConvFromTo(ByVal cf As String, ByVal ct As String, ByVal amt
As String) As String
Get
amount = Double.Parse(amt)
Select Case (cf)
Case "Rupee"
Select Case (ct)
Case "Euro"
convAmt = amount * 0.01558
Case "Dinar"
convAmt = amount * 0.00604
Case "Dollar"
convAmt = amount * 0.02206
Case "Pound"
convAmt = amount * 0.01367
End Select
Case "Euro"
Select Case (ct)
Case "Rupee"

www.Vidyarthiplus.com

www.Vidyarthiplus.com
convAmt = amount * 64.2029
Case "Dinar"
convAmt = amount * 0.38765
Case "Dollar"
convAmt = amount * 1.4165
Case "Pound"
convAmt = amount * 0.87756
End Select
Case "Dinar"
Select Case (ct)
Case "Rupee"
convAmt = amount * 165.619
Case "Euro"
convAmt = amount * 2.57962
Case "Dollar"
convAmt = amount * 3.65403
Case "Pound"
convAmt = amount * 2.26376
End Select
Case "Dollar"
Select Case (ct)
Case "Rupee"
convAmt = amount * 45.325
Case "Euro"
convAmt = amount * 0.70596
Case "Dinar"
convAmt = amount * 0.27367
Case "Pound"
convAmt = amount * 0.61952
End Select
Case "Pound"
Select Case (ct)
Case "Rupee"
convAmt = amount * 73.1609
Case "Euro"
convAmt = amount * 1.13953
Case "Dinar"
convAmt = amount * 0.44174
Case "Dollar"
convAmt = amount * 1.61414
End Select
End Select
Return CStr(convAmt)
End Get
End Property
End Class

www.Vidyarthiplus.com

www.Vidyarthiplus.com

APPLICATION CODE
Public Class Curr
Dim curconv As New CurrConv.CurrConv
Dim amount As Decimal
Private Sub butConvert_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles butConvert.Click
' declare variables
amount = curconv.ConvFromTo(curFrom.SelectedItem, curTo.SelectedItem,
amtext.Text)
'assign result to corresponding label
ConvAmtLabel.Text = amtext.Text + curFrom.SelectedItem + "=" +
String.Format("{0:F}", amount) + curTo.SelectedItem
End Sub
End Class ' CurrencyConverterForm

FORM DESIGNING

www.Vidyarthiplus.com

www.Vidyarthiplus.com
OUTPUT :
From Dollor To Rupees

From Rupees To Dollors

RESULT:
Thus the Program to Develop a component using .NET Technology Component was
Executed Successfully.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

EX NO:02(a)

ORDERPROCESSING COMPONENT
USING EJB

DATE:
AIM:
To develop an order processing component using EJB component technology.

PROCEDURE:
1)
2)
3)
4)
5)

Start-> All programs -> NetbeansIDE.


Select File menu-> New Project-> JavaEE-> Enterprise application.
Give the project name. select glassfish vs as server and click the finish button.
Select the EJB right click and select new sessionbean.
Give the EJB name as EJB and select sessiontype as stateless and interface as
remote give the package name and click the finish that select.
6) Select EJB from that select EJBbean.java.
7) Inside the EJB bean class insert the business method find power.
8) Insert the following code inside the method.
9) Right click select insert code option-> add business method give the name,return
type as int.
10) Add the code.
11) Clean and deploy and run the project.

Orderclient.java
package op;
import javax.naming.InitialContext;
import javax.naming.NamingException;
public class orderclient {
public static void main(String args[])
try

InitialContext ic=new InitialContext();


ordersRemote or=(ordersRemote)ic.lookup("op.ordersRemote");
System.out.println("-----------------------------------------\n\n\n");

www.Vidyarthiplus.com

www.Vidyarthiplus.com
System.out.println("\t\t\t**********ORDERPROCESSING**********\n\n\n");
System.out.println("-----------------------------------------\n\n\n");
System.out.println("ITEM NAME:KEYBOARD\n");
System.out.println("QUANTITY:3\n");
System.out.println("PRICE:350\n");
System.out.println("TAX:15%\n");
System.out.println("TOTAL AMOUNT:"+or.tax(350,15));}
catch(NamingException e)

System.out.println("Hoo! There is an error");


} }}

orders.java
package op;
import javax.ejb.Stateless;
@Stateless
public class orders implements ordersRemote {
@Override
public int tax(int a, int b) {
return a-((a*b)/100);
} }

ordersRemote.java
package op;
import javax.ejb.Remote;
@Remote
public interface ordersRemote {
int tax(int a, int b);

www.Vidyarthiplus.com

www.Vidyarthiplus.com
OUTPUT:
-----------------------------------------------------------**********ORDERPROCESSING**********
------------------------------------------------------------ITEM NAME:KEYBOARD
QUANTITY:3
PRICE:350
TAX:15%
TOTAL AMOUNT:298
BUILD SUCCESSFUL (total time: 4 seconds)

RESULT:
Thus the program to develop an order processing component using ejb component
technology.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

EX NO:02(b)

INTEREST CALCULATION COMPONENT


USING EJB

DATE:
AIM:
To develop an interest calculation component using EJB component technology.

PROCEDURE:
1)
2)
3)
4)
5)

Start-> All programs -> NetbeansIDE.


Select File menu-> New Project-> JavaEE-> Enterprise application.
Give the project name select glassfish vs as server and click the finish button.
Select the EJB right click and select new sessionbean.
Give the EJB name as EJB and select sessiontype as stateless and interface as
remote give the package name and click the finish that select.
6) Select EJB from that select EJBbean.java.
7) Inside the EJB bean class insert the business method find power.
8) Insert the following code inside the method.
9) Right click select insert code option-> add business method give the name return
type as int.
10) Add the code.
11) Clean and deploy and run the project.

Interestclient.java
package in;
import javax.naming.InitialContext;
import javax.naming.NamingException;
public class interestclient {
public static void main(String args[]) {
try {

InitialContext ic=new InitialContext();

interestRemote ir=(interestRemote)ic.lookup("in.interestRemote");
System.out.println("---------------------------------------\n\n\n");

www.Vidyarthiplus.com

www.Vidyarthiplus.com
System.out.println("*****INTERESTCALCULATION*****");
System.out.println("---------------------------------------\n\n\n");
System.out.println("Principle Value:10000");
System.out.println("Rate:6");
System.out.println("NO. Of Years:9");
System.out.println("Simple interest:"+ir.si(10000, 6, 9));
System.out.println("Compound interesr:"+ir.ci(10000, 6, 9));
}
catch(NamingException e)
{

System.out.println(e);

}}}

Interest.java
package in;
import javax.ejb.Stateless;
@Stateless
public class interest implements interestRemote {
@Override
public double si(double a, double b, double c) {
return (a * b * c) / 100;
}
@Override
public double ci(double a, double b, double c) {
return a * (((1 * c) * b) / 100); } }

interestRemote.java
package in;

www.Vidyarthiplus.com

www.Vidyarthiplus.com
import javax.ejb.Remote;
@Remote
public interface interestRemote {
double si(double a, double b, double c);
double ci(double a, double b, double c);
}

OUTPUT:
----------------------------------------------*****INTERESTCALCULATION*****
----------------------------------------------Principle Value:10000
Rate:6
Simple interest:540
Compound interesr:540

RESULT:
Thus the program to develop an interest calculation component using EJB component
technology.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

EX NO:02(c)

PAYMENT PROCESSING COMPONENT


USING EJB

DATE:
AIM:
To develop a Payment processing component using EJB component technology.

PROCEDURE:
1) Start-> All programs -> NetbeansIDE.
2) Select File menu-> New Project-> JavaEE-> Enterprise application.
3) Give the project name select glassfish vs as server and click the finish
button.
4) Select the EJB right click and select new sessionbean.
5) Give the EJB name EJB and select sessiontype as stateless and interface as
remote give the package name and click the finish that select.
6) Select EJB from that select EJBbean.java.
7) Inside the EJB bean class insert the business method find power.
8) Insert the following code inside the method.
9) Right click select insert code option-> add business method give the name
return type as int.
10) Add the code.
11) Clean and deploy and run the project.

Paymentclient.java
package pp;
import javax.naming.InitialContext;
import javax.naming.NamingException;
public class paymentclient {
public static void main(String args[])

try{
InitialContext ic=new InitialContext();

www.Vidyarthiplus.com

www.Vidyarthiplus.com
payRemote pr=(payRemote)ic.lookup("pp.payRemote");
int x=pr.mul(25000,33);
System.out.println("---------------------------------------\n\n\n");
System.out.println("PAYMENTPROCESSING\n\n\n");
System.out.println("---------------------------------------\n\n\n");
System.out.println("Employee Name:Gopal.R\n");
System.out.println("Position:Developer\n");
System.out.println("Salary:25000\n");
System.out.println("TAX:33%\n");
System.out.println("Bonus Amount:5000\n");
System.out.println("Exist Salary:"+x);
System.out.println("Total Amount:"+pr.add(x, 5000));
}
catch(NamingException e){
System.out.println(e);
}}}

Pay.java
package pp;
import javax.ejb.Stateless;
@Stateless
public class pay implements payRemote {
@Override
public int add(int a, int b) {
return a+b;
}
@Override

www.Vidyarthiplus.com

www.Vidyarthiplus.com
public int mul(int a, int b) {
return a-((b*a)/100);
}}

payRemote.java
package pp;
import javax.ejb.Remote;
@Remote
public interface payRemote {
int add(int a, int b);
int mul(int a, int b);
}

OUTPUT:
----------------------------------PAYMENTPROCESSING
----------------------------------Employee Name:Gopal.R
Position:Developer
Salary:25000
TAX:33%
Bonus Amount:5000
Exist Salary:8250
Total Amount:16,750

RESULT:
Thus the program to develop a payment processing component using EJB component
technology

www.Vidyarthiplus.com

www.Vidyarthiplus.com

EX NO:02(d)

TEMPERATURECONVERSION COMPONENT
USING EJB

DATE:
AIM:
To develop a Temperature conversion component using EJB component technology.

PROCEDURE:
1) Start-> All programs -> NetbeansIDE.
2) Select File menu-> New Project-> JavaEE-> Enterprise application.
3) Give the project name select glassfish vs as server and click the finish
button.
4) Select the EJB right click and select new sessionbean.
5) Give the EJB name EJB and select sessiontype as stateless and
interface as remote give the package name and click the finish that
select.
6) Select EJB from that select EJBbean.java.
7) Inside the EJB bean class insert the business method find power.
8) Insert the following code inside the method.
9) Right click select insert code option-> add business method give the
name return type as int.
10) Add the code.
11) Clean and deploy and run the project.

Tempclient.java
package tp;
import javax.naming.InitialContext;
import javax.naming.NamingException;
public class tempclient {
public static void main(String args[])
try

www.Vidyarthiplus.com

www.Vidyarthiplus.com
InitialContext ic=new InitialContext();
tempRemote tr=(tempRemote)ic.lookup("tp.tempRemote");
System.out.println("_______________________________");
System.out.println("*****TEMPERATURE CONVERTER*****");
System.out.println("_______________________________");
System.out.println("\n\n");
System.out.println("Current Temperature:32");
System.out.println("Temperature in FahToCel:"+tr.ftoc(32.00));
System.out.println("Temperature in CelToFah:"+tr.ctof(32));
}
catch(NamingException ex)

}}}

tempRemote.java
package tp;
import javax.ejb.Remote;
@Remote
public interface tempRemote {
double ftoc(double a);
double ctof(double a);
}

temp .java
package tp;
import javax.ejb.Stateless;
@Stateless
public class temp implements tempRemote {
@Override

www.Vidyarthiplus.com

www.Vidyarthiplus.com
public double ftoc(double a) {
return (a - 32) * 5 / 9;
}
@Override
public double ctof(double a) {
return (a * 9 / 5) + 32;
}}

OUTPUT:
_______________________________
*****TEMPERATURE CONVERTER*****
_______________________________
Current Temperature:32
Temperature in FahToCel:0
Temperature in CelToFah:89.6

RESULT:
Thus the program to develop a temperature conversion component using EJB component
technology

www.Vidyarthiplus.com

www.Vidyarthiplus.com

EX.NO:02(e)

EJB COMPONENTS FOR FINDING


POWERVALUE

DATE:
AIM:
To write a program for EJP components for finding power value.

PROCEDURE:
1) Start-> All programs -> NetbeansIDE.
2) Select File menu-> New Project-> JavaEE-> Enterprise application.
3) Give the project name as powerservice select glassfish vs as server and click the
finish button.
4) Select the powerservice EJB right click and select new sessionbean.
5) Give the EJB name as powerservice EJB and select sessiontype as stateless and
interface as remote give the package name as mypack and click the finish that
select.
6) Select powerservice EJB from that select powerservice EJBbean.java.
7) Inside the powerservice EJB bean class insert the business method find power.
8) Insert the following code inside the findpower() method.
9) Right click select insert code option-> add business method give the name as
findpower return type as int.
10) Add the doGET() code.
11) Clean and deploy and run the project.

PROGRAM:
PowersessionBean.java:
package powerpack;
import javax.ejb.Stateless;
public class powersessionBean implements powersessionRemote {
public int findpower(int x, int y) {
int result=1;

www.Vidyarthiplus.com

www.Vidyarthiplus.com
for(int i=0;i<y;i++){
result=result*x;
}
return result;
}

Powerservlet.java:
package powerpack;
import java.io.*;
import javax.ejb.EJB;
import javax.servlet.*;
import javax.servlet.http.*;
import powerpack.powersessionRemote;
public class powerservlet extends HttpServlet {
@EJB
private powersessionRemote powersessionBean;
protected void processRequest(HttpServletRequest request, HttpServletResponse
response)throws ServletException, IOException
{response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet powerservlet</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Servlet powerservlet at " + request.getContextPath () + "</h1>");

www.Vidyarthiplus.com

www.Vidyarthiplus.com
out.println("</body>");
out.println("</html>");
} finally {
out.close();
}}
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
int a,b;
a=Integer.parseInt(request.getParameter("xval"));
b=Integer.parseInt(request.getParameter("yval"));
response.setContentType("Text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
out.println("<html>");
out.println("<head>");
out.println("<title>Power value calculation</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>the result of"+a+"power"+b+"is"
+powersessionBean.findpower(a,b)+"</h1>");
out.println("</body>");
out.println("</html>");
}finally{
out.close();}

www.Vidyarthiplus.com

www.Vidyarthiplus.com
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);}
@Override
public String getServletInfo() {
return "Short description";
}}

Index.jsp:
<%@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>Power servlet</title>
</head> <body>
<h1>Welcome to Power Calculation</h1>
<form name="myform" action="powerservlet">
Enter the value of x:<input type="text" name="xval" value="" /><br/>
Enter the value of y:<input type="text" name="yval" value="" /><br/>
<input type="submit" value="calculate" name="cal" />
</form></body></html>

www.Vidyarthiplus.com

www.Vidyarthiplus.com
OUTPUT:

RESULT:
Thus the EJB components for finding power value was verified and executed
Successfully.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

EX NO:03

INVOKE .NET COMPONENT AS


WEBSERVICES

DATE:
AIM:
To Develop a Webservice to Invoke .NET component

PROCEDURE:
1) Create a Visual C# - ASP.NET Web Service project
2) Develop the OIDServer.asmx file and the OIDServer.asmx.cs class file
3) Modify the generated AssemblyInfo.cs to add the right assembly information
4) Build the Project Files
5) Deploy the Web Service files on IIS, and test your Web Service

Appcode/Servics.cs:
using System;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService{
[WebMethod]
public double add(double a,double b) {
return a + b;
}
[WebMethod]
public double sub(double a, double b) {
return a - b;
}
[WebMethod]
public double mul(double a, double b) {
return a * b;
}
[WebMethod]

www.Vidyarthiplus.com

www.Vidyarthiplus.com
public double div(double a, double b) {
return a / b;
}
[WebMethod] public double power(double a, double b)
return (Math.Pow(a,b));
} [WebMethod]
public long fact(long n) {
long facto = 1;
for (long i = 1; i <= n; i++)
{
facto = facto * i;

}
return facto;
}}

OUTPUT:
http://localhost:49784/WebSite1/Service.asmx
Service
The following operations are supported. For a formal definition, please review the
Service Description.

HelloWorld

add

div

fact

mul

power

sub

Click here for a complete list of operations.


add

Test
To test the operation using the HTTP POST protocol, click the 'Invoke' button.
Parameter

Value

a:

www.Vidyarthiplus.com

www.Vidyarthiplus.com
b:
Invoke

SOAP 1.1
The following is a sample SOAP 1.1 request and response. The placeholders shown need
to be replaced with actual values.
POST /WebSite1/Service.asmx HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/add"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<add xmlns="http://tempuri.org/">
<a>double</a>
<b>double</b>
</add>
</soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<addResponse xmlns="http://tempuri.org/">
<addResult>double</addResult>
</addResponse>
</soap:Body>
</soap:Envelope>

div

Test
To test the operation using the HTTP POST protocol, click the 'Invoke' button.

www.Vidyarthiplus.com

www.Vidyarthiplus.com
Parameter

Value

a:
b:
Invoke

SOAP 1.1
The following is a sample SOAP 1.1 request and response. The placeholders shown need
to be replaced with actual values.
POST /WebSite1/Service.asmx HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/div"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<div xmlns="http://tempuri.org/">
<a>double</a>
<b>double</b>
</div>
</soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<divResponse xmlns="http://tempuri.org/">
<divResult>double</divResult>
</divResponse>
</soap:Body>
</soap:Envelope>

www.Vidyarthiplus.com

www.Vidyarthiplus.com

fact

Test
To test the operation using the HTTP POST protocol, click the 'Invoke' button.
Parameter

Value

n:
Invoke

SOAP 1.1
The following is a sample SOAP 1.1 request and response. The placeholders shown need
to be replaced with actual values.
POST /WebSite1/Service.asmx HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/fact"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<fact xmlns="http://tempuri.org/">
<n>long</n>
</fact>
</soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<factResponse xmlns="http://tempuri.org/">
<factResult>long</factResult>
</factResponse>

www.Vidyarthiplus.com

www.Vidyarthiplus.com
</soap:Body>
</soap:Envelope>
mul

Test
To test the operation using the HTTP POST protocol, click the 'Invoke' button.
Parameter

Value

a:
b:
Invoke

SOAP 1.1
The following is a sample SOAP 1.1 request and response. The placeholders shown need
to be replaced with actual values.
POST /WebSite1/Service.asmx HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/mul"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<mul xmlns="http://tempuri.org/">
<a>double</a>
<b>double</b>
</mul>
</soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>

www.Vidyarthiplus.com

www.Vidyarthiplus.com
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<mulResponse xmlns="http://tempuri.org/">
<mulResult>double</mulResult>
</mulResponse>
</soap:Body>
</soap:Envelope>
power

Test
To test the operation using the HTTP POST protocol, click the 'Invoke' button.
Parameter

Value

a:
b:
Invoke

SOAP 1.1
The following is a sample SOAP 1.1 request and response. The placeholders shown need
to be replaced with actual values.
POST /WebSite1/Service.asmx HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/power"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<power xmlns="http://tempuri.org/">
<a>double</a>
<b>double</b>
</power>
</soap:Body>
</soap:Envelope>

www.Vidyarthiplus.com

www.Vidyarthiplus.com
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<powerResponse xmlns="http://tempuri.org/">
<powerResult>double</powerResult>
</powerResponse>
</soap:Body>
</soap:Envelope

sub

Test
To test the operation using the HTTP POST protocol, click the 'Invoke' button.
Parameter

Value

a:
b:
Invoke

SOAP 1.1
The following is a sample SOAP 1.1 request and response. The placeholders shown need
to be replaced with actual values.
POST /WebSite1/Service.asmx HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/sub"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>

www.Vidyarthiplus.com

www.Vidyarthiplus.com
<sub xmlns="http://tempuri.org/">
<a>double</a>
<b>double</b>
</sub>
</soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<subResponse xmlns="http://tempuri.org/">
<subResult>double</subResult>
</subResponse>
</soap:Body>
</soap:Envelope>

WSDL URL:
http://localhost:49784/WebSite1/Service.asmx?WSDL
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="http://tempuri.org/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://tempuri.org/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"><wsdl:types><s:schema
targetNamespace="http://tempuri.org/" elementFormDefault="qualified"><s:element
name="HelloWorld"><s:complexType/></s:element><s:element
name="HelloWorldResponse"><s:complexType><s:sequence><s:element
name="HelloWorldResult" type="s:string" maxOccurs="1"
minOccurs="0"/></s:sequence></s:complexType></s:element><s:element

www.Vidyarthiplus.com

www.Vidyarthiplus.com
name="add"><s:complexType><s:sequence><s:element name="a" type="s:double"
maxOccurs="1" minOccurs="1"/><s:element name="b" type="s:double"
maxOccurs="1"
minOccurs="1"/></s:sequence></s:complexType></s:element><s:element
name="addResponse"><s:complexType><s:sequence><s:element name="addResult"
type="s:double" maxOccurs="1"
minOccurs="1"/></s:sequence></s:complexType></s:element><s:element
name="sub"><s:complexType><s:sequence><s:element name="a" type="s:double"
maxOccurs="1" minOccurs="1"/><s:element name="b" type="s:double"
maxOccurs="1"
minOccurs="1"/></s:sequence></s:complexType></s:element><s:element
name="subResponse"><s:complexType><s:sequence><s:element name="subResult"
type="s:double" maxOccurs="1"
minOccurs="1"/></s:sequence></s:complexType></s:element><s:element
name="mul"><s:complexType><s:sequence><s:element name="a" type="s:double"
maxOccurs="1" minOccurs="1"/><s:element name="b" type="s:double"
maxOccurs="1"
minOccurs="1"/></s:sequence></s:complexType></s:element><s:element
name="mulResponse"><s:complexType><s:sequence><s:element name="mulResult"
type="s:double" maxOccurs="1"
minOccurs="1"/></s:sequence></s:complexType></s:element><s:element
name="div"><s:complexType><s:sequence><s:element name="a" type="s:double"
maxOccurs="1" minOccurs="1"/><s:element name="b" type="s:double"
maxOccurs="1"
minOccurs="1"/></s:sequence></s:complexType></s:element><s:element
name="divResponse"><s:complexType><s:sequence><s:element name="divResult"
type="s:double" maxOccurs="1"
minOccurs="1"/></s:sequence></s:complexType></s:element><s:element
name="power"><s:complexType><s:sequence><s:element name="a"
type="s:double" maxOccurs="1" minOccurs="1"/><s:element name="b"
type="s:double" maxOccurs="1"
minOccurs="1"/></s:sequence></s:complexType></s:element><s:element
name="powerResponse"><s:complexType><s:sequence><s:element
name="powerResult" type="s:double" maxOccurs="1"
minOccurs="1"/></s:sequence></s:complexType></s:element><s:element
name="fact"><s:complexType><s:sequence><s:element name="n" type="s:long"
maxOccurs="1"
minOccurs="1"/></s:sequence></s:complexType></s:element><s:element
name="factResponse"><s:complexType><s:sequence><s:element name="factResult"
type="s:long" maxOccurs="1"

www.Vidyarthiplus.com

www.Vidyarthiplus.com
minOccurs="1"/></s:sequence></s:complexType></s:element></s:schema></wsdl:types
><wsdl:message name="HelloWorldSoapIn"><wsdl:part name="parameters"
element="tns:HelloWorld"/></wsdl:message><wsdl:message
name="HelloWorldSoapOut"><wsdl:part name="parameters"
element="tns:HelloWorldResponse"/></wsdl:message><wsdl:message
name="addSoapIn"><wsdl:part name="parameters"
element="tns:add"/></wsdl:message><wsdl:message name="addSoapOut"><wsdl:part
name="parameters" element="tns:addResponse"/></wsdl:message><wsdl:message
name="subSoapIn"><wsdl:part name="parameters"
element="tns:sub"/></wsdl:message><wsdl:message name="subSoapOut"><wsdl:part
name="parameters" element="tns:subResponse"/></wsdl:message><wsdl:message
name="mulSoapIn"><wsdl:part name="parameters"
element="tns:mul"/></wsdl:message><wsdl:message
name="mulSoapOut"><wsdl:part name="parameters"
element="tns:mulResponse"/></wsdl:message><wsdl:message
name="divSoapIn"><wsdl:part name="parameters"
element="tns:div"/></wsdl:message><wsdl:message name="divSoapOut"><wsdl:part
name="parameters" element="tns:divResponse"/></wsdl:message><wsdl:message
name="powerSoapIn"><wsdl:part name="parameters"
element="tns:power"/></wsdl:message><wsdl:message
name="powerSoapOut"><wsdl:part name="parameters"
element="tns:powerResponse"/></wsdl:message><wsdl:message
name="factSoapIn"><wsdl:part name="parameters"
element="tns:fact"/></wsdl:message><wsdl:message
name="factSoapOut"><wsdl:part name="parameters"
element="tns:factResponse"/></wsdl:message><wsdl:portType
name="ServiceSoap"><wsdl:operation name="HelloWorld"><wsdl:input
message="tns:HelloWorldSoapIn"/><wsdl:output
message="tns:HelloWorldSoapOut"/></wsdl:operation><wsdl:operation
name="add"><wsdl:input message="tns:addSoapIn"/><wsdl:output
message="tns:addSoapOut"/></wsdl:operation><wsdl:operation
name="sub"><wsdl:input message="tns:subSoapIn"/><wsdl:output
message="tns:subSoapOut"/></wsdl:operation><wsdl:operation
name="mul"><wsdl:input message="tns:mulSoapIn"/><wsdl:output
message="tns:mulSoapOut"/></wsdl:operation><wsdl:operation
name="div"><wsdl:input message="tns:divSoapIn"/><wsdl:output
message="tns:divSoapOut"/></wsdl:operation><wsdl:operation
name="power"><wsdl:input message="tns:powerSoapIn"/><wsdl:output
message="tns:powerSoapOut"/></wsdl:operation><wsdl:operation
name="fact"><wsdl:input message="tns:factSoapIn"/><wsdl:output

www.Vidyarthiplus.com

www.Vidyarthiplus.com
message="tns:factSoapOut"/></wsdl:operation></wsdl:portType><wsdl:binding
name="ServiceSoap" type="tns:ServiceSoap"><soap:binding
transport="http://schemas.xmlsoap.org/soap/http"/><wsdl:operation
name="HelloWorld"><soap:operation style="document"
soapAction="http://tempuri.org/HelloWorld"/><wsdl:input><soap:body
use="literal"/></wsdl:input><wsdl:output><soap:body
use="literal"/></wsdl:output></wsdl:operation><wsdl:operation
name="add"><soap:operation style="document"
soapAction="http://tempuri.org/add"/><wsdl:input><soap:body
use="literal"/></wsdl:input><wsdl:output><soap:body
use="literal"/></wsdl:output></wsdl:operation><wsdl:operation
name="sub"><soap:operation style="document"
soapAction="http://tempuri.org/sub"/><wsdl:input><soap:body
use="literal"/></wsdl:input><wsdl:output><soap:body
use="literal"/></wsdl:output></wsdl:operation><wsdl:operation
name="mul"><soap:operation style="document"
soapAction="http://tempuri.org/mul"/><wsdl:input><soap:body
use="literal"/></wsdl:input><wsdl:output><soap:body
use="literal"/></wsdl:output></wsdl:operation><wsdl:operation
name="div"><soap:operation style="document"
soapAction="http://tempuri.org/div"/><wsdl:input><soap:body
use="literal"/></wsdl:input><wsdl:output><soap:body
use="literal"/></wsdl:output></wsdl:operation><wsdl:operation
name="power"><soap:operation style="document"
soapAction="http://tempuri.org/power"/><wsdl:input><soap:body
use="literal"/></wsdl:input><wsdl:output><soap:body
use="literal"/></wsdl:output></wsdl:operation><wsdl:operation
name="fact"><soap:operation style="document"
soapAction="http://tempuri.org/fact"/><wsdl:input><soap:body
use="literal"/></wsdl:input><wsdl:output><soap:body
use="literal"/></wsdl:output></wsdl:operation></wsdl:binding><wsdl:binding
name="ServiceSoap12" type="tns:ServiceSoap"><soap12:binding
transport="http://schemas.xmlsoap.org/soap/http"/><wsdl:operation
name="HelloWorld"><soap12:operation style="document"
soapAction="http://tempuri.org/HelloWorld"/><wsdl:input><soap12:body
use="literal"/></wsdl:input><wsdl:output><soap12:body
use="literal"/></wsdl:output></wsdl:operation><wsdl:operation
name="add"><soap12:operation style="document"
soapAction="http://tempuri.org/add"/><wsdl:input><soap12:body
use="literal"/></wsdl:input><wsdl:output><soap12:body

www.Vidyarthiplus.com

www.Vidyarthiplus.com
use="literal"/></wsdl:output></wsdl:operation><wsdl:operation
name="sub"><soap12:operation style="document"
soapAction="http://tempuri.org/sub"/><wsdl:input><soap12:body
use="literal"/></wsdl:input><wsdl:output><soap12:body
use="literal"/></wsdl:output></wsdl:operation><wsdl:operation
name="mul"><soap12:operation style="document"
soapAction="http://tempuri.org/mul"/><wsdl:input><soap12:body
use="literal"/></wsdl:input><wsdl:output><soap12:body
use="literal"/></wsdl:output></wsdl:operation><wsdl:operation
name="div"><soap12:operation style="document"
soapAction="http://tempuri.org/div"/><wsdl:input><soap12:body
use="literal"/></wsdl:input><wsdl:output><soap12:body
use="literal"/></wsdl:output></wsdl:operation><wsdl:operation
name="power"><soap12:operation style="document"
soapAction="http://tempuri.org/power"/><wsdl:input><soap12:body
use="literal"/></wsdl:input><wsdl:output><soap12:body
use="literal"/></wsdl:output></wsdl:operation><wsdl:operation
name="fact"><soap12:operation style="document"
soapAction="http://tempuri.org/fact"/><wsdl:input><soap12:body
use="literal"/></wsdl:input><wsdl:output><soap12:body
use="literal"/></wsdl:output></wsdl:operation></wsdl:binding><wsdl:service
name="Service"><wsdl:port name="ServiceSoap"
binding="tns:ServiceSoap"><soap:address
location="http://localhost:49784/WebSite1/Service.asmx"/></wsdl:port><wsdl:port
name="ServiceSoap12" binding="tns:ServiceSoap12"><soap12:address
location="http://localhost:49784/WebSite1/Service.asmx"/></wsdl:port></wsdl:service
></wsdl:definitions>

ASP.NET CLIENT:
Default.aspx.cs:
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;

www.Vidyarthiplus.com

www.Vidyarthiplus.com

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


{
protected void Page_Load(object sender, EventArgs e)

}
protected void Button1_Click(object sender, EventArgs e)
localhost.Service s = new localhost.Service();
double n1 = double.Parse(TextBox1.Text);
double n2 = double.Parse(TextBox2.Text);
double res = s.add(n1, n2);
TextBox3.Text = Convert.ToString(res);
}
protected void Button2_Click(object sender, EventArgs e)
localhost.Service s = new localhost.Service();
double n1 = double.Parse(TextBox1.Text);
double n2 = double.Parse(TextBox2.Text);
double res = s.sub(n1, n2);
TextBox3.Text = Convert.ToString(res);
}
protected void Button3_Click(object sender, EventArgs e)
localhost.Service s = new localhost.Service();
double n1 = double.Parse(TextBox1.Text);
double n2 = double.Parse(TextBox2.Text);
double res = s.mul(n1, n2);
TextBox3.Text = Convert.ToString(res);
}
protected void Button4_Click(object sender, EventArgs e)
localhost.Service s = new localhost.Service();
double n1 = double.Parse(TextBox1.Text);
double n2 = double.Parse(TextBox2.Text);
double res = s.div(n1, n2);
TextBox3.Text = Convert.ToString(res);
}
protected void Button5_Click(object sender, EventArgs e)
localhost.Service s = new localhost.Service();
double n1 = double.Parse(TextBox1.Text);
double n2 = double.Parse(TextBox2.Text);
double res = s.power(n1, n2);
TextBox3.Text = Convert.ToString(res);
}
protected void Button6_Click(object sender, EventArgs e)
localhost.Service s = new localhost.Service();
long n = long.Parse(TextBox1.Text);
long res = s.fact(n);
TextBox4.Text = Convert.ToString(res); }}

www.Vidyarthiplus.com

www.Vidyarthiplus.com
DESIGN SCREEN:

OUTPUT:

RESULT:
Thus the program to invoke .net component as web service was executed and
verified successfully.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

EX.NO:04 INVOKE EJB COMPONENTS AS WEB SERVICES


DATE:
AIM:
To invoke EJB component as web service using Netbeans IDE.

PROCEDURE:
1)
2)
3)
4)
5)

Start => all programs => netbeans IDE.


Select filename => new project =>java EE => enterprise application.
Give the project name as test service select the glass fishv2.1 server.
Select the test service EJB right click and select new session.
Give the EJB name as test service EJB right click and select session type as
stateless and interface as remote. Give the package name as test package and click
the finish button.
6) Select test service EJB because class insert the business method Get message().
7) Insert the following code inside the get message() method return Helloworld.
8) Right click select insert code option => add business method, give the name as get
message() return type as string.
9) Select index.jsp from testservice.war
10) Insert the following code into the index.jsp <a href=testservlet>
11) Select the file => right click => servlet => package name as servlet
package=>finish.
12) Inside the servlet class right click select insert code => call enterprise
bean=>select and service EJB and click ok.
13) Add the following code outprintln testservice bean get message and click clean
and deploy.

PROGRAM:
ejbsessionBean.java
package pac;
import javax.ejb.Stateless;
@Stateless
public class ejbsessionBean implements ejbsessionRemote {

www.Vidyarthiplus.com

www.Vidyarthiplus.com
public String getmessage() {
return "hello welcome";
}}

ejbservlet.java
package pac;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import javax.ejb.EJB;
import javax.servlet.*;
import javax.servlet.http.*;
import pac.ejbsessionRemote;
import pac.ejbsessionBean;
public class ejbservlet extends HttpServlet {
@EJB
private ejbsessionRemote ejbsessionBean;
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {

www.Vidyarthiplus.com

www.Vidyarthiplus.com
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet ejbservlet</title>");
out.println("</head>");
out.println("<body>");
out.println(ejbsessionBean.getmessage());
out.println("</body>");
out.println("</html>");
} finally {
out.close(); }}

index.jsp
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title></head>
<body><h1>Hello World!</h1>
<a href="ejbservlet">Click here to call the EJB component</a>
</body></html>

ejbsessionRemote.java
package pac;
import javax.ejb.Remote;
@Remote
public interface ejbsessionRemote {
String getmessage();}

www.Vidyarthiplus.com

www.Vidyarthiplus.com

OUTPUT:

RESULT:
Thus the invoking of EJB component as web service using net beans IDE was verified
and executed successfully.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

EX. NO:05

DEVELOPING A SERVICE ORCHESTRATION


ENGINE USING BPEL

DATE:
AIM:
To develop a Service Orchestration Engine (workflow) using WS-BPEL and impleme
service composition for Travel Reservation Service.
PROCEDURE:
1 Creating Travel Reservation Service Sample ProTo create a sample BPEL project:
Choose File > New Project (Ctrl-Shift-N).
In the Categories list, expand the Samples node and select the SOA node.
In the Projects list, select the sample project you want to create and click Next.
In the Name and Location page, name the project and specify the location of project files.
Click Finish.
2 Deploying and Performing Test Runs of BPEL Processes
2.1 Starting the Server
To start or stop a local server from the Services window:
Open the Services window by choosing Window > Services (Ctrl-5) from the main menu.
Expand the Servers node to display the registered server instances.
Right-click the server name and choose an action Start from the pop-up menu.
When you start a server, start up information is displayed in the server tab in the Output
window.
2.2 Building BPEL Module Projects
In the Projects window, right-click the BPEL Module's node and choose Build Project.
Watch for the BUILD SUCCESSFUL message in the Output window.
You can also perform a clean build by right-clicking the BPEL Module's node in the
Projects window and choosing Clean and Build Project.
2.3 Testing the Project
In the Projects window, expand the TravelReservationService1Application project node,
exapand the Test node, and choose any one of the listed services and right click on it and
select Run Option.
OUTPUT:

www.Vidyarthiplus.com

www.Vidyarthiplus.com

OUTPUT:

RESULT:
Thus the program to develop a Service Orchestration Engine (workflow) using WSBPEL and impleme service composition for Travel Reservation Service was executed
successfully.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

EX.NO:06

DEVELOP A J2EE CLIENT TO


ACCESS A .NET WEB SERVICE

DATE:
AIM:
To write a program for invoking J2EE web service in asp.net using c#.

PROCEDURE:
Procedure for creating a java web service:
1) Create a web application project
2) Start the Netbeans IDE-> go to the New Project which is available under File
menu.The New Project wizard opens.
3) Select the web from categories options and web application from project section
and then press the next button.
4) On the next screen mention the project name, select the project location. Also
mention the server name in which we want to deploy our web application
5) Mention the project name JCalcWebService ,use GlassFish V2 application server
for deployment.
6) Click the finish button
7) Right click on the project name in the Projects explorer window.
8) From the context menu options select the Web Service menu. A web service
dialog opens.
9) Mention the web service name and the package name and then click the finish
button.
10) In this example the web service name is JSimpCalcWebService and the package
name is calc package.
11) Add the following web service operation or WebMethod through design mode.
12) Then write the code for all the webservice methods
13) Copy the URL of the WSDL file.
Procedure for creating a .Net Client in ASP.Net using C#:
1) Create a ASP.net web site
2) Start Visual Studio 2008 go to the New Web Site ,which is available
under File menu.
3) Select ASP.net Web Site.

www.Vidyarthiplus.com

www.Vidyarthiplus.com
4) Select the folder in which to create the web site as
JSimpCalcWebServiceWebSite
5) Select the language as Visual C# and click OK button.
6) To Add the web reference ,mention the WSDL file in the web site. To add the
web service reference perform the following steps:
7) Give a name to the web reference (in this example its JSimpCalcWebService)
and click the Add Reference button.
8) Design an ASP.net page. The default fie name is Default.aspx
9) Induce the web reference in to the code (i.e. Default.aspx.cs).
10) Now, access the WebMethod like the following method call.
11) Test web service client application by clicking on the Start Debugging toolbar
button or pressing F5 key

PROGRAM:
WEB SERVICE
package calc;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
@WebService()
public class JSimpCalcWebService {
@WebMethod(operationName = "addition")
public String addition(@WebParam(name = "parameter1")
double parameter1, @WebParam(name = "parameter2")
double parameter2) {
return NumberFormater.format((parameter1 + parameter2),0,6);
}
@WebMethod(operationName = "subtraction")
public String subtraction(@WebParam(name = "parameter1")

www.Vidyarthiplus.com

www.Vidyarthiplus.com
double parameter1, @WebParam(name = "parameter2")
double parameter2) {
return NumberFormater.format((parameter1 - parameter2),0,6);
}
@WebMethod(operationName = "multiplication")
public String multiplication(@WebParam(name = "parameter1")
double parameter1, @WebParam(name = "parameter2")
double parameter2) {
return NumberFormater.format((parameter1 * parameter2),0,6);
}
@WebMethod(operationName = "division")
public String division(@WebParam(name = "parameter1")
double parameter1, @WebParam(name = "parameter2")
double parameter2) {
return NumberFormater.format((parameter1 / parameter2),0,6);
}
@WebMethod(operationName = "power")
public String power(@WebParam(name = "parameter1")
double parameter1, @WebParam(name = "parameter2")
double parameter2) {
return NumberFormater.format(Math.pow(parameter1, parameter2),0,6);
}
@WebMethod(operationName = "mininum")
public String mininum(@WebParam(name = "parameter1")
double parameter1, @WebParam(name = "parameter2")

www.Vidyarthiplus.com

www.Vidyarthiplus.com
double parameter2) {
return NumberFormater.format(Math.min(parameter1, parameter2),0,6);
} @WebMethod(operationName = "maxminum")
public String maxminum(@WebParam(name = "parameter1")
double parameter1, @WebParam(name = "parameter2")
double parameter2) {
return NumberFormater.format(Math.max(parameter1, parameter2),0,6);
}}
WEB SITE:
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 JSimpCalcWebServiceService;
public partial class _Default : System.Web.UI.Page{
JSimpCalcWebServiceService.JSimpCalcWebServiceService proxy;
protected void Page_Load(object sender, EventArgs e){
proxy = new JSimpCalcWebServiceService.JSimpCalcWebServiceService();

www.Vidyarthiplus.com

www.Vidyarthiplus.com
}
protected void Button1_Click(object sender, EventArgs e){
resadd.Text="Result:" +
proxy.addition(double.Parse(param1add.Text),double.Parse(param2add.Text));
}
protected void Button2_Click(object sender, EventArgs e){
ressub.Text = "Result: " + proxy.subtraction(double.Parse(param1sub.Text),
double.Parse(param2sub.Text));
}
protected void Button3_Click(object sender, EventArgs e){
resmul.Text= "Result: " + proxy.multiplication(double.Parse(param1mul.Text),
double.Parse(param2mul.Text));
}
protected void Button4_Click(object sender, EventArgs e){
resdiv.Text = "Result: " + proxy.division(double.Parse(param1div.Text),
double.Parse(param2div.Text));
}
protected void Button5_Click(object sender, EventArgs e){
respow.Text= "Result: " + proxy.power(double.Parse(param1pow.Text),
double.Parse(param2pow.Text));
}
protected void Button6_Click(object sender, EventArgs e){
resminmax.Text = "Result: " + proxy.mininum(double.Parse(param1ma.Text),
double.Parse(param2ma.Text));
}

www.Vidyarthiplus.com

www.Vidyarthiplus.com
catch (FormatException)
protected void Button7_Click(object sender, EventArgs e){
resminmax.Text = "Result: " + proxy.maxminum(double.Parse(param1ma.Text),
double.Parse(param2ma.Text));
}}

OUTPUT:

RESULT:
Thus the invoking of J2EE web service in asp.net using c# was verified and
Executed successfully.

www.Vidyarthiplus.com

www.Vidyarthiplus.com

EX.NO:07

INVOKING ASP.NET WEBSERVICE USING


J2EE

DATE:
AIM:
To write a program for invoking ASP.NET webservice using J2EE.

PROCEDURE:
1) Start the program.
2) Create a new webservice using file->new website->ASP.NET wes service and then select
c# language and then click ok.
3) Write the code for addition, then run the program.
4) Then copy the wsdlurl(http://localhost:1066/WebSite4/Service.asmx?wsd)
5) Open the netbeans goto file->new project->java web->java web application.
6) Give the name for project and click finish.
7) Right click the project goto new->web service client, select wsdl url option and then
paste the
url click finish.
8) Write the code in index file.
9) Again right click the project goto new->jsp file.
10) Give the name for jsp then click finish.
11) In the jsp file right click select call wes service-> select addition operation.
12) Include the coding in jsp file.
13) Finally deploye and run the file.

PROGRAM:
WEBSERVICE
using System;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;

www.Vidyarthiplus.com

www.Vidyarthiplus.com
using System.Xml.Linq;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// 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 Service : System.Web.Services.WebService
{
public Service () {}
[WebMethod]
public string HelloWorld() {
return "Hello World";
}
[WebMethod]
public string addition(int a,int b)
{
int c = a + b;
return "Result of addition is"+c;
}
[WebMethod]
public string subtraction(int a, int b)
{
int c = a - b;
return "Result of subtraction is" + c;

www.Vidyarthiplus.com

www.Vidyarthiplus.com
}
[WebMethod]
public string multiplication(int a, int b)
{
int c = a * b;
return "Result of multiplication is" + c;
}}
INDEX.JSP
<%@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>
<h1>Hello World!</h1>
<form name="frm" action="serv.jsp" method="GET">
Enter the num1:<input type="text" name="xval"><br>
Enter the num2:<input type="text" name="yval"><br>
<input type="submit" value="click to invoke .net">
</form>
</body>
</html>

www.Vidyarthiplus.com

www.Vidyarthiplus.com
SERV.JSP
<%@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>
<h1>Hello World!</h1>
<%-- start web service invocation --%><hr/><%
try {
org.tempuri.Service service = new org.tempuri.Service();
org.tempuri.ServiceSoap port = service.getServiceSoap();
// TODO initialize WS operation arguments here
int a = Integer.parseInt(request.getParameter("xval"));
int b =Integer.parseInt(request.getParameter("yval")) ;
// TODO process result here
java.lang.String result = port.addition(a, b);
java.lang.String result2 = port.multiplication(a, b);
out.println(result);
out.println("\n\n");
out.println(result1);
out.println("\n\n");
out.println(result2);
} catch (Exception ex) {
}%>
<%-- end web service invocation --%><hr/>

www.Vidyarthiplus.com

www.Vidyarthiplus.com
</body></html>

OUTPUT:

RESULT:
Thus the invoking of ASP.NET web service using J2EE was executed and verified
Successfully.

www.Vidyarthiplus.com

Вам также может понравиться