soa record

Post on 13-Dec-2015

218 Views

Category:

Documents

2 Downloads

Preview:

Click to see full reader

DESCRIPTION

lab manual

TRANSCRIPT

NAME: MANIKANDAN. R REG NO: 50410205023

EX NO: 1a Developing a .NET components for Addition process

Date:

AIM:

To develop a components for addition processing using .NET technology

PROCEDURE:

1. Open the Microsoft Visual studio 2008 using start → all programs → microsoft

visual studio 2008.

2. Use file → new → website → webservices to create a new webservice component

in .NET application or use shortcut shift + ctrl + n.

3. Proceed with giving the project name as addition process and create new

application.

4. In service.asmx, give the class name which we want use it for the application.

5. In service.vb use the class name and create the coding required for the application.

6. After complete the coding, then click run button to debug and start the webservice,

or press F5 to run.

7. Check the services using the different values.

8. Stop the services after the completion.

1

NAME: MANIKANDAN. R REG NO: 50410205023

PROGRAM:

service.vbImports System.WebImports System.Web.ServicesImports System.Web.Services.Protocols<WebService(Namespace:="http://tempuri.org/")> _<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _Public Class add Inherits System.Web.Services.WebService <WebMethod()> _ Public Function addition(ByVal a As Double, ByVal b As Double) As Double Dim c As Double c = a + b Return c End FunctionEnd Class

service.asmx

<%@ WebService Language="vb" CodeBehind="~/App_Code/Service.vb" Class="add" %>

2

NAME: MANIKANDAN. R REG NO: 50410205023

Output:

3

NAME: MANIKANDAN. R REG NO: 50410205023

4

NAME: MANIKANDAN. R REG NO: 50410205023

SOAP 1.1

POST /addition/Service.asmx HTTP/1.1Host: localhostContent-Type: text/xml; charset=utf-8Content-Length: lengthSOAPAction: "http://tempuri.org/addition"

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <addition xmlns="http://tempuri.org/"> <a>double</a> <b>double</b> </addition> </soap:Body></soap:Envelope>

HTTP/1.1 200 OKContent-Type: text/xml; charset=utf-8Content-Length: length

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <additionResponse xmlns="http://tempuri.org/"> <additionResult>double</additionResult> </additionResponse> </soap:Body></soap:Envelope>

5

NAME: MANIKANDAN. R REG NO: 50410205023

RESULT:

Thus the program of creating a .NET application for addition process is created and executed successfully.

6

NAME: MANIKANDAN. R REG NO: 50410205023

EX NO: 1b DEVELOPING A .NET COMPONENT FOR STUDENT PROCESSDate:

AIM:

To develop a components for student processing using .NET technology

PROCEDURE:

1. Open the Microsoft Visual studio 2008 using start → all programs → microsoft

visual studio 2008.

2. Use file → new → website → webservices to create a new webservice component

in .NET application or use shortcut shift + ctrl + n.

3. Proceed with giving the project name as student process and create new

application.

4. In service.asmx, give the class name which we want use it for the application.

5. In service.vb use the class name and create the coding required for the application.

6. After complete the coding, then click run button to debug and start the webservice,

or press F5 to run.

7. Check the services using the different values.

8. Stop the services after the completion.

7

NAME: MANIKANDAN. R REG NO: 50410205023

PROGRAM:

service.aspx.vbImports System.WebImports System.Web.ServicesImports System.Web.Services.Protocols

<System.Web.Script.Services.ScriptService()> _<WebService(Namespace:="http://tempuri.org/")> _<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _Public Class student Inherits System.Web.Services.WebService

<WebMethod()> _ Public Function marklist(ByVal m1 As Double, ByVal m2 As Double, ByVal m3 As Double) As Double Dim tot As Double tot = m1 + m2 + m3 Return tot End FunctionEnd Class

service.aspx<%@ WebService Language="vb" CodeBehind="~/App_Code/Service.vb" Class="student" %>

8

NAME: MANIKANDAN. R REG NO: 50410205023

9

NAME: MANIKANDAN. R REG NO: 50410205023

SOAP 1.1

POST /student/Service.asmx HTTP/1.1Host: localhostContent-Type: text/xml; charset=utf-8Content-Length: lengthSOAPAction: "http://tempuri.org/marklist"

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <marklist xmlns="http://tempuri.org/"> <m1>double</m1> <m2>double</m2> <m3>double</m3> </marklist> </soap:Body></soap:Envelope>

HTTP/1.1 200 OKContent-Type: text/xml; charset=utf-8Content-Length: length

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <marklistResponse xmlns="http://tempuri.org/"> <marklistResult>double</marklistResult> </marklistResponse> </soap:Body></soap:Envelope>

10

NAME: MANIKANDAN. R REG NO: 50410205023

11

NAME: MANIKANDAN. R REG NO: 50410205023

RESULT:

Thus the program of developing a .NET application for the student process is created and executed successfully.

12

NAME: MANIKANDAN. R REG NO: 50410205023

EX NO: 1c DEVELOPING A .NET COMPONENT FOR FINDING LARGER NUMBERDate:

AIM:

To develop a components for finding the larger number using .NET technology

PROCEDURE:

1. Open the Microsoft Visual studio 2008 using start → all programs → microsoft

visual studio 2008.

2. Use file → new → website → webservices to create a new webservice component

in .NET application or use shortcut shift + ctrl + n.

3. Proceed with giving the file name as larger number and create button to create new

application.

4. In service.asmx, give the class name which we want use it for the application.

5. In service.vb use the class name and create the coding required for the application.

6. After complete the coding, then click run button to debug and start the webservice,

or press F5 to run.

7. Check the services using the different values.

8. Stop the services after the completion.

13

NAME: MANIKANDAN. R REG NO: 50410205023

PROGRAM:

service.aspx.vbImports System.WebImports System.Web.ServicesImports System.Web.Services.Protocols

<System.Web.Script.Services.ScriptService()> _<WebService(Namespace:="http://tempuri.org/")> _<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _Public Class larger Inherits System.Web.Services.WebService

<WebMethod()> _ Public Function findlarge(ByVal a As Integer, ByVal b As Integer) As String If (a >= b) Then Return "a is greater" Else Return "b is greater" End If

End Function

End Class

service.aspx<%@ WebService Language="vb" CodeBehind="~/App_Code/Service.vb" Class="larger" %>

14

NAME: MANIKANDAN. R REG NO: 50410205023

OUTPUT:

15

NAME: MANIKANDAN. R REG NO: 50410205023

16

NAME: MANIKANDAN. R REG NO: 50410205023

SOAP 1.1POST /largestno/Service.asmx HTTP/1.1Host: localhostContent-Type: text/xml; charset=utf-8Content-Length: lengthSOAPAction: "http://tempuri.org/findlarge"

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

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <findlargeResponse xmlns="http://tempuri.org/"> <findlargeResult>string</findlargeResult> </findlargeResponse> </soap:Body></soap:Envelope>

17

NAME: MANIKANDAN. R REG NO: 50410205023

RESULT:

Thus the program of finding the larger number using .NET application is created and executed successfully.

18

