getting started-with-oracle-so a-iv

31
Getting Started with Oracle SoA INTRODUCTION TO WSDL (WEB SERVICE DESCRIPTION LANGUAGE) Lab#4 Description: BISP is committed to provide BEST learning material to the beginners and advance learners. In the same series, we have prepared a complete end-to end Hands-on Beginner’s Guide for Oracle SoA. The document focuses on WEB SERVICE DESCRIPTION LANGUAGE. Join our professional training program and learn from experts. History: Version Description Change Author Publish Date 0.1 Initial Draft Shiva Kant Pandey 21th Aug 2012 0.1 Review#1 Amit Sharma 29 th Aug 2012 www.bisptrainigs.com www.hyperionguru.com Page 1

Upload: amit-sharma

Post on 19-Jun-2015

178 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Getting started-with-oracle-so a-iv

Getting Started with Oracle SoA

INTRODUCTION TO WSDL(WEB SERVICE DESCRIPTION LANGUAGE) Lab#4

Description:BISP is committed to provide BEST learning material to the beginners and advance learners. In the same series, we have prepared a complete end-to end Hands-on Beginner’s Guide for Oracle SoA. The document focuses on WEB SERVICE DESCRIPTION LANGUAGE. Join our professional training program and learn from experts.

History:Version Description Change Author Publish Date0.1 Initial Draft Shiva Kant Pandey 21th Aug 20120.1 Review#1 Amit Sharma 29th Aug 2012

www.bisptrainigs.com www.hyperionguru.com Page 1

Page 2: Getting started-with-oracle-so a-iv

PART III INTRODUCTION TO WSDL(WEB SERVICE DESCRIPTION LANGUAGE) WITH THE HELP OF PROJECTWSDL : The Web Services Description Language is an XML-based interface description language that is used for describing the functionality offered by a web service.A WSDL description of a web service (also referred to as a WSDL file) provides a machine-readable description of how the service can be called, what parameters it expects, and what data structures it returns.

KEY ELEMENTS USED INSIDE WSDL :1. Types2. Message3. Port Type4. Binding5. service6. Partner Link Type

For better understanding consider a basic Project " ProcessNumbers" & focus on following points -:

• ABSTRACT WSDL• COMPOSITE XML• BPEL PROCESS COMPONENT• BPEL PROCESS• COMPILATION & DEPLOY• CONCRETE WSDL• TEST• INSTANCES

1. BASIC PROJECT ON "PROCESSNUMBERS" Step 1: Create new project

New --->All Technologies--->SOA Tier --->SOA project --->OK ---> Project Name (ProcessNumbersProject) ---> ADF Business Component---> SOA--->Next -->Empty Composite ---> FinishNow you can see your project on left pane with all its contents so as we need to start our project with XSD .

Step 2 : Create a new xsd file under project

Right click on xsd--> file name(ProcessNumbers.xsd) --> Target Namespace(http://www.bispsolutions.com/training/soa/schema/ProcessNumbers)-->

prefix (psobj) -->ok

Now created successfully ProcessNumbers.xsd as shown in figure :

www.bisptrainigs.com www.hyperionguru.com Page 2

Page 3: Getting started-with-oracle-so a-iv

• target Namespace

• Prefix taken psobj

• Take two elements 1) ProcessNumbersRequest 2) ProcessNumbersResponse

• Define their complex types shown in blue boxes .

• save xsd.

HINT : Here in example consider two numbers i.e NumberA & NumberB & then we have to perform ADD operation .

www.bisptrainigs.com www.hyperionguru.com Page 3

Page 4: Getting started-with-oracle-so a-iv

Step 2:

Click on Design Mode & u can see xsd in a well designed manner as shown in figure:

Step 3 : To create WSDL file:Click NEW--->All Technologies --->Web Services --->WSDL Document ---> OK

www.bisptrainigs.com www.hyperionguru.com Page 4

Page 5: Getting started-with-oracle-so a-iv

www.bisptrainigs.com www.hyperionguru.com Page 5

Page 6: Getting started-with-oracle-so a-iv

Step 4 : Fill all required blanksWSDL Name(ProcessNumbers) --->Directory name(leave as it is but delete up to your project name i.e Process numbers ) ----> Targetnamespace(give target name space but use wsdl in place of schema) ---> Create port type (ProcessNumbersInterface)

---> Select Service Style(Document) ----> OK .Service Style is mainly of two types :

1) Document 2)RPC• Document : the content of <soap:Body> is specified by XML Schema defined in

the <wsdl:type> section. It does not need to follow specific SOAP conventions. In short, the SOAP message is sent as one "document" in the <soap:Body> element without additional formatting rules having to be considered. Document style is the default choice.

