lab record final

73
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

Upload: vijaybtech

Post on 14-Sep-2015

238 views

Category:

Documents


0 download

DESCRIPTION

SOA Record in .Net and EJB

TRANSCRIPT

  • 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 DATE EXPREMENTS MARK SIGNATURE

    01(a) TIME STAMP COMPONENT USING .NET

    01(b) INTEREST CALCULATION COMPONENT USING .NET

    01(c) ORDER PROCESSING COMPONENT USING .NET

    01(d) TEMPERATURE CONVERSION COMPONENT USING .NET

    01(e) CURRENCY CONVERTER COMPONENT USING .NET

    02(a) ORDERPROCESSING COMPONENT USING EJB

    02(b) INTEREST CALCULATION COMPONENT USING EJB

    02(c) PAYMENT PROCESSING COMPONENT USING EJB

    02(d) TEMPERATURECONVERSION COMPONENT USING EJB

    02(e) FINDING POWER ALUE COMPONENT USING EJB

    03 INVOKE .NET COMPONENTS AS WEB SERVICES

    04 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.

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

    www.Vidyarthiplus.com

    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.Object, ByVal e 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.Object, ByVal e 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

    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 e As

    System.EventArgs) Handles MyBase.Load

    con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0; Data

    Source=C:\Documents and Settings\student\My Documents\Visual Studio

    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

    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 e As

    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 e As

    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 e As

    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 e As

    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 e As

    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

    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 e As

    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 e As

    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 Box",

    MessageBoxButtons.OK)

    inc = 0

    NavigateRecords()

    End Sub

    Private Sub Clearbtn_Click(ByVal sender As System.Object, ByVal e As

    System.EventArgs) Handles Clearbtn.Click

    Commitbtn.Enabled = False

    Addbtn.Enabled = True

    Updatebtn.Enabled = True

    Deletebtn.Enabled = True

    inc = 0

    txtFirstName.Clear()

    www.Vidyarthiplus.com

    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) 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 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) 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 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
  • out.println("");

    out.println("");

    } 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("");

    out.println("");

    out.println("Power value calculation");

    out.println("");

    out.println("");

    out.println("the result of"+a+"power"+b+"is"

    +powersessionBean.findpower(a,b)+"");

    out.println("");

    out.println("");

    }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:

    Power servlet

    Welcome to Power Calculation

    Enter the value of x:

    Enter the value of y:

    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

  • 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"

    double

    double

    HTTP/1.1 200 OK

    Content-Type: text/xml; charset=utf-8

    Content-Length: length

    double

    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"

    double

    double

    HTTP/1.1 200 OK

    Content-Type: text/xml; charset=utf-8

    Content-Length: length

    double

    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"

    long

    HTTP/1.1 200 OK

    Content-Type: text/xml; charset=utf-8

    Content-Length: length

    long

    www.Vidyarthiplus.com

    www.Vidyarthiplus.com

  • 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"

    double

    double

    HTTP/1.1 200 OK

    Content-Type: text/xml; charset=utf-8

    Content-Length: length

    www.Vidyarthiplus.com

    www.Vidyarthiplus.com

  • double

    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"

    double

    double

    www.Vidyarthiplus.com

    www.Vidyarthiplus.com

  • HTTP/1.1 200 OK

    Content-Type: text/xml; charset=utf-8

    Content-Length: length

    double

  • double

    double

    HTTP/1.1 200 OK

    Content-Type: text/xml; charset=utf-8

    Content-Length: length

    double

    WSDL URL:

    http://localhost:49784/WebSite1/Service.asmx?WSDL

  • name="add">
  • minOccurs="1"/>
  • message="tns:factSoapOut"/>
  • use="literal"/>

    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) Start => all programs => netbeans IDE.

    2) Select filename => new project =>java EE => enterprise application.

    3) Give the project name as test service select the glass fishv2.1 server.

    4) Select the test service EJB right click and select new session.

    5) 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

    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("");

    out.println("");

    out.println("Servlet ejbservlet");

    out.println("");

    out.println("");

    out.println(ejbsessionBean.getmessage());

    out.println("");

    out.println("");

    } finally {

    out.close(); }}

    index.jsp

    JSP Page

    Hello World!

    Click here to call the EJB component

    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 WS-

    BPEL 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

    JSP Page

    Hello World!

    Enter the num1:

    Enter the num2:

    www.Vidyarthiplus.com

    www.Vidyarthiplus.com

  • SERV.JSP

    JSP Page

    Hello World!

    www.Vidyarthiplus.com

    www.Vidyarthiplus.com

  • OUTPUT:

    RESULT:

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

    Successfully.

    www.Vidyarthiplus.com

    www.Vidyarthiplus.com