NAME: MANIKANDAN. R REG NO: 50410205023

EX NO: 1d DEVELOPING A .NET COMPONENT FOR FACTORIAL PROCESSDate:

AIM:

To develop a components for factorial processing using .NET technology

PROCEDURE:

1. Open the Microsoft Visual studio 2008 using start → all programs → microsoft

visual studio 2008.

2. Use file → new → website → webservices to create a new webservice component

in .NET application or use shortcut shift + ctrl + n.

3. Proceed with giving the file name and create button to create new application.

4. In service.asmx, give the class name factorial which we want use it for the

application.

5. In service.vb use the class name and create the coding required for the application.

6. After complete the coding, then click run button to debug and start the webservice,

or press F5 to run.

7. Check the services using the different values.

8. Stop the services after the completion.

19

NAME: MANIKANDAN. R REG NO: 50410205023

PROGRAM:

service.aspx.vbImports System.WebImports System.Web.ServicesImports System.Web.Services.Protocols

<System.Web.Script.Services.ScriptService()> _<WebService(Namespace:="http://tempuri.org/")> _<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _Public Class fact Inherits System.Web.Services.WebService

<WebMethod()> _ Public Function factorial(ByVal i As Double) As Double Dim n As Integer Dim fact As Integer fact = 1 For n = 1 To i fact = fact * n Next n Return fact End FunctionEnd Class

service.aspx<%@ WebService Language="vb" CodeBehind="~/App_Code/Service.vb" Class="fact" %>

20

NAME: MANIKANDAN. R REG NO: 50410205023

OUTPUT:

21

NAME: MANIKANDAN. R REG NO: 50410205023

22

NAME: MANIKANDAN. R REG NO: 50410205023

SOAP 1.1POST /fact/Service.asmx HTTP/1.1Host: localhostContent-Type: text/xml; charset=utf-8Content-Length: lengthSOAPAction: "http://tempuri.org/factorial"

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

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <factorialResponse xmlns="http://tempuri.org/"> <factorialResult>double</factorialResult> </factorialResponse> </soap:Body></soap:Envelope>

23

NAME: MANIKANDAN. R REG NO: 50410205023

RESULT:

Thus the program of developing a .NET component for factorial process is created and executed successfully.

24

NAME: MANIKANDAN. R REG NO: 50410205023

EX NO: 1e DEVELOPING A .NET COMPONENT FOR PAYMENT PROCESS

Date:

AIM:

To develop a components for payment processing using .NET technology

PROCEDURE:

1. Open the Microsoft Visual studio 2008 using start → all programs → microsoft

visual studio 2008.

2. Use file → new → website → webservices to create a new webservice component

in .NET application or use shortcut shift + ctrl + n.

3. Proceed with giving the file name as payment process and create button to create

new application.

4. In service.asmx, give the class name which we want use it for the application.

5. In service.vb use the class name and create the coding required for the application.

6. After complete the coding, then click run button to debug and start the webservice,

or press F5 to run.

7. Check the services using the different values.

8. Stop the services after the completion.

25

NAME: MANIKANDAN. R REG NO: 50410205023

PROGRAM:

service.aspx.vbImports System.WebImports System.Web.ServicesImports System.Web.Services.Protocols<System.Web.Script.Services.ScriptService()> _<WebService(Namespace:="http://tempuri.org/")> _<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _Public Class payroll Inherits System.Web.Services.WebService

<WebMethod()> _ Public Function salary(ByVal net As Double, ByVal hr As Double, ByVal da As Double, ByVal ta As Double, ByVal pf As Double) As Double Dim total As Double total = net + hr + da + ta - pf Return total End Function

End Class

service.aspx<%@ WebService Language="vb" CodeBehind="~/App_Code/Service.vb" Class="payroll" %>

26

NAME: MANIKANDAN. R REG NO: 50410205023

OUTPUT:

27

NAME: MANIKANDAN. R REG NO: 50410205023

28

NAME: MANIKANDAN. R REG NO: 50410205023

SOAP 1.1POST /fact/Service.asmx HTTP/1.1Host: localhostContent-Type: text/xml; charset=utf-8Content-Length: lengthSOAPAction: "http://tempuri.org/factorial"

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

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <factorialResponse xmlns="http://tempuri.org/"> <factorialResult>double</factorialResult> </factorialResponse> </soap:Body></soap:Envelope>

29

NAME: MANIKANDAN. R REG NO: 50410205023

RESULT:

Thus the program of developing a .NET application for the payment processing is created and executed successfully.

30

NAME: MANIKANDAN. R REG NO: 50410205023

EX NO: 2a Implementing EJB components for Order processing

Date:

AIM:

To develop a EJB component for a order processing

PROCEDURE:

1. Start the NetBeans IDE 6.8.

2. Creating a new EJB module by File→new project, in categories choose Java EE

and in EJB module.

3. Then click next button to proceed.

4. Give the project name for the EJB component and select the Glass Fish Server v3

and then click finish button.

5. Right click in project available in the project window and new→session bean.

6. Give the bean name and the package name.

7. Set the session type as Stateless and the Interface as Remote.

8. In code window, right click and choose Inset→business module(alt + insert).

9. Import the package for the webservice and the webservice components as import

javax.jws.WebService and the components @WebService.

10. Clean and build the project

11. Deploy the project before run and testing the webservices.

12. Test the webservice.

31

NAME: MANIKANDAN. R REG NO: 50410205023

PROGRAM:

order.java

package orderpack;import javax.ejb.Stateless;import javax.jws.WebService;@Stateless@WebServicepublic class order implements orderRemote {public int ordermeth(int price, int quantity) {return price * quantity;}}

orderRemote.java

package orderpack;import javax.ejb.Remote;@Remotepublic interface orderRemote { int ordermeth(int price, int quantity); }

32

NAME: MANIKANDAN. R REG NO: 50410205023

OUTPUT:

33

NAME: MANIKANDAN. R REG NO: 50410205023

SOAP REQUEST:

<?xml version="1.0" encoding="UTF-8"?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Header/> <S:Body> <ns2:ordermeth xmlns:ns2="http://orderpack/"> <arg0>45</arg0> <arg1>4</arg1> </ns2:ordermeth> </S:Body></S:Envelope>

SOAP RESPONSE:

<?xml version="1.0" encoding="UTF-8"?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Body> <ns2:ordermethResponse xmlns:ns2="http://orderpack/"> <return>180</return> </ns2:ordermethResponse> </S:Body></S:Envelope>

34

NAME: MANIKANDAN. R REG NO: 50410205023

RESULT:

Thus the program for developing the EJB components of order processing is created and executed successfully.

35

NAME: MANIKANDAN. R REG NO: 50410205023

EX NO: 2b Implementing EJB components for Payment processing

Date:

AIM:

To develop a EJB component for a payment processing

PROCEDURE:

1. Start the NetBeans IDE 6.8.

2. Creating a new EJB module by File→new project, in categories choose Java EE

and in EJB module.

3. Then click next button to proceed.

4. Give the project name for the EJB component and select the Glass Fish Server v3

and then click finish button.

5. Right click in project available in the project window and new→session bean.