• RPC: The structure of an RPC style <soap:Body> element needs to comply with the rules specified in detail in Section 7 of the SOAP 1.1 specification. According to these rules, <soap:Body> may contain only one element that is named after the operation, and all parameters must be represented as sub-elements of this wrapper element.

Step 5: Shown below is Abstract WSDL File , in wsdl file <definitions></definitions> is the root element of wsdl schema .

www.bisptrainigs.com www.hyperionguru.com Page 6

Page 7: Getting started-with-oracle-so a-iv

• Target Namespace • tns is prefix of targetnamespace

Elements Used In WSDL are :• TYPES:

The types element encloses data type definitions that are relevant for the exchanged messages. For maximum interoperability and platform neutrality, WSDL prefers the use of XSD as the canonical type system, and treats it as the intrinsic type system.

• MESSAGE: Inside Message we write whatever information is requested by service consumer & What response needed from service provider . These messages are transported through transporting medium example HTTP with SOAP protocol.Message element consists of PART name & element & part is a partition of message & there should be n number of parts inside a message.Messages should be one or more than one.

• PORT TYPE : It is a web service interface port type defines interface , operation , operation , input & output .

Step 6:

Import ProcessNumbers.xsd inside <xsd:schema> as shown & keep this schema inside wsdl type.

Step 7:

www.bisptrainigs.com www.hyperionguru.com Page 7

Page 8: Getting started-with-oracle-so a-iv

write message name & its part name & part element .note : Part element is prefixed So never forget to register its name space as shown below:

Step 8: Mention its port type as shown below

• Write name of Port type i.e "ProcessNumbersInterface"• we are Adding two numbers hence we choose ADD as its operation.• Write its input & output with prefix tns.

Finally Save WSDL file by clicking save button

Step 9: Click on Design Mode & see that relationship between Messages & port type.

www.bisptrainigs.com www.hyperionguru.com Page 8

Page 9: Getting started-with-oracle-so a-iv

Step 10: To create BPEL Process Click on composite .xml

Step 11: This composite .xml is partitioned into three sections

1. Exposed Services2. Components3. External refrences

Now right click on component section and choose BPEL Process.

www.bisptrainigs.com www.hyperionguru.com Page 9

Page 10: Getting started-with-oracle-so a-iv

Step 12: Fill all its blank spaces & browse wsdl file by clicking its icon

Note : Here choose Template " Base on a WSDL " means we already have a wsdl file . In our Next Projects we will create wsdl file directly from template by choosing differentoptions these are:

www.bisptrainigs.com www.hyperionguru.com Page 10

Page 11: Getting started-with-oracle-so a-iv

Click OK.

www.bisptrainigs.com www.hyperionguru.com Page 11

Page 12: Getting started-with-oracle-so a-iv

Step 13: Now observe Exposed Service as ProcessNumbersService and BPEL component ProcessNumbersProcess

Step 14 : Cick on source mode at bottom & see the composite xml as shown below

www.bisptrainigs.com www.hyperionguru.com Page 12

Page 13: Getting started-with-oracle-so a-iv

Step 15: Again go to design mode of composite .xml & doubleclick on here

Step 16: This window is ProcessNumbersProcess.bpel window & here we will create our logics & conditions by using Component Palette

So here we have again three sections so first section is a process number service sectionor we can say service section , middle section is BPEL process section which works as mediator & third section is for reference section & cover it on latter examples.

www.bisptrainigs.com www.hyperionguru.com Page 13

Page 14: Getting started-with-oracle-so a-iv

Step 17: Drag assign activity from component palette & put between receive input & reply output.Right click on Assign activity & select edit --> General--> Name(Assign Result)

Click on Copy Rules & Explore output variable & then result integer

drag this expression icon into Result element & a new window prompt as shown below:

www.bisptrainigs.com www.hyperionguru.com Page 14

Page 15: Getting started-with-oracle-so a-iv

select Number A ---> click Insert Into Expression ----> Plus Sign (+) --->select Number B ---> Click Insert Into Expression . Now Click OK. Click OK

www.bisptrainigs.com www.hyperionguru.com Page 15

Page 16: Getting started-with-oracle-so a-iv

Step 18: Compile by clicking compile icon & see below that build succesfull , if there is an error make correction then again compile & diagnosis build

www.bisptrainigs.com www.hyperionguru.com Page 16

Page 17: Getting started-with-oracle-so a-iv

www.bisptrainigs.com www.hyperionguru.com Page 17

Page 18: Getting started-with-oracle-so a-iv

Step 19 A : Deploy project by clicking Process Numbers Project .

Step 19B : click Deploy to Application server ---> Next

www.bisptrainigs.com www.hyperionguru.com Page 18

