labmanual soa it2406

Upload: rama-rajesh

Post on 16-Oct-2015

75 views

Category:

Documents


0 download

DESCRIPTION

Lab Mannual

TRANSCRIPT

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    OMSAKTHI

    ADHIPARASAKTHI ENGINEERING COLLEGE

    MELMARUVATHUR

    DEPARTMENT OF INFORMATION TECHNOLOGY

    IT2406-SERVICE ORIENTED ARCHITECTURE LABORATORY

    IV YEAR/VII SEMESTER

    Presented By

    Ms.R.MANIMOZHI Lect.

    Mr.P.ELUMALAIVASAN, Asst.Prof

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    LIST OF EXPERIMENTS

    SNO EXPERIMENT NAME PAGE NO

    1 Creation of web service for addition operation 3

    2 Creation of web service client for finding factorial number 5

    3 Login web service 8

    4 Implementation of calculator and simple and compound interest

    calculation using .Net

    13

    5 To develop student detail using .Net 20

    6 Invoke EJB components as web services 27

    7 EJB components for finding power value 30

    8 Invoking J2EE web service in ASP.Net using C# 36

    9 Create addition web service in ASP.Net invoke it in using C# 41

    10 Invoking ASP.Net web service using J2EE 45

    11 Implementation of Orchestration with BPEL to Add Two Numbers 49

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    Ex.No:1 CREATION OF WEB SERVICE FOR ADDITION OPERATION

    AIM:

    To write a program for creation of web service for addition operation.

    PROCEDURE:

    1: Using the Netbeans API create a project of the type web application.

    2: Create a web service in the project.

    3: Click on the design tab and modify the application logic web services.

    4: Save the project.

    5: Right click on the project and click on deploy and undeploy.

    6: Then test the web service.

    PROGRAM

    package pac;

    import javax.jws.WebMethod;

    import javax.jws.WebService;

    import javax.jws.WebParam;

    import javax.jws.WebService;

    @WebService()

    public class addservicce {

    @WebMethod(operationName = "add")

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

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

    int b) {

    int c=a+b;

    return c; }

    }

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    OUTPUT:

    RESULT:

    Thus the creation of web service for addition operation was verified and executed successfully.

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    Ex.No:2 CREATION OF WEB SERVICE CLIENT FOR FINDING

    FACTORIAL NUMBER

    AIM:

    To create a web service client for finding factorial of given number using Net Beans6.5

    PROCEDURE:

    1. In the Net Beans6.5 create a project for factorial in server side using file->new project.

    2. After creating the project right click the project and select new->web service

    3. Then right click the web service name and select add operation.

    4. Include all variable and the data type then click ok.

    5. Then write the code for factorial.

    6. After again create a project for factorial in client side using file->new project.

    7. After creating the project right click the project and select new->web service client.

    8. Then browse and choose the factorial server project then click ok.

    9. Again right click the client project and choose new->jsp file then give the name for jsp

    file.

    10. In the JSP file right click and choose web service client resource->call web service

    operation.

    11. Then select server project click ok.

    12. In the index file create a form and include jsp file as action.

    13. Finally deploy the client project and run the file to get the output.

    PROGRAM:

    Fact.java

    package fact;

    import javax.jws.WebMethod;

    import javax.jws.WebParam;

    import javax.jws.WebService;

    @WebService()

    public class fact {

    @WebMethod(operationName = "f1")

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

    int a) {

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    int fact=1;

    for(int i=1;i

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    Enter the value:

    OUTPUT:

    RESULT:

    Thus the creation of web service client for finding the factorial number was verified and

    executed successfully.

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    Ex.No:3 LOGIN WEB SERVICE

    AIM:

    To create a login webpage for used to accessing the operations are add user, and test the

    service, invoke the two operations using the JSPclient.

    PROCEDURE:

    Step 1: Open Net beans IDE, which has the Glassfish server by default.

    Step 2: In Net beans take a new web project. Provide the web application name. and

    select the server name. (Glassfish v2.1 (or) above version)

    Step 3: In the web service project, select new web service. And give web service

    name & package name.

    Step 4: Now in design view of the web services, add the operation and

    parameters that are going to be used in web services application.

    Step 5: Now in source view change the return value null into some string value.

    Step 6: Finally deploy it on the server and test the web service program.

    Step 7: Create a client file from web projects and specify the WSDL file of the

    web services.

    Step 8: Create a client environments for the web services in the project.

    (client.jsp).

    Step 9: Specify the operation name into web service client resources.

    Step 10: Execute the web service client file.

    PROGRAM:

    WEBSERVICE.JAVA

    package loginpack;

    import java.util.ArrayList;

    import java.util.List;

    import javax.jws.WebMethod;

    import javax.jws.WebParam;

    import javax.jws.WebService;

    @WebService()

    public class loginservice {

    List users;

    public loginservice() {

    users=new ArrayList();

    }

    @WebMethod(operationName = "addUser")

    public boolean addUser(@WebParam(name = "Login")

    String Login, @WebParam(name = "Password")

    String Password) {

    User user = new User();

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    user.setLogin(Login);

    user.setPassword(Password);

    if(!users.contains(user)) { //if the user is not already on the list

    users.add(user); // add the user and return true to say everything has gone OK

    return true;

    } else { // user is already on the list.

    return false; // Return false to say no one has been added to the list

    } }

    @WebMethod(operationName = "checkUser")

    public boolean checkUser(@WebParam(name = "Login")

    String Login, @WebParam(name = "Password")

    String Password) {

    User user = new User();

    user.setLogin(Login);

    user.setPassword(Password);

    if(users.contains(user)) { //if the user is on the list

    return true; // let it login, return OK

    } else { // user isn't on the list

    return false; // return 'there is a problem here'

    } }}

    USER CLASS:

    package loginpack;

    class User {

    String Login;

    String Password;

    public String getLogin() {

    return Login;

    } public void setLogin(String Login) {

    this.Login = Login;

    }

    public String getPassword() {

    return Password;

    }

    public void setPassword(String Password) {

    this.Password = Password;

    }

    @Override

    public boolean equals(Object obj) {

    if (obj == null) {

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    return false;

    }

    if (getClass() != obj.getClass()) {

    return false;

    }

    final User other = (User) obj;

    if ((this.Login == null) ? (other.Login != null) : !this.Login.equals(other.Login)) {

    return false;

    }

    if ((this.Password == null) ? (other.Password != null) :

    !this.Password.equals(other.Password)) {

    return false;}

    return true; }

    @Override

    public int hashCode() {

    int hash = 7;

    hash = 23 * hash + (this.Login != null ? this.Login.hashCode() : 0);

    hash = 23 * hash + (this.Password != null ? this.Password.hashCode() : 0);

    return hash;

    }}

    CLIENT JSP:

    JSP Page

    Hello World!

    UserName:

    Password:

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    LOGIN JSP:

    JSP Page

    Hello World!

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    OUTPUT:

    RESULT:

    Thus the create of login webpage for used to accessing the operations are add user, and

    test the service, invoke the two operations using the JSPclient was verified successfully.

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    Ex.No:4 IMPLEMENTATION OF CALCULATOR AND SIMPLE AND

    COMPOUND INTEREST CALCULATION USING .NET

    AIM:

    To write a program for implemention of calculator and to calculate simple and compound

    intrest using .NET.

    PROCEDURE:

    1. Start

    2. To create a document and check for User Id and password

    3. If valid user they can proceed or else have to register again

    4. With the help of calculator we can process addition(+), multiplication(*),

    Subtraction(-) and division(/)

    5. For calculating simple and complex interest we should have the inputs as

    Interest, rate, amount and years

    6. With the help of the formula we can calculate simple interest

    interest = (principal * years * rate) / 100

    7. Stop.

    PROGRAM:

    Loginform.vb

    Public Class loginform

    Public flag As Integer

    Private Sub okbut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles okbut.Click

    If utxt.Text = "" Then utxt.Focus() : Exit Sub

    If ptxt.Text = "" Then ptxt.Focus() : Exit Sub

    If LCase(ptxt.Text) = LCase("sri") Then

    MessageBox.Show("Welcome to VB.NET ", "Welcome Dialog ",

    MessageBoxButtons.OK, MessageBoxIcon.Information,

    MessageBoxDefaultButton.Button1)

    Login().Hide()

    calc.Show()

    Else

    MsgBox("Invalid password.Please try again!", MsgBoxStyle.Exclamation)

    ptxt.Focus()

    End If

    End Sub

    Private Sub cancelbut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles canbut.Click

    Me.Close()

    End Sub

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    Private Sub SimpleCalculatorToolStripMenuItem_Click(ByVal sender As System.Object, ByVal

    e As System.EventArgs) Handles SimpleCalculatorToolStripMenuItem.Click

    flag = 1

    Login.Show()

    End Sub

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

    System.EventArgs) Handles SICIToolStripMenuItem.Click

    flag = 2

    Login.Show()

    End Sub

    Private Sub loginform_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles MyBase.Load

    Login.Hide()

    End Sub

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

    System.EventArgs) Handles CalculationToolStripMenuItem.Click

    Login.Hide()

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles Button1.Click

    utxt.Clear()

    ptxt.Clear()

    End Sub

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

    System.EventArgs) Handles EXITToolStripMenuItem.Click

    End

    End Sub

    Private Sub utxt_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles utxt.TextChanged

    End Sub

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

    System.Windows.Forms.PaintEventArgs) Handles Login.Paint

    End SubEnd Class

    Calc.vb

    Public Class calc

    Dim Multiplier As String

    Dim Calc1, Calc2 As Integer

    Dim principal, years As Integer

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    Dim rate, interest, amount As Single

    Private Sub calc_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles MyBase.Load

    If loginform.flag = 1 Then

    calpanel.Show()

    sicipanel.Hide()

    Else

    calpanel.Hide()

    sicipanel.Show()

    End If

    End Sub

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

    System.Windows.Forms.PaintEventArgs) Handles calpanel.Paint

    End Sub

    Private Sub clearbut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles clearbut.Click

    caltxt.Clear()

    Multiplier = Nothing

    Calc1 = Nothing

    End Sub

    Private Sub onebut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles onebut.Click

    caltxt.Text = Val(caltxt.Text) & 1

    End Sub

    Private Sub twobut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles twobut.Click

    caltxt.Text = Val(caltxt.Text) & 2

    End Sub

    Private Sub threebut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles threebut.Click

    caltxt.Text = Val(caltxt.Text) & 3

    End Sub

    Private Sub fourbut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles fourbut.Click

    caltxt.Text = Val(caltxt.Text) & 4

    End Sub

    Private Sub fivebut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles fivebut.Click

    caltxt.Text = Val(caltxt.Text) & 5

    End Sub

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    Private Sub sixbut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles sixbut.Click

    caltxt.Text = Val(caltxt.Text) & 6

    End Sub

    Private Sub sevbut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles sevbut.Click

    caltxt.Text = Val(caltxt.Text) & 7

    End Sub

    Private Sub eigbut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles eigbut.Click

    caltxt.Text = Val(caltxt.Text) & 8

    End Sub

    Private Sub ninebut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles ninebut.Click

    caltxt.Text = Val(caltxt.Text) & 9

    End Sub

    Private Sub zerobut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles zerobut.Click

    caltxt.Text = Val(caltxt.Text) & 0

    End Sub

    Private Sub mulbut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles mulbut.Click

    Multiplier = "*"

    Calc1 = caltxt.Text

    caltxt.Text = ""

    End Sub

    Private Sub plusbut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles plusbut.Click

    Multiplier = "+"

    Calc1 = caltxt.Text

    caltxt.Text = ""

    End Sub

    Private Sub minusbut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles minusbut.Click

    Multiplier = "-"

    Calc1 = caltxt.Text

    caltxt.Text = ""

    End Sub

    Private Sub divbut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles divbut.Click

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    Multiplier = "/"

    Calc1 = caltxt.Text

    caltxt.Text = ""

    End Sub

    Private Sub eubut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles eubut.Click

    Calc2 = caltxt.Text

    If Multiplier = "*" Then

    caltxt.Text = Val(Calc1) * Val(Calc2)

    End If

    If Multiplier = "+" Then

    caltxt.Text = Val(Calc1) + Val(Calc2)

    End If

    If Multiplier = "/" Then

    caltxt.Text = Val(Calc1) / Val(Calc2)

    End If

    If Multiplier = "-" Then

    caltxt.Text = Val(Calc1) - Val(Calc2)

    End If

    End Sub

    Private Sub calbut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles calbut.Click

    principal = principletxt.Text

    years = monthtxt.Text()

    rate = ratetxt.Text

    If siopt.Checked = True Then

    interest = (principal * years * rate) / 100

    Else

    amount = principal * Math.Pow((1 + rate / 100), years)

    interest = amount - principal

    End If

    interesttxt.Text = interest

    End Sub

    Private Sub clearbutt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles clearbutt.Click

    principletxt.Text = ""

    monthtxt.Text = ""

    ratetxt.Text = ""

    interesttxt.Text = ""

    End Sub

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    Private Sub exitbut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles exitbut.Click

    Me.Hide()

    loginform.Show()

    End Sub

    End Class

    OUTPUT:

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    RESULT:

    Thus the implemention of calculator and to calculate simple and compound intrest using

    .NET was verified succesfully.

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    Ex.No:5 TO DEVELOP STUDENT DETAILUSING .NET

    AIM:

    To write a program for developing student detail using .Net

    PROCEDURE:

    1. using the visual basic 2008,we can create web application name as login student

    2. Inside the login, we can create the user name, department, register number, exit, then

    move first, move last, move up, move next, some add new, delete, update, clear, exit.

    3. Using the Microsoft we can create object naming field as student name, department,

    register number, email id.

    4. Using coding we can connect the database and visual basic.Net coding.

    5. Get the details from database using following coding, using button, we can see the

    last student name.

    6. Add new button is used to add data vb.

    7. stop

    PROGRAM:

    Student.vb

    Public Class Form1

    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 Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles MyBase.Load

    'dbProvider = "PROVIDER=Microsoft.Jet.OLEDB.4.0;"

    'dbSource = "Data Source = C:\soa\studdb.mdb"

    'con.ConnectionString = dbProvider & dbSource

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

    C:\studdb.mdb"

    con.Open()

    sql = "SELECT * FROM studtable"

    da = New OleDb.OleDbDataAdapter(sql, con)

    da.Fill(ds, "AddressBook")

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    MsgBox("Database is now open")

    con.Close()

    MaxRows = ds.Tables("AddressBook").Rows.Count

    inc = -1

    MsgBox("Database is now Closed")

    End Sub

    Private Sub navigate()

    nametxt.Text = ds.Tables("AddressBook").Rows(inc).Item(0)

    regtxt.Text = ds.Tables("AddressBook").Rows(inc).Item(1)

    depttxt.Text = ds.Tables("AddressBook").Rows(inc).Item(2)

    emailtxt.Text = ds.Tables("AddressBook").Rows(inc).Item(3)

    agetxt.Text = ds.Tables("AddressBook").Rows(inc).Item(4)

    phnetxt.Text = ds.Tables("AddressBook").Rows(inc).Item(5)

    semtxt.Text = ds.Tables("AddressBook").Rows(inc).Item(6)

    End Sub

    Private Sub first_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles first.Click

    If inc 0 Then

    inc = 0

    navigate()

    End If

    End Sub

    Private Sub prev_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles prev.Click

    If inc > 0 Then

    inc = inc - 1

    navigate()

    Else

    MsgBox("First Record")

    End If

    End Sub

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

    System.EventArgs) Handles nextbutton.Click

    If inc MaxRows - 1 Then

    inc = inc + 1

    navigate()

    Else

    MsgBox("No More Rows")

    End If

    End Sub

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    Private Sub last_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles last.Click

    If inc MaxRows - 1 Then

    inc = MaxRows - 1

    navigate()

    End If

    End Sub

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

    System.EventArgs) Handles addbut.Click

    savebut.Enabled = True

    addbut.Enabled = False

    updatebut.Enabled = False

    delbut.Enabled = False

    cancelbut.Enabled = True

    nametxt.Text = ""

    regtxt.Text = ""

    depttxt.Text = ""

    emailtxt.Text = ""

    agetxt.Text = ""

    phnetxt.Text = ""

    semtxt.Text = ""

    End Sub

    Private Sub delbut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles delbut.Click

    Dim cb As New OleDb.OleDbCommandBuilder(da)

    ds.Tables("AddressBook").Rows(inc).Delete()

    MessageBox.Show("The Current Record Was deleted", "Delete Dialog Box",

    MessageBoxButtons.OK)

    da.Update(ds, "AddressBook")

    MaxRows = MaxRows - 1

    inc = 0

    navigate()

    End Sub

    Private Sub clearbut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles clearbut.Click

    nametxt.Text = ""

    regtxt.Text = ""

    depttxt.Text = ""

    emailtxt.Text = ""

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    agetxt.Text = ""

    phnetxt.Text = ""

    semtxt.Text = ""

    End Sub

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

    System.EventArgs) Handles savebut.Click

    Dim cb As New OleDb.OleDbCommandBuilder(da)

    Dim dsNewRow As DataRow

    dsNewRow = ds.Tables("AddressBook").NewRow()

    dsNewRow.Item(0) = nametxt.Text

    dsNewRow.Item(1) = Val(regtxt.Text)

    dsNewRow.Item(2) = depttxt.Text

    dsNewRow.Item(3) = emailtxt.Text

    dsNewRow.Item(4) = Val(agetxt.Text)

    dsNewRow.Item(5) = Val(phnetxt.Text)

    dsNewRow.Item(6) = Val(semtxt.Text)

    ds.Tables("Addressbook").Rows.Add(dsNewRow)

    da.Update(ds, "AddressBook")

    MsgBox("New Record added to the Database")

    MaxRows = MaxRows + 1

    savebut.Enabled = False

    addbut.Enabled = True

    updatebut.Enabled = True

    delbut.Enabled = True

    End Sub

    Private Sub exitbut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles exitbut.Click

    End

    End Sub

    Private Sub updatebut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles updatebut.Click

    Dim cb As New OleDb.OleDbCommandBuilder(da)

    Dim dsNewRow As DataRow

    ds.Tables("AddressBook").Rows(inc).Item(0) = nametxt.Text

    ds.Tables("AddressBook").Rows(inc).Item(1) = Val(regtxt.Text)

    ds.Tables("AddressBook").Rows(inc).Item(2) = depttxt.Text

    ds.Tables("AddressBook").Rows(inc).Item(3) = emailtxt.Text

    ds.Tables("AddressBook").Rows(inc).Item(4) = Val(agetxt.Text)

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    ds.Tables("AddressBook").Rows(inc).Item(5) = Val(phnetxt.Text)

    ds.Tables("AddressBook").Rows(inc).Item(6) = Val(semtxt.Text)

    da.Update(ds, "AddressBook")

    MsgBox("Data was updated")

    End Sub

    Private Sub cancelbut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Handles cancelbut.Click

    savebut.Enabled = False

    addbut.Enabled = True

    updatebut.Enabled = True

    delbut.Enabled = True

    cancelbut.Enabled = False

    inc = 0

    navigate()

    End Sub

    OUTPUT:

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    RESULT:

    Thus the program for developing student detail using .NET is executed successfully.

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    Ex.No:6 INVOKE EJB COMPONENTS AS WEB SERVICES

    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 {

    public String getmessage() {

    return "hello welcome";

    }}

    ejbservlet.java

    package pac;

    import java.io.IOException;

    import java.io.PrintWriter;

    import javax.servlet.ServletException;

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    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 {

    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

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    ejbsessionRemote.java

    package pac;

    import javax.ejb.Remote;

    @Remote

    public interface ejbsessionRemote {

    String getmessage();

    }

    Output:

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    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 V+ TEAM

    Ex.No:7 EJB COMPONENTS FOR FINDING POWER VALUE

    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;

    for(int i=0;i

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

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

    out.println("");

    out.println("Servlet powerservlet");

    out.println("");

    out.println("");

    out.println("Servlet powerservlet at " + request.getContextPath () + "");

    out.println("");

    out.println("");

    } finally {

    out.close();

    }

    }

    @Override

    protected void doGet(HttpServletRequest request, HttpServletResponse response)

    throws ServletException, IOException {

    int a,b;

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

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

    }

    @Override

    protected void doPost(HttpServletRequest request, HttpServletResponse response)

    throws ServletException, IOException {

    processRequest(request, response);

    }

    @Override

    public String getServletInfo() {

    return "Short description";

    }}

    Index.jsp:

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    "http://www.w3.org/TR/html4/loose.dtd">

    Power servlet

    Welcome to Power Calculation

    Enter the value of x:

    Enter the value of y:

    OUTPUT:

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    RESULT:

    Thus the EJP components for finding power value was verified and executed

    successfully.

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    Ex.No:8 INVOKING J2EE WEBSERVICE IN ASP.NET USING C#

    AIM:

    To write a program for invoking J@EE 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

    calcpackage.

    11. Add the following web service operation or WebMethod through design mode.

    a. Addition(double parameter1,double parameter2)

    b. Subtraction(double parameter1,double parameter2)

    c. Multiplication(double parameter1,double parameter2)

    d. Division(double parameter1,double parameter2)

    e. Power(double parameter1,double parameter2)

    f. Minimum(double parameter1,double parameter2)

    g. Maximum(double parameter1,double parameter2)

    12. Then write the code for all the webservice methods

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    a. Deploy the application and test the webservice

    13. Copy the URL of the WSDL file.

    a. http://localhost:8080/ JCalcWebService / JCalcWebService Service?ws

    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.

    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:

    a. Go to Solution Explorer window.

    b. Right click on the project name (in this case its JSimpCalcWebServiceWebSite).

    A context menu pops up.

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

    d. Copy and paste the WSDL URL from the web browers address to Add Web

    Reference dialogs address bar and press go button

    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). For example:

    a. using JSimpCalcWe bServiceService;

    b. Next, create the object of the web reference.

    c. The add the following lines

    JSimpCalcWebServiceService.JSimpCalcWebServiceService proxy = new

    JSimpCalcWebServiceService.JSimpCalcWebServiceService();

    10. Now, access the WebMethod like the following method call.

    a. proxy.addition(10,20); similarly invoke for all the other methods.

    11. Test web service client application by clicking on the Start Debugging toolbar button or

    pressing F5 key

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

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

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

    }

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    @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")

    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

    {

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    JSimpCalcWebServiceService.JSimpCalcWebServiceService proxy;

    protected void Page_Load(object sender, EventArgs e)

    {

    proxy = new JSimpCalcWebServiceService.JSimpCalcWebServiceService();

    }

    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 V+ TEAM

    }

    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 V+ TEAM

    Ex.No:9 CREATE ADDITION WEBSERVICE IN ASP.NET INVOKE

    IT IN USING C#

    AIM:

    To write a program for creation of addition webservice in ASP.NET in invoke it using c#.

    PROCEDURE:

    Start the program.

    1. Create a new webservice using file->new website->ASP.NET wes service and then

    select c# language and then click ok.

    2. Write the code for addition, then run the program.

    3. Then copy the wsdlurl(http://localhost:1066/WebSite4/Service.asmx?wsdl).

    4. Again create a new website using file->new website->ASP.NET web site then select c#

    language and then click ok.

    5. Right click on the website then go to add web reference, paste the wsdl

    url(http://localhost:1066/WebSite4/Service.asmx?wsdl).

    6. Then click go.

    7. Give the reference name click ok.

    8. Desing the form and add the coding.

    9. Finally run the program.

    PROGRAM:

    WEB SERVICE:

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

    uncomment the following line.

    public class Service : System.Web.Services.WebService

    {

    public Service()

    {

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    }

    [WebMethod]

    public string HelloWorld()

    {

    return "Hello World";

    }

    [WebMethod]

    public string Addition(int a, int b)

    {

    int c = a + b;

    return "Result:" + c;

    }

    }

    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 addservice;

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

    {

    addservice.Service proxy;

    protected void Page_Load(object sender, EventArgs e)

    {

    proxy = new addservice.Service();

    }

    protected void butadd_Click(object sender, EventArgs e)

    {

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    rsltlbl.Text = proxy.Addition(int.Parse(Txt1.Text), int.Parse(Txt2.Text));

    }

    }

    OUTPUT:

    RESULT:

    Thus the creation of addition of webservice in ASP.NET in invoke it using

    c# was verified and executed successfully.

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    EX.NO:10 INVOKING ASP.NET WEBSERVICE USING J2EE

    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?wsdl).

    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;

    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 () {}

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    [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;

    }

    [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 V+ TEAM

    SERV.JSP

    JSP Page

    Hello World!

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    OUTPUT:

    RESULT: Thus the invoking of ASP.NET webservice using J2EE was executed and verified

    successfully.

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    EX.NO:11 IMPLEMENTATION OF ORCHESTRATION WITH BPEL TO ADD TWO

    NUMBERS

    AIM:

    To write a program for implementation of orchestration with BPEL to addition of two

    numbers using net bean6.5 IDE.

    PROCEDURE: PROCEDURE FOR CREATING ADDITION WEB SERVICE:

    1. Open the net bean IDE. 2. File->new project->java web->web application and click next. 3. Give the project name, then right click on the project and select new->web

    service give the web service name and click finish.

    4. A new web service is created, then right on the web service and click an application give the operation name as add return type as int and two

    parameter.

    5. Deploy the web service and then test web service.

    PROCEDURE FOR CREATING A BPEL MODULE:

    1. Open net bean IDE. 2. Click on file->new->soa->bpel module. 3. Right click on the project and create a new bpel process. 4. Drag the 0 item under web service in created service and drag to the partner

    link.

    5. Create another partner link drag and drop the entities from the palette, receive1, assign1, invoke1, assing2, and reply in order.

    6. Choose the partner link as partner link bpel and operation as add. 7. Build the bpel project.

    PROCEDURE FOR CREATING A COMPOSITE APPLICATION:

    1. Click on new->project->soa->composite application. 2. Right click on the project to add JBJ module. 3. Create a new test case choose the operation to add. 4. Then run the test case

    PROGRAM:

    ADD WEB SERVICE:

    package pck;

    import javax.jws.WebService;

    @WebService()

    public class calcService {

    public int add(int n1,int n2){

    return n1+n2;

    }}

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    CALCBPEL:

    COMPOSITE BPEL:

  • WWW.VIDYARTHIPLUS.COM

    WWW.VIDYARTHIPLUS.COM V+ TEAM

    INPUT.XML

    2

    3

    OUTPUT.XML

    2

    3

    RESULT:

    Thus the implementation of orchestration with BPEL to addition of two numbers using

    net bean6.5 IDE was executed and verified successfully.

    ----------------***************-----------------