6. Give the bean name and the package name.

7. Set the session type as Stateless and the Interface as Remote.

8. In code window, right click and choose Inset→business module(alt + insert).

9. Import the package for the webservice and the webservice components as import

javax.jws.WebService and the components @WebService.

10. Clean and build the project

11. Deploy the project before run and testing the webservices.

12. Test the webservice.

36

NAME: MANIKANDAN. R REG NO: 50410205023

PROGRAM:

payment.javapackage paymentpack;import javax.ejb.Stateless;import javax.jws.WebService;@Stateless@WebServicepublic class payment implements paymentRemote {public int paymentmeth(int basic, int hra, int da, int pf) {return basic + hra + da - pf;}}

paymentRemote.javapackage paymentpack;import javax.ejb.Remote;@Remotepublic interface paymentRemote {int paymentmeth(int basic, int hra, int da, int pf); }

37

NAME: MANIKANDAN. R REG NO: 50410205023

OUTPUT:

38

NAME: MANIKANDAN. R REG NO: 50410205023

SOAP REQUEST:

<?xml version="1.0" encoding="UTF-8"?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Header/> <S:Body> <ns2:paymentmeth xmlns:ns2="http://paymentpack/"> <arg0>25897</arg0> <arg1>1345</arg1> <arg2>2400</arg2> <arg3>3456</arg3> </ns2:paymentmeth> </S:Body></S:Envelope>

SOAP RESPONSE:

<?xml version="1.0" encoding="UTF-8"?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Body> <ns2:paymentmethResponse xmlns:ns2="http://paymentpack/"> <return>26186</return> </ns2:paymentmethResponse> </S:Body></S:Envelope>

39

NAME: MANIKANDAN. R REG NO: 50410205023

RESULT:

Thus the program for developing the EJB components of payment processing is created and executed successfully.

40

NAME: MANIKANDAN. R REG NO: 50410205023

EX NO: 2c Implementing EJB components for Factorial processing

Date:

AIM:

To develop a EJB component for a factorial processing

PROCEDURE:

1. Start the NetBeans IDE 6.8.

2. Creating a new EJB module by File→new project, in categories choose Java EE

and in EJB module.

3. Then click next button to proceed.

4. Give the project name for the EJB component and select the Glass Fish Server v3

and then click finish button.

5. Right click in project available in the project window and new→session bean.

6. Give the bean name and the package name.

7. Set the session type as Stateless and the Interface as Remote.

8. In code window, right click and choose Inset→business module(alt + insert).

9. Import the package for the webservice and the webservice components as import

javax.jws.WebService and the components @WebService.

10. Clean and build the project

11. Deploy the project before run and testing the webservices.

12. Test the webservice.

41

NAME: MANIKANDAN. R REG NO: 50410205023

PROGRAM:

factorailbeanRemote.java

package factpack;import javax.ejb.Remote;

@Remotepublic interface factorailbeanRemote {int factmeth(int i); }

Factorailbean.java

package factpack;import javax.ejb.Stateless;import javax.jws.WebService;

@Stateless@WebServicepublic class factorailbean implements factorailbeanRemote {public int factmeth(int i) {int fact=1;for(int n=1;n<=i;n++){fact=fact*n;}return fact;}}

42

NAME: MANIKANDAN. R REG NO: 50410205023

OUTPUT:

43

NAME: MANIKANDAN. R REG NO: 50410205023

SOAP REQUEST:

<?xml version="1.0" encoding="UTF-8"?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Header/> <S:Body> <ns2:factmeth xmlns:ns2="http://factpack/"> <arg0>6</arg0> </ns2:factmeth> </S:Body></S:Envelope>

SOAP RESPONSE:

<?xml version="1.0" encoding="UTF-8"?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Body> <ns2:factmethResponse xmlns:ns2="http://factpack/"> <return>720</return> </ns2:factmethResponse> </S:Body></S:Envelope>

44

NAME: MANIKANDAN. R REG NO: 50410205023

RESULT:Thus the program for developing the EJB components of factorial processing is

created and executed successfully.

45

NAME: MANIKANDAN. R REG NO: 50410205023

EX NO: 2d Implementing EJB components for Student processing

Date:

AIM:

To develop a EJB component for a student processing

PROCEDURE:

1. Start the NetBeans IDE 6.8.

2. Creating a new EJB module by File→new project, in categories choose Java EE

and in EJB module.

3. Then click next button to proceed.

4. Give the project name for the EJB component and select the Glass Fish Server v3

and then click finish button.

5. Right click in project available in the project window and new→session bean.

6. Give the bean name and the package name.

7. Set the session type as Stateless and the Interface as Remote.

8. In code window, right click and choose Inset→business module(alt + insert).

9. Import the package for the webservice and the webservice components as import

javax.jws.WebService and the components @WebService.

10. Clean and build the project

11. Deploy the project before run and testing the webservices.

12. Test the webservice.

46

NAME: MANIKANDAN. R REG NO: 50410205023

PROGRAM:

student.java

package studentpack;

import javax.ejb.Stateless;import javax.jws.WebService;@Stateless@WebService

public class student implements studentRemote {public int studentmeth(int m1, int m2, int m3) {return m1+m2+m3;}}

studentRemote.java

package studentpack;

import javax.ejb.Remote;@Remotepublic interface studentRemote {

int studentmeth(int m1, int m2, int m3); }

47

NAME: MANIKANDAN. R REG NO: 50410205023

OUTPUT:

48

NAME: MANIKANDAN. R REG NO: 50410205023

SOAP REQUEST:

<?xml version="1.0" encoding="UTF-8"?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Header/> <S:Body> <ns2:studentmeth xmlns:ns2="http://studentpack/"> <arg0>78</arg0> <arg1>56</arg1> <arg2>45</arg2> </ns2:studentmeth> </S:Body></S:Envelope>

SOAP RESPONSE:

<?xml version="1.0" encoding="UTF-8"?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Body> <ns2:studentmethResponse xmlns:ns2="http://studentpack/"> <return>179</return> </ns2:studentmethResponse> </S:Body></S:Envelope>

49

NAME: MANIKANDAN. R REG NO: 50410205023

RESULT:Thus the program for developing the EJB components of student processing is

created and executed successfully.

50

NAME: MANIKANDAN. R REG NO: 50410205023

EX NO: 2e Implementing EJB components for Addition processing

Date:

AIM:

To develop a EJB component for addition processing

PROCEDURE:

1. Start the NetBeans IDE 6.8.

2. Creating a new EJB module by File→new project, in categories choose Java EE

and in EJB module.

3. Then click next button to proceed.

4. Give the project name for the EJB component and select the Glass Fish Server v3

and then click finish button.

5. Right click in project available in the project window and new→session bean.

6. Give the bean name and the package name.

7. Set the session type as Stateless and the Interface as Remote.

8. In code window, right click and choose Inset→business module(alt + insert).

9. Import the package for the webservice and the webservice components as import

javax.jws.WebService and the components @WebService.

10. Clean and build the project

11. Deploy the project before run and testing the webservices.

12. Test the webservice.

51

NAME: MANIKANDAN. R REG NO: 50410205023

