Вы находитесь на странице: 1из 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 Beginners Guide for Oracle SoA. The document focuses on WEB SERVICE DESCRIPTION LANGUAGE. Join our professional training program and learn from experts.

History: Version 0.1 0.1

Description Change Author Initial Draft Shiva Kant Pandey Review#1 Amit Sharma

Publish Date 21th Aug 2012 29th Aug 2012

www.bisptrainigs.com

www.hyperionguru.com

Page 1

PART III INTRODUCTION TO WSDL(WEB SERVICE DESCRIPTION LANGUAGE) WITH THE HELP OF PROJECT WSDL : 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. Types 2. Message 3. Port Type 4. Binding 5. service 6. 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 ---> Finish Now 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

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

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

www.bisptrainigs.com

www.hyperionguru.com

Page 5

Step 4 : Fill all required blanks WSDL 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

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

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

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

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

1. Exposed Services 2. Components 3. External refrences Now right click on component section and choose BPEL Process.

www.bisptrainigs.com

www.hyperionguru.com

Page 9

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 different options these are:

www.bisptrainigs.com

www.hyperionguru.com

Page 10

Click OK. www.bisptrainigs.com www.hyperionguru.com Page 11

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

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 section or 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

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

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

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

www.bisptrainigs.com

www.hyperionguru.com

Page 17

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

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

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

Step23: Select admin server & click Next.

Click Finish.

Step 24 : Click on Browser icon shown below:

www.bisptrainigs.com

www.hyperionguru.com

Page 21

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 :weblogic Password : welcome1 click 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

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 Active Now click on Browser tab

www.bisptrainigs.com

www.hyperionguru.com

Page 23

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 information additionally.

& this wsdl contains Binding & service

www.bisptrainigs.com

www.hyperionguru.com

Page 24

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 observe it . & now get the ABSTRACT WSDL &

www.bisptrainigs.com

www.hyperionguru.com

Page 25

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 Inputs Response: Reply output

This is a tree view we can also see it as XML view . www.bisptrainigs.com www.hyperionguru.com Page 26

Now Insert Number A =5 & Number B = 10 Click 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

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

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

www.bisptrainigs.com

www.hyperionguru.com

Page 29

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

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

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