Page 19: Getting started-with-oracle-so a-iv

Step 19 C: mark these fields & click to Next

Step 20 : Start Server First as shown below :

Click on Start /Stop Weblogic servers

Mark Admin Server With SOA & EM then click START wait for few minutes

www.bisptrainigs.com www.hyperionguru.com Page 19

Page 20: Getting started-with-oracle-so a-iv

Server is now running

Step21: Select your application server click Next

Step 22: Looking up for soa server ..

www.bisptrainigs.com www.hyperionguru.com Page 20

Page 21: Getting started-with-oracle-so a-iv

Step23: Select admin server & click Next.

Click Finish.

Step 24 : Click on Browser icon shown below:

www.bisptrainigs.com www.hyperionguru.com Page 21

Page 22: Getting started-with-oracle-so a-iv

Step 25: Start your enterprise manager by writing url http: //localhost:7001/em/

Note : Here localhost is application server & 7001 is a port in which enterprise manager is running.

Step 26 : Login using credentials User Name :weblogicPassword : welcome1click on login

Step 27: We have successfully login inside Enterprise manager 11g (Farm_dev_soa)we can clearly observe here that admin server is up & all deployment status is also up it means that our admin server is running .Now In left pane of window under Farm_dev_soa click on SOA radio button now again expand & under default we can easily see all the deployed projects. Click twice on Process Numbers Project .

www.bisptrainigs.com www.hyperionguru.com Page 22

Page 23: Getting started-with-oracle-so a-iv

Step 28: Observe that all information regarding to Process Numbers Project is given Running instances 0 means that yet we have not tested any instance.Total 0 Project Status ActiveNow click on Browser tab

www.bisptrainigs.com www.hyperionguru.com Page 23

Page 24: Getting started-with-oracle-so a-iv

Step 29 : Click on WSDL URL

Step 30: Now it is a Concrete WSDL , Right click on page & select View Page Source

Now we can see full Concrete WSDL & this wsdl contains Binding & service information additionally.

www.bisptrainigs.com www.hyperionguru.com Page 24

Page 25: Getting started-with-oracle-so a-iv

Binding simply means that packaging message in packet with SOAP protocol again a question arises that what is soap protocol ?SOAP Protocol : SOAP, originally defined as Simple Object Access Protocol, is a protocol specification for exchanging structured information in the implementation of Web Services in computer networks. It relies on XML Information Set for its message format, and usually relies on other Application Layer protocols, most notably Hypertext Transfer Protocol(HTTP) or Simple Mail Transfer Protocol (SMTP), for message negotiation and transmission.

Copy location address & paste in browser URL & now get the ABSTRACT WSDL & observe it .

www.bisptrainigs.com www.hyperionguru.com Page 25

Page 26: Getting started-with-oracle-so a-iv

NOTE: This abstract wsdl is similar to prior abstract wsdl which we had created in jdeveloper environment. Now Copy the schema location of imported xsd & observe it .

Step 31: Click on TEST & create first instance or first test.

Step 32: Scroll down page & observe Operation : ADD Request: Receive InputsResponse: Reply output

This is a tree view we can also see it as XML view .

www.bisptrainigs.com www.hyperionguru.com Page 26

Page 27: Getting started-with-oracle-so a-iv

Now Insert Number A =5 & Number B = 10Click on Test Web Service

& get Result =15 as shown below

Step 33: Click on Launch Flow Trace

www.bisptrainigs.com www.hyperionguru.com Page 27

Page 28: Getting started-with-oracle-so a-iv

Click on ProcessNumbersProcess & see the instance of process number process. Here we can Audit Trail , Flow. Sensor values, Faults.

Step 34 : Click on Flow

View flow diagram of process numbers process

www.bisptrainigs.com www.hyperionguru.com Page 28

Page 29: Getting started-with-oracle-so a-iv

Step 35: Click on Receive input & observe BPEL instance in xml

www.bisptrainigs.com www.hyperionguru.com Page 29

Page 30: Getting started-with-oracle-so a-iv

Step 36: Similarly click on Assign result in flow diagram & observe BPEL instance in xml

Step 37: Similarly click on Reply Output

Step 38: Click on Faults & check it.

www.bisptrainigs.com www.hyperionguru.com Page 30

Page 31: Getting started-with-oracle-so a-iv

Step 39: Now again double click on ProcessNumbersProcess project on left pane & observe that now after first test it created Instance with its instance id & instance state.Now since we have completed our test & wanted to exit from enterprise manager , Click on ShutDown Tab & then LogOut.

Step 40 : Stop Admin server if don't want to further deploy any project Click Start/stop weblogic servers ----> mark on Admin Server radio ---> Stop

www.bisptrainigs.com www.hyperionguru.com Page 31