PROGRAM:

addition.java

package addpack;

import javax.ejb.Stateless;import javax.jws.WebService;

@Stateless@WebServicepublic class addition implements additionRemote {

public int addmeth(int a, int b) { return a+b; } }

additionRemote.javapackage addpack;

import javax.ejb.Remote;

@Remotepublic interface additionRemote {

int addmeth(int a, int b); }

52

NAME: MANIKANDAN. R REG NO: 50410205023

OUTPUT:

53

NAME: MANIKANDAN. R REG NO: 50410205023

SOAP REQUEST:

<?xml version="1.0" encoding="UTF-8"?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Header/> <S:Body> <ns2:addmeth xmlns:ns2="http://addpack/"> <arg0>15</arg0> <arg1>8</arg1> </ns2:addmeth> </S:Body></S:Envelope>

SOAP RESPONSE:

<?xml version="1.0" encoding="UTF-8"?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Body> <ns2:addmethResponse xmlns:ns2="http://addpack/"> <return>23</return> </ns2:addmethResponse> </S:Body></S:Envelope>

54

NAME: MANIKANDAN. R REG NO: 50410205023

RESULT:

Thus the program for developing the EJB components of order processing is created and executed successfully.

55

NAME: MANIKANDAN. R REG NO: 50410205023

EX NO: 3 Invoking .Net Components as Web Services

Date:

AIM:

To develop a web services by invoking .NET components such as student mark list process.

PROCEDURE:

1. Open the Microsoft Visual Studio 2008 using start→ all programs→ Microsoft

Visual Studio 2008.

2. Create a new website using File→ new →website→ASP.NET web service.

3. As a project name student process.

4. In service.vb, write the code required for performing the student process.

5. In solution explorer window, right click in it and then add web reference.

6. Copy the URL of web services executed using .NET components and pastes it to

the web reference and adds it by the default name as local host.

7. In design window, design the form required for the web service.

8. In service.vb use the class name and create the coding required for the application.

9. After complete the coding, then click run button to debug and start the webservice,

or press F5 to run.

10. Check the services using the different values.

11. Stop the services after the completion.

56

NAME: MANIKANDAN. R REG NO: 50410205023

PROGRAM:

Default.aspx

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title>Untitled Page</title></head><body><h1> Student Web Application!</h1> <form id="form1" runat="server"> <div> m1&nbsp;&nbsp; <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <br /> m2&nbsp;&nbsp; <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox> <br /> m3&nbsp;&nbsp; <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox> <br /> sum&nbsp; <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox> <br /> <br /> <asp:Button ID="Button1" runat="server" Text="Button" /> </div> </form></body></html>

57

NAME: MANIKANDAN. R REG NO: 50410205023

Default.aspx.vb

Partial Class _Default Inherits System.Web.UI.Page Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim x As New localhost.student TextBox4.Text = x.marklist(Val(TextBox1.Text), Val(TextBox2.Text), Val(TextBox3.Text)) End SubEnd Class

58

NAME: MANIKANDAN. R REG NO: 50410205023

OUTPUT:

total

59

NAME: MANIKANDAN. R REG NO: 50410205023

SOAP 1.1

POST /student/Service.asmx HTTP/1.1Host: localhostContent-Type: text/xml; charset=utf-8Content-Length: lengthSOAPAction: "http://tempuri.org/marklist"

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <marklist xmlns="http://tempuri.org/"> <m1>double</m1> <m2>double</m2> <m3>double</m3> </marklist> </soap:Body></soap:Envelope>

HTTP/1.1 200 OKContent-Type: text/xml; charset=utf-8Content-Length: length

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <marklistResponse xmlns="http://tempuri.org/"> <marklistResult>double</marklistResult> </marklistResponse> </soap:Body></soap:Envelope>

60

NAME: MANIKANDAN. R REG NO: 50410205023

RESULT:

Thus the program invoking the .NET components as web services is created and executed successfully.

61

NAME: MANIKANDAN. R REG NO: 50410205023

62

NAME: MANIKANDAN. R REG NO: 50410205023

EX NO: 4 Invoking a EJB components as web services

Date:

AIM:

To invoke a simple EJB component as Web services to perform order processing.

PROCEDURE:Creation of EJB Component:

1. File -> New Project -> Java EE -> EJB Module, Next, provide the Project Name Select Web server and J2EE version, Finish.

2. Right click on the Project -> New -> Session Bean. Provide a Bean Name Assign a Package Name. Select Session Type as Stateless And set the Interface as Remote, Finish.

3. Open SessionBean.java Press <alt + insert>, From the list select Add Business Method. Provide Method Name as business method. Define a Return Type as String Add Parameter as name by clicking on Add Button.

4. Change the given method body to Session Bean code.5. Right Click on project and click on Build

Consuming the EJB Component in Web Application

1. File -> New Project -> Java Web -> Web Application, Next, Provide Project Name Next, Select Web Server and J2EE version, Finish.

2. Right Click on Web Pages -> New -> Servlet. Provide Servlet Name as Use Bean and Package as web.com.

3. Next, Provide a URL pattern for the Servlet as /use_ejb.do, Finish.4. In Servlet Page, remove comment from processRequest method body.5. Press <alt + insert>, From the list Select Call Enterprise Bean .Select SessionBean,

from MyEJB and click Ok.6. Go to index.jsp and create a form with a textbox and button and action to be

use_ejb.do (servlet url pattern)7. Then go to Servlet and send the received value from textbox to the RemoteBean

method to get result from the RemoteBean by writing Servlet code in UseBean.java

63

NAME: MANIKANDAN. R REG NO: 50410205023

PROGRAM:index.jsp<%@page contentType="text/html" pageEncoding="UTF-8"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <h1>Order Process</h1> <form action="use_ejb.do" method="post"> price <input type="text" name="pr"> quantity <input type="text" name="qty"> <input type="submit" value="cal"> </form> </body></html>

orderserv.java

package web.com;import java.io.IOException;import java.io.PrintWriter;import javax.ejb.EJB;import javax.servlet.ServletException;import javax.servlet.annotation.WebServlet;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import orderpack.orderRemote;

@WebServlet(name="orderserv", urlPatterns={"/use_ejb.do"})public class orderserv extends HttpServlet { @EJB private orderRemote order; protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8");

64

NAME: MANIKANDAN. R REG NO: 50410205023

PrintWriter out = response.getWriter(); try { int x=Integer.parseInt(request.getParameter("pr")); int y=Integer.parseInt(request.getParameter("qty")); int z=order.ordermeth(x, y); out.println("<html>"); out.println("<head>"); out.println("<title>Servlet orderserv</title>"); out.println("</head>"); out.println("<body>"); out.println(z); out.println("</body>"); out.println("</html>"); } finally { out.close(); } }

@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); }

@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); }

@Override public String getServletInfo() { return "Short description"; }}

65

NAME: MANIKANDAN. R REG NO: 50410205023

order.java

package orderpack;

import javax.ejb.Stateless;import javax.jws.WebService;@Stateless@WebServicepublic class order implements orderRemote {

public int ordermeth(int price, int quantity) { return price * quantity; } }

66

NAME: MANIKANDAN. R REG NO: 50410205023

OUTPUT:

67

NAME: MANIKANDAN. R REG NO: 50410205023

RESULT:

Thus the program of developing the EJB components as webservice for the order processing is executed successfully.

68

NAME: MANIKANDAN. R REG NO: 50410205023

EX NO: 5 Developing A J2EE Client to access .NET Web Service

Date:

AIM:To develop a J2EE client to access the .NET as a web services for the addition

process.

PROCEDURE:

1. Open the Microsoft visual studio for creating a web service, using start -> all programs ->Microsoft Visual studio 2008.

2. Create a new website by File-> new project, in categories choose ASP.NET website.

3. Then Click next button to proceed.

4. Give the project name for the website and then click finish button.

5. Right click in project available in the project window and new -> jsp page

6. In Code window, insert the jsp code and post it in add.jsp.

7. In JSP page write the java code to implement the web service.

8. Import the packages for the web service and the web service component as WSDL file address

9. Copy the WSDL file address and add it to web reference of the .NET client.

10. Run the program and enable the debugging mode.

11. Stop the web service.

69

NAME: MANIKANDAN. R REG NO: 50410205023

PROGRAM:

add.jsp<%@page contentType="text/html" pageEncoding="UTF-8"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"><html><head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>add</title> </head> <body> <% int x=Integer.parseInt(request.getParameter("no1")); int y=Integer.parseInt(request.getParameter("no2")); %><%-- start web service invocation --%><hr/><%try {org.tempuri.Add service = new org.tempuri.Add();org.tempuri.AddSoap port = service.getAddSoap();// TODO initialize WS operation arguments heredouble a = x;double b = y;// TODO process result heredouble result = port.addition(a, b);out.println("Result = "+result);} catch (Exception ex) { } %><%-- end web service invocation --%><hr/> </body></html>

70

NAME: MANIKANDAN. R REG NO: 50410205023

Index.jsp

<%@page contentType="text/html" pageEncoding="UTF-8"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <form action="add1.jsp" method="post"> enter the following input NO1<input type="text" name="no1"> NO2<input type="text" name="no2"> <input type="submit" value="add"> </form> </body> </html>

71

NAME: MANIKANDAN. R REG NO: 50410205023

Output

72

NAME: MANIKANDAN. R REG NO: 50410205023

RESULT:

Thus the program of developing J2EE client to access .NET web service is executed successfully.

73

NAME: MANIKANDAN. R REG NO: 50410205023

EX NO: 6 Developing A .NET client to access a J2EE Web Services

Date:

AIM:

To develop a .NET client to access the J2EE web services for the factorial process.

PROCEDURE:

1. Open the Net Beans IDE for creating the Web services, using start→ all

programs→ Net Beans IDE

2. Creating a new EJB module by File→new project, in categories choose Java EE

and in EJB module.

3. Then click next button to proceed.

4. Give the project name for the EJB component and select the Glass Fish Server v3

and then click finish button.

5. Right click in project available in the project window and new→session bean.

6. Give the bean name and the package name.

7. Set the session type as Stateless and the Interface as Remote.

8. In code window, right click and choose Inset→business module(alt + insert).

9. Import the package for the webservice and the webservice components as import

javax.jws.WebService and the components @WebService.

10. Copy the WSDL file address, add it to the Web Reference of the .NET client

11. Create the Form design for the web service.

12. Run the program and enable the debugging mode.

13. Stop the web services.

14.

74

NAME: MANIKANDAN. R REG NO: 50410205023

PROGRAM:package fact;

import javax.ejb.Stateless;import javax.jws.WebService;@Stateless@WebServicepublic class fact implements factRemote { private int factorial;

public int fact(int n) { int fac=1,i; for(i=1;i<=n;i++) factorial=fac*i; return factorial; }}

Form design

Default.aspx.vb

75

NAME: MANIKANDAN. R REG NO: 50410205023

Partial Class _Default Inherits System.Web.UI.Page

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim x As New localhost.factService TextBox2.Text = x.fact(Val(TextBox1.Text)) End SubEnd Class

76

NAME: MANIKANDAN. R REG NO: 50410205023

OUTPUT:

n

fact

77

5

120

Button

NAME: MANIKANDAN. R REG NO: 50410205023

RESULT:

Thus the program of developing .NET client to access the J2EE web services is executed successfully

78

NAME: MANIKANDAN. R REG NO: 50410205023

Ex.No:7 DEVELOPMENT OF SERVICE ORCHESTRATION ENGINE

Date: (WORKFLOW)

USING WS-BPEL FOR SHIPPING SERVICE

AIM:

Develop a Service Orchestration Engine (workflow) using WS-BPEL and implement

service composition. For example, shipping service.

Step1: Shipping Service

This presents a WS-BPEL Abstract Process for a rudimentary shipping service. This

service handles the shipment of orders, and orders are composed of a number of items. The

shipping service offers two options, one for shipments where the items are shipped all together,

and one for partial shipments where the items are shipped in groups until the order is fulfilled.

1.1. Service Description

The context for the shipping service is an interaction between a customer and the service. This is

modeled with a partnerLinkType definition (shippingLT.wsdl):

<wsdl:definitions

targetNamespace="http://example.com/shipping/partnerLinkTypes/"

xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"

xmlns:sif="http://example.com/shipping/interfaces/"

xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">

<wsdl:import location="shippingPT.wsdl"

namespace="http://example.com/shipping/interfaces/" />

<plnk:partnerLinkType name="shippingLT">

<plnk:role name="shippingService"

portType="sif:shippingServicePT" />

<plnk:role name="shippingServiceCustomer"

portType="sif:shippingServiceCustomerPT" />

</plnk:partnerLinkType>

79

NAME: MANIKANDAN. R REG NO: 50410205023

</wsdl:definitions>

The corresponding message and portType definitions are as follows (shippingPT.wsdl):

<wsdl:definitions

targetNamespace="http://example.com/shipping/interfaces/"

xmlns:ship="http://example.com/shipping/ship.xsd"

xmlns:tns="http://example.com/shipping/interfaces/"

xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"

xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<wsdl:types>

<xsd:schema>

<!-- import ship schema -->

</xsd:schema>

</wsdl:types>

<wsdl:message name="shippingRequestMsg">

<wsdl:part name="shipOrder" type="ship:shipOrder" />

</wsdl:message>

<wsdl:message name="shippingNoticeMsg">

<wsdl:part name="shipNotice" type="ship:shipNotice" />

</wsdl:message>

<wsdl:portType name="shippingServicePT">

<wsdl:operation name="shippingRequest">

<wsdl:input message="tns:shippingRequestMsg" />

</wsdl:operation>

</wsdl:portType>

<wsdl:portType name="shippingServiceCustomerPT">

80

NAME: MANIKANDAN. R REG NO: 50410205023

<wsdl:operation name="shippingNotice">

<wsdl:input message="tns:shippingNoticeMsg" />

</wsdl:operation>

</wsdl:portType>

</wsdl:definitions>

1.2. Properties

The properties relevant to the service are:

The shipping order ID (shipOrderID) is used to correlate the shipping notice(s) with the

shipping order.

Whether the order is to be shipped complete or not (shipComplete).

The total number of items in the order (itemsTotal).

The number of items in a ship notice (itemsCount). When partial shipments are

acceptable, itemsCount and itemsTotal are used to track the fulfillment of the order.

The definitions for the properties and their aliases are (shippingProperties.wsdl):

<wsdl:definitions

targetNamespace="http://example.com/shipping/properties/"

xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable"

xmlns:vprop="http://docs.oasis-open.org/wsbpel/2.0/varprop"

xmlns:ship="http://example.com/shipping/ship.xsd"

xmlns:sif="http://example.com/shipping/interfaces/"

xmlns:tns="http://example.com/shipping/properties/"

xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"

xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<wsdl:import location="shippingPT.wsdl"

namespace="http://example.com/shipping/interfaces/" />

<!-- types used in Abstract Processes are required to be finite

domains. The itemCountType is restricted by range -->

81

NAME: MANIKANDAN. R REG NO: 50410205023

<wsdl:types>

<xsd:schema

targetNamespace="http://example.com/shipping/ship.xsd">

<xsd:simpleType name="itemCountType">

<xsd:restriction base="xsd:int">

<xsd:minInclusive value="1" />

<xsd:maxInclusive value="50" />

</xsd:restriction>

</xsd:simpleType>

</xsd:schema>

</wsdl:types>

<vprop:property name="shipOrderID" type="xsd:int" />

<vprop:property name="shipComplete" type="xsd:boolean" />

<vprop:property name="itemsTotal" type="ship:itemCountType" />

<vprop:property name="itemsCount" type="ship:itemCountType" />

<vprop:propertyAlias propertyName="tns:shipOrderID"

messageType="sif:shippingRequestMsg" part="shipOrder">

<vprop:query>

ship:ShipOrderRequestHeader/ship:shipOrderID

</vprop:query>

</vprop:propertyAlias>

<vprop:propertyAlias propertyName="tns:shipOrderID"

messageType="sif:shippingNoticeMsg" part="shipNotice">

<vprop:query>ship:ShipNoticeHeader/ship:shipOrderID</vprop:query>

</vprop:propertyAlias>

<vprop:propertyAlias propertyName="tns:shipComplete"

messageType="sif:shippingRequestMsg" part="shipOrder">

82

NAME: MANIKANDAN. R REG NO: 50410205023

<vprop:query>

ship:ShipOrderRequestHeader/ship:shipComplete

</vprop:query>

</vprop:propertyAlias>

<vprop:propertyAlias propertyName="tns:itemsTotal"

messageType="sif:shippingRequestMsg" part="shipOrder">

<vprop:query>

ship:ShipOrderRequestHeader/ship:itemsTotal

</vprop:query>

</vprop:propertyAlias>

<vprop:propertyAlias propertyName="tns:itemsCount"

messageType="sif:shippingRequestMsg" part="shipOrder">

<vprop:query>

ship:ShipOrderRequestHeader/ship:itemsCount

</vprop:query>

</vprop:propertyAlias>

<vprop:propertyAlias propertyName="tns:itemsCount"

messageType="sif:shippingNoticeMsg" part="shipNotice">

<vprop:query>ship:ShipNoticeHeader/ship:itemsCount</vprop:query>

</vprop:propertyAlias>

</wsdl:definitions>

1.3. Process

For brevity, the Abstract Process definition does not include details such as the handling of error

conditions that a complete process description would likely provide. The outline of the process is

as follows:

receive shipOrder

83

NAME: MANIKANDAN. R REG NO: 50410205023

if

condition shipComplete

send shipNotice

else

itemsShipped := 0

while itemsShipped < itemsTotal

itemsCount := opaque // non-deterministic assignment

// corresponding e.g. to

// internal interaction with

// back-end system

send shipNotice

itemsShipped = itemsShipped + itemsCount

The WS-BPEL process is as follows:

<process name="shippingService"

targetNamespace="http://example.com/shipping/"

xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/abstract"

xmlns:plt="http://example.com/shipping/partnerLinkTypes/"

xmlns:props="http://example.com/shipping/properties/"

xmlns:ship="http://example.com/shipping/ship.xsd"

xmlns:sif="http://example.com/shipping/interfaces/"

abstractProcessProfile="http://docs.oasis-open.org/wsbpel/2.0/process/abstract/ap11/2006/08">

<import importType="http://schemas.xmlsoap.org/wsdl/"

location="shippingLT.wsdl"

namespace="http://example.com/shipping/partnerLinkTypes/" />

<import importType="http://schemas.xmlsoap.org/wsdl/"

location="shippingPT.wsdl"

namespace="http://example.com/shipping/interfaces/" />

84

NAME: MANIKANDAN. R REG NO: 50410205023

<import importType="http://schemas.xmlsoap.org/wsdl/"

location="shippingProperties.wsdl"

namespace="http://example.com/shipping/properties/" />

<partnerLinks>

<partnerLink name="customer" partnerLinkType="plt:shippingLT"

partnerRole="shippingServiceCustomer"

myRole="shippingService" />

</partnerLinks>

<variables>

<variable name="shipRequest"

messageType="sif:shippingRequestMsg" />

<variable name="shipNotice"

messageType="sif:shippingNoticeMsg" />

<variable name="itemsShipped"

type="ship:itemCountType" />

</variables>

<correlationSets>

<correlationSet name="shipOrder"

properties="props:shipOrderID" />

</correlationSets>

<sequence>

<receive partnerLink="customer"

operation="shippingRequest"

variable="shipRequest">

<correlations>

<correlation set="shipOrder" initiate="yes" />

85

NAME: MANIKANDAN. R REG NO: 50410205023

</correlations>

</receive>

<if>

<condition>

bpel:getVariableProperty('shipRequest',

'props:shipComplete')

</condition>

<sequence>

<assign>

<copy>

<from variable="shipRequest"

property="props:shipOrderID" />

<to variable="shipNotice"

property="props:shipOrderID" />

</copy>

<copy>

<from variable="shipRequest"

property="props:itemsCount" />

<to variable="shipNotice"

property="props:itemsCount" />

</copy>

</assign>

<invoke partnerLink="customer"

operation="shippingNotice"

inputVariable="shipNotice">

<correlations>

<correlation set="shipOrder" pattern="request" />

</correlations>

</invoke>

</sequence>

<else>

86

NAME: MANIKANDAN. R REG NO: 50410205023

<sequence>

<assign>

<copy>

<from>0</from>

<to>$itemsShipped</to>

</copy>

</assign>

<while>

<condition>

$itemsShipped

&lt;

bpel:getVariableProperty('shipRequest',

'props:itemsTotal')

</condition>

<sequence>

<assign>

<copy>

<opaqueFrom/>

<to variable="shipNotice"

property="props:shipOrderID" />

</copy>

<copy>

<opaqueFrom/>

<to variable="shipNotice"

property="props:itemsCount" />

</copy>

</assign>

<invoke partnerLink="customer"

operation="shippingNotice"

inputVariable="shipNotice">

<correlations>

87

NAME: MANIKANDAN. R REG NO: 50410205023

<correlation set="shipOrder"

pattern="request" />

</correlations>

</invoke>

<assign>

<copy>

<from>

$itemsShipped

+

bpel:getVariableProperty('shipNotice',

'props:itemsCount')

</from>

<to>$itemsShipped</to>

</copy>

</assign>

</sequence>

</while>

</sequence>

</else>

</if>

</sequence>

</process>

Step 2: Ordering Service

This example expands on the shipping service to illustrate the use of an Abstract Process using

the template profile. This Abstract Process describes a set of services to request, track, and

confirm orders and their shipments, invoicing, and payment. The ordering service receives orders

88

NAME: MANIKANDAN. R REG NO: 50410205023

from an order processor, sends a shipping request to the shipping service, and acknowledges

shipment, pickup, invoicing, and payment as each is performed.

2.1. Service Description

The context for the ordering service is an interaction between a consumer and the service. This is

modeled in the following partnerLinkType definition (orderingLT.wsdl):

<wsdl:definitions

targetNamespace="http://example.com/ordering/partnerLinkTypes/"

xmlns:oif="http://example.com/ordering/interfaces/"

xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"

xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">

<wsdl:import location="orderingPT.wsdl"

namespace="http://example.com/ordering/interfaces/" />

<plnk:partnerLinkType name="orderingServiceLT">

<plnk:role name="orderingService"

portType="oif:orderingPT" />

<plnk:role name="orderingServiceResponse"

portType="oif:orderingResponsePT" />

</plnk:partnerLinkType>

<plnk:partnerLinkType name="shipperLT">

<plnk:role name="shippingService"

portType="oif:shippingServicePT" />

<plnk:role name="shippingServiceResponse"

portType="oif:shippingServiceResponsePT" />

</plnk:partnerLinkType>

<plnk:partnerLinkType name="completionConfirmationLT">

<plnk:role name="orderingServiceConfirmation"

portType="oif:orderingConfirmationPT" />

</plnk:partnerLinkType>

89

NAME: MANIKANDAN. R REG NO: 50410205023

</wsdl:definitions>

The corresponding message and portType definitions are as follows (orderingPT.wsdl):

<wsdl:definitions

targetNamespace="http://example.com/ordering/interfaces/"

xmlns:order="http://example.com/ordering/order.xsd"

xmlns:tns="http://example.com/ordering/interfaces/"

xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"

xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<wsdl:types>

<xsd:schema>

<!-- import ordering schema -->

</xsd:schema>

</wsdl:types>

<wsdl:message name="OrderMessageType">

<wsdl:part name="OrderMessagePart" element="order:OrderMessage"/>

</wsdl:message>

<wsdl:message name="OrderAckMessageType">

<wsdl:part name="OrderAckMessagePart"

element="order:OrderAckMessage" />

</wsdl:message>

<wsdl:message name="ShipRequestMessageType">

<wsdl:part name="ShipRequestMessagePart"

element="order:ShipRequestMessage" />

</wsdl:message>

<wsdl:message name="ShipNoticeMessageType">

90

NAME: MANIKANDAN. R REG NO: 50410205023

<wsdl:part name="ShipNoticeMessagePart"

element="order:ShipNoticeMessage" />

</wsdl:message>

<wsdl:message name="ShipHistoryMessageType">

<wsdl:part name="ShipHistoryMessagePart"

element="order:ShipHistoryMessage" />

</wsdl:message>

<wsdl:message name="InvoiceAckMessageType">

<wsdl:part name="InvoiceAckMessagePart"

element="order: InvoiceAckMessage" />

</wsdl:message>

<wsdl:portType name="orderingPT">

<wsdl:operation name="placeOrder">

<wsdl:input message="tns:OrderMessageType" />

</wsdl:operation>

</wsdl:portType>

<wsdl:portType name="orderingResponsePT">

<wsdl:operation name="getOrderAck">

<wsdl:input message="tns:OrderAckMessageType" />

</wsdl:operation>

</wsdl:portType>

<wsdl:portType name="orderingConfirmationPT">

<wsdl:operation name="getOrderConfirmation">

<wsdl:input message="tns:OrderAckMessageType" />

</wsdl:operation>

</wsdl:portType>

91

NAME: MANIKANDAN. R REG NO: 50410205023

<wsdl:portType name="shippingServicePT">

<wsdl:operation name="shippingRequest">

<wsdl:input message="tns:ShipRequestMessageType" />

</wsdl:operation>

</wsdl:portType>

<wsdl:portType name="shippingServiceCustomerPT">

<wsdl:operation name="shippingNotice">

<wsdl:input message="tns:ShipNoticeMessageType" />

</wsdl:operation>

</wsdl:portType>

</wsdl:definitions>

Although there are more interactions between consumer and service, not all have been modeled

in this example. Un-modeled interactions are opaque.

2.2. Properties

The properties relevant to the service are:

The order ID (orderID) is used to correlate the order placement with the shipping request,

shipping notice, invoice confirmation, pickup confirmation and final order confirmation.

For this example, only the shipping request, shipping notice and final confirmation are

defined

The order ID and aliases are defined as follows (orderingProperties.wsdl):

<wsdl:definitions

targetNamespace="http://example.com/ordering/properties/"

xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable"

xmlns:vprop="http://docs.oasis-open.org/wsbpel/2.0/varprop"

xmlns:oif="http://example.com/ordering/interfaces/"

xmlns:order="http://example.com/ordering/order.xsd"

xmlns:tns="http://example.com/ordering/properties/"

xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"

xmlns:xsd="http://www.w3.org/2001/XMLSchema">

92

NAME: MANIKANDAN. R REG NO: 50410205023

<wsdl:import location="orderingPT.wsdl"

namespace="http://example.com/ordering/interfaces/" />

<vprop:property name="orderID" type="xsd:string" />

<vprop:propertyAlias propertyName="tns:orderID"

messageType="oif:OrderMessageType" part="OrderMessagePart">

<vprop:query>

order:OrderMessageHeader/order:orderID

</vprop:query>

</vprop:propertyAlias>

<vprop:propertyAlias propertyName="tns:orderID"

messageType="oif:ShipNoticeMessageType"

part="ShipNoticeMessagePart">

<vprop:query>

order:ShipNoticeMessageHeader/order:orderID

</vprop:query>

</vprop:propertyAlias>

</wsdl:definitions>

Although there are more messages between the consumer and the service, not all have been

modeled. Un-modeled messages are opaque.

2.3. Process

This Abstract Process uses the template profile. The outline is as follows:

receive placeOrder

send shipOrder

if

condition shipCompleted

send orderNotice (indicating shipCompleted)

93

NAME: MANIKANDAN. R REG NO: 50410205023

else

send orderNotice (indicating !shipCompleted)

receive pickupNotification

update shipHistory

receive invoice

send invoiceResponse

receive paymentConfirmation

send orderConfirmation

The WS-BPEL process is as follows:

<process name="OrderingServiceProcess"

targetNamespace="http://example.com/ordering/"

xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/abstract"

xmlns:ext="http://example.com/bpel/some/extension"

xmlns:oif="http://example.com/ordering/interfaces/"

xmlns:order="http://example.com/ordering/order.xsd"

xmlns:plt="http://example.com/ordering/partnerLinkTypes/"

xmlns:props="http://example.com/ordering/properties/"

xmlns:tns="http://example.com/ordering/"

xmlns:xsd="http://www.w3.org/2001/XMLSchema"

abstractProcessProfile="http://docs.oasis-open.org/wsbpel/2.0/process/abstract/simple-

template/2006/08"

suppressJoinFailure="yes">

<import importType="http://schemas.xmlsoap.org/wsdl/"

location="orderingLT.wsdl"

namespace="http://example.com/ordering/partnerLinkTypes/" />

<import importType="http://schemas.xmlsoap.org/wsdl/"

location="orderingPT.wsdl"

94

NAME: MANIKANDAN. R REG NO: 50410205023

namespace=" http://example.com/ordering/interfaces/" />

<import importType="http://schemas.xmlsoap.org/wsdl/"

location="orderingProperties.wsdl"

namespace="http://example.com/ordering/properties/" />

<extensions>

<extension namespace="http://example.com/bpel/some/extension"

mustUnderstand="no" />

</extensions>

<partnerLinks>

<partnerLink name="ordering"

partnerLinkType="plt:orderingServiceLT"

myRole="orderingService"

partnerRole="orderingServiceResponse" />

<partnerLink name="shipper"

partnerLinkType="plt:shipperLT"

myRole="shippingServiceResponse"

partnerRole="shippingService" />

<partnerLink name="shippingRequester"

partnerLinkType="##opaque"

myRole="##opaque" />

<partnerLink name="invoiceProcessor"

partnerLinkType="##opaque"

myRole="##opaque"

partnerRole="##opaque" />

<partnerLink name="orderingConfirmation"

partnerLinkType="plt:completionConfirmationLT"

95

NAME: MANIKANDAN. R REG NO: 50410205023

partnerRole="orderingServiceConfirmation" />

</partnerLinks>

<variables>

<!-- Reference to the message passed as input during

initiation -->

<variable name="order" messageType="oif:OrderMessageType" />

<variable name="orderAckMsg"

messageType="oif:OrderAckMessageType" />

<variable name="orderShippedMsg"

element="order:OrderAckMessage" />

<variable name="shippingRequestMsg"

element="order:ShipRequestMessage" />

<variable name="shippingNoticeMsg"

element="order:ShipNoticeMessage" />

<variable name="shipHistoryMsg"

messageType="oif:ShippingHistoryMessageType" />

<variable name="invoiceAckMsg"

messageType="oif:InvoiceAckMessageType" />

</variables>

<correlationSets>

<correlationSet name="orderCS" properties="props:orderID" />

</correlationSets>

<sequence>

<receive partnerLink="ordering" operation="placeOrder"

variable="order" createInstance="yes">

<correlations>

<correlation set="orderCS" initiate="yes" />

</correlations>

</receive>

96

NAME: MANIKANDAN. R REG NO: 50410205023

<assign>

<copy>

<from>

$order.OrderMessagePart/order:OrderMessageHeader/

order:orderID

</from>

<to>

$shippingRequestMsg/order:ShipRequestMessageHeader/

order:orderID

</to>

</copy>

<copy>

<from>$order.OrderMessagePart/order:ShippingInfo</from>

<to>$shippingRequestMsg/order:ShippingInfo</to>

</copy>

</assign>

<invoke partnerLink="shipper" operation="shippingRequest"

inputVariable="shippingRequestMsg"

ext:uniqueUserFriendlyName="send shipping request to

shipper"/>

<receive partnerLink="shipper"

portType="oif:shippingServiceCustomerPT"

operation="shippingNotice"

variable="shippingNoticeMsg"

ext:uniqueUserFriendlyName="receive response from shipper">

<correlations>

<correlation set="orderCS" />

</correlations>

</receive>

97

NAME: MANIKANDAN. R REG NO: 50410205023

<assign>

<copy>

<from>

$order.OrderMessagePart/order:OrderMessageHeader/

order:orderID

</from>

<to>

$orderAckMsg.OrderAckMessagePart/

order:OrderAckMessageHeader/order:orderID

</to>

</copy>

</assign>

<if>

<condition opaque="yes" />

<!--

the first case would package the order

acknowledgement for a completed shipment

-->

<assign>

<copy>

<opaqueFrom/>

<to>$orderAckMsg.OrderAckMessagePart/order:Ack</to>

</copy>

</assign>

<else>

<!--

the second case would package the order

acknowledgement for an uncompleted shipment

-->

98

NAME: MANIKANDAN. R REG NO: 50410205023

<assign>

<copy>

<opaqueFrom/>

<to>$orderAckMsg.OrderAckMessagePart/order:Ack</to>

</copy>

</assign>

</else>

</if>

<invoke partnerLink="ordering"

operation="getOrderAck"

inputVariable="orderAckMsg" />

<receive partnerLink="shippingRequester"

operation="##opaque"

variable="##opaque"

ext:uniqueUserFriendlyName="receive the pickup notification">

<correlations>

<correlation set="orderCS" />

</correlations>

</receive>

<assign>

<copy>

<opaqueFrom/>

<to>

$shipHistoryMsg.ShipHistoryMessagePart/order:Event

</to>

</copy>

</assign>

99

NAME: MANIKANDAN. R REG NO: 50410205023

<opaqueActivity>

<documentation>

If we receive notice that the ship has completed, update

our ship history accordingly

</documentation>

</opaqueActivity>

<receive partnerLink="invoiceProcessor" operation="##opaque"

variable="##opaque"

ext:uniqueUserFriendlyName="receive invoice for processing">

<correlations>

<correlation set="orderCS" />

</correlations>

</receive>

<assign>

<copy>

<opaqueFrom/>

<to>$invoiceAckMsg.InvoiceAckMessagePart</to>

</copy>

</assign>

<invoke partnerLink="invoiceProcessor" operation="##opaque"

inputVariable="##opaque"

ext:uniqueUserFriendlyName="send response for the invoice" />

<receive partnerLink="shippingRequester" operation="##opaque"

variable="##opaque"

ext:uniqueUserFriendlyName="receive payment confirmation">

<correlations>

<correlation set="orderCS" />

100

NAME: MANIKANDAN. R REG NO: 50410205023

</correlations>

</receive>

<assign>

<copy>

<opaqueFrom/>

<to>$orderShippedMsg/order:Ack</to>

</copy>

<copy>

<from>

$order.OrderMessagePart/order:OrderMessageHeader/

order:orderID

</from>

<to>

$orderShippedMsg/order:OrderAckMessageHeader/

order:orderID

</to>

</copy>

</assign>

<invoke partnerLink="orderingConfirmation"

operation="getOrderConfirmation"

inputVariable="orderShippedMsg" />

</sequence>

</process>

101

NAME: MANIKANDAN. R REG NO: 50410205023

RESULT:

The Development of a Service Orchestration Engine (workflow) using WS-BPEL and

implement service composition for shipping service was successfully written, verified and

executed.

102

top related