+ All Categories
Home > Documents > Oracle OSB Tutorial 1

Oracle OSB Tutorial 1

Date post: 20-Jan-2015
Category:
Upload: rakesh-gujjarlapudi
View: 7,399 times
Download: 10 times
Share this document with a friend
Description:
Getting the service description (WSDL) Configure Service Bus Import Resources Configure Business Service Config ure the Credit Card Validation Proxy Configure Message Flow(Validate & Report) Adding a Pipeline Pair ->Add Stage ->Add Action(Reporting) ->Add Validate Action
Popular Tags:
28
Oracle Service Bus – Lesson 1 Name – Rakesh Gujjarlapudi Email Address – [email protected]
Transcript
Page 1: Oracle OSB Tutorial 1

Oracle Service Bus – Lesson 1

Name – Rakesh Gujjarlapudi

Email Address – [email protected]

Page 2: Oracle OSB Tutorial 1

The link for the OSB console is http://localhost:7001/sbconsole (login with weblogic/welcome1) The link for the EM Fusion Middle Control console is http://localhost:7001/em (login with weblogic/welcome1) The link for the Weblogic console is http://localhost:7001/console (login with weblogic/welcome1)

BEFORE VIRTUALIZATION WITH OSB

AFTER VIRTUALIZATION WITH OSB

Once completed, the overall Message Flow of the Oracle Service Bus Proxy should look like the following picture.

Page 3: Oracle OSB Tutorial 1

Creating Connection to Oracle WebLogic Server in JDeveloper

Launch JDeveloper From the Application Menu, select New.

In the New Gallery, in the Categories tree, select General, and then Connections. Select Application Server Connection Click OK.

The Create Application Server Connection Type page is displayed. Enter MyAppServerConnection in the Connection Name field and select WebLogic 10.3 from the Connection Type list. Click Next

Page 4: Oracle OSB Tutorial 1

The Connection Authentication page is displayed. Enter weblogic for the User Name and the password welcome1 for that administrator in the Password field. Click Next.

The Configuration page displays. Enter the following values: Weblogic Hostname (Administration Server): localhost Port: 7001 WLS Domain: soa_osb_domain Click Next.

The Test page displays. Click Test Connection. The following status should appear If the test is unsuccessful, ensure that Oracle WebLogic Server status is RUNNING, and retry the test. Click Next, and in the Finish page, click Finish.

You will see the connection in the Resource Palette

Page 5: Oracle OSB Tutorial 1

Load SOA Composite solutions into JDeveloper Need to load three SOA Composites into JDeveloper 1. POProcessing 2. CreditCardValidation 3. ConsumeJMSFulfillmentApp From the Application Menu, select Open, Browse to the application location as shown below to load the application into JDeveloper. Let us start with the POProcessing application Repeat Step 1 for CreditCardValidation and ConsumeJMSFulfillmentApp applications.

Deploying Composites to the Application Server

After you open the composite application, you can deploy it to the server The Deploy command rebuilds the app and writes the binary to disk. It also brings up the deployment plan dialog before deploying. When the server is stopped and restarted, the applications will remain deployed. In the project menu – right-click on the POProcessing project name - select Deploy. Make sure you have the project menu and not the application menu in order to see this option

Select Deploy to Application Server.

Page 6: Oracle OSB Tutorial 1

Click Next. If you redeploy the same composite multiple times then check Overwrite any existing composites with the same revision ID if you intent to just test and hence over write the existing deployed version of the composite. This will render existing instances Stale

Click Next. Do not check ApproveTaskDetails. Check ApproveTaskDetails if you are trying the tutorial on your local machine and deploying POProcessing composite the first time

Select the MyAppServerConnection to deploy. If the Application Server connection does not show up in the list, click on on the top right. This should display the MyAppServerConnection as shown below.

Click Next

Page 7: Oracle OSB Tutorial 1

Click Finish

Next the application is built and deployed. If there are no compilation errors, you will see on the SOA log, BUILD SUCCESSFUL and then the deployment starts.

In the Deployment log, view the details of the deployment.

Wait for your application to be deployed Repeat Steps 1 – 12 for CreditCardValidation and ConsumeJMSFulfillmentApp applications. You select the other composites from the Application Navigator as shown below You are now ready to test the composites

Page 8: Oracle OSB Tutorial 1

Running and Verifying the application with EM

Open your browser and navigate to EM. http://localhost:7001/em (The first time these screens are run after starting the server they will be slow as they are unpacked, compiled, and loaded into memory.) Login with weblogic/welcome1 (or appropriate password for your environment)

The Enterprise Manager opens to the “farm” view. You can see the status of your Server as well as the deployed Java applications and SOA composites.

Select validationForCC composite from the list of composites on the main farm view or on the left navigation bar. The composite page opens. On this page, you can see the Recent Instances (none yet), Faults, the Component Metrics (there is only one component in this composite), and the Services and References Metrics

Page 9: Oracle OSB Tutorial 1

Click Test button at the top of the screen. The Test page opens.

You can see the WSDL location, Operations list, and two tabs, Request and Response. Scroll down to the Input Arguments section. The first time you click on Test you might get the following error. You can ignore this error. Click on Test again

Specify your values for the payload. You can use the HTML form on the Tree View, which is default, or the XML source on the XML View. For smaller amounts of the data, using the HTML form view is probably easier. But for large payloads, it's easier to copy-and-paste your data into the XML View.

Enter the data “1234-1234-1234-1234” and click Test Web Service. When the composite completes, the screen changes to the Response tab and the returned value shown. From here, you can jump directly to this particular composite instance and view the flow.

Click Launch Message Flow Trace The Flow Trace screen opens and you can see the flow of your composite and the status of each service, component and reference

Page 10: Oracle OSB Tutorial 1

Click on the component to drill down into the Instance Details of the component Close the Flow Trace window, click on your composite to return to the composite page. You can see your Instance ID listed. You can return to the Flow Trace screen by selecting the Instance ID.

Getting the service description (WSDL) You can get the service description, or WSDL, of your composite from the Test page. This is useful because you may need it for applications to access your service, or to expose your service to others. Open the Test page for the composite you are interested in.

In the Test page you see the WSDL location. You also can see the Endpoint URL for each of the Operations defined in the WSDL.

Page 11: Oracle OSB Tutorial 1

1. Configure Service Bus Import Resources

Check to see if the SOA-OSB server is running. Make sure your credit card validation service is running Log into OSB Web Console (http://localhost:7001/sbconsole) username weblogic, password: welcome1 Click Create button in left hand corner of screen to start a new session. In OSB, all changes are done in a sandbox called a session. You first create the sandbox by creating a session in the change center. After a set of related changes are done, you deploy all the changes in the session as a unit by clicking Activate in Change Center.

We first need to create a project with sub folders. We could create it in the console, but instead we will import this to illustrate how configuration can be imported into OSB. If you chose to go directly to the solution, you can import the solution in the same way. Scroll down the left hand pane and click System Administration.

Click Import Resources (selected by default).

Click Browse and navigate to in your local file system. Select chap-1-starting-sbconfig.jar. Click Next then Import

Click the Activate button to commit the OSB configuration change.

Page 12: Oracle OSB Tutorial 1

Then click the Submit button

Click Project Explorer then Project Folders. You should see a top level project called Credit_Services with

sub folder BusinessServices.

Click Create in the Change Center to start a new session to start adding the required resources.

Click Credit_ Services. Add ProxyServices folder and Resources folder under Credit_Services folder by typing the folder names in the Enter New Folder Name field and pressing Add Folder. When finished your project structure looks as depicted below.

Navigate to the Resources folder. Click on Create Resources drop-down box and select Bulk - Resources from URL.

You will import resources from the WSDL URL of SOA Suite Server. You can simply paste the URL of the WSDL into the URL/Path field as depicted below. The precise URL to the WSDL file can be obtained from the validationForCC test page in Enterprise Manager console ( http://localhost:7001/em ) or by clicking the icon noted in the graphic below.

Page 13: Oracle OSB Tutorial 1

Be sure to remove any version numbering. It will be something like this. http://orabpm-server:7001/soa-infra/services/default/validationForCC/getStatusByCC?W SDL

Click Next. Click Import. You now have imported the WSDL and schema needed to create the Business Service for the credit validation service on Oracle Service Bus.

Configure Business Service

A business service defines the interface and connection information for an endpoint OSB invokes. It is similar to a composite reference.

Navigate to the BusinessServices folder. From the Create Resources drop-down, select Business Service.

Page 14: Oracle OSB Tutorial 1

On the General Configuration tab, fill in the Service Name and Description. Click the Browse button. This will bring up the window to select WSDL for the Business Service.

Click on link to WSDL imported in previous step, ValidateCredit_WSDL.

Page 15: Oracle OSB Tutorial 1

Select the execute_pt under the Ports and then press Submit.

Click Next through each of the remaining configuration screens. Review options available to business services. Accept all of the defaults. Finally, on last screen showing all the options together in a table format, scroll down and press Save (don’t forget this step and navigate away from this page before hitting Save or you’ll lose your changes).

Page 16: Oracle OSB Tutorial 1

From the Project Explorer view, Click on your new Business Service.

Click on Operational Settings Tab at top of page.

Check the box Enabled next to Monitoring. Change the aggregation interval to greater than ten minutes.

Enabling monitoring will collect metrics for your service such as average response time, average TPS and number of errors. You can define SLA alerts on these metrics.

Page 17: Oracle OSB Tutorial 1

The aggregation interval defines how often metrics will roll over. Generally for demos, you want to select something longer than 10 minutes, say 25 to 30 minutes. Note all the operational settings can be set at fine-grained Service level. Click Update button to save your changes.

Activate your changes by clicking the Activate button in left hand corner of screen. Add a Description to document what was done. This will help you identify later in the Change Center in case you would like to undo or re-do your changes. Click Submit. You are now ready to test your first OSB Business Service!

Select the next to your new Business Service to bring up the Test Console.

Before proceeding, ensure you can invoke the validationforCC service deployed to SOA.

Set the credit card number to 1234-1234-1234-1234. The test XML should look like this.

<cca:creditcardStatusRequest mlns:cca="http://www.globalcompany.com/ns/CCAuthorizationService"> <cca:CCNumber>1234-1234-1234-1234</cca:CCNumber> </cca:creditcardStatusRequest> Click Execute button.

Page 18: Oracle OSB Tutorial 1

Review the Response document for VALID, and close the test console window

Page 19: Oracle OSB Tutorial 1

Configure the Credit Card Validation Proxy

A proxy service is the OSB mediation logic that virtualizes the endpoints OSB routes to and decouples it from the client. We will first just create a proxy service exposed to the client that just routes to the business service. Later we will add more logic in the proxy service.

Click the Create button in the Change Center to start a new session.

Navigate to the ProxyServices folder. Click on Create Resources drop-down box and select Proxy Service.

On General Configuration page, Service Name ValidateCredit. For the easiest way to create the Proxy Service Routing to a Business Service follow Step 33. For the more lengthy process follow Steps On the General Configuration page, Select Create From Existing Service, Select Business Service and click on Browse to select the business service, validationForCC, you created. Click Last and Click Save (Don’t miss clicking Save).

Page 20: Oracle OSB Tutorial 1

Click Activate on left hand side of screen to commit your changes to the session. Click Submit. You are now ready to test your new Proxy!

Navigate to the new Proxy Service and click on the to bring up the Test Console for the Proxy

Service. You can click on to see the Message Flow logic for the Proxy Service

Cut and paste the same XML you used to test the validationForCC business service, or enter the credit card number of “1234-1234-1234-1234 into the Payload text box. Click on the Execute button. You should see output similar to when you tested your Business Service directly. Close the “Proxy Service Testing” window when complete.

Configure Message Flow. Navigate to the newly created Proxy Service via Project Explorer. Click on Create to start a new session in the Change Center.

Click on the Message Flow icon next to ValidateCredit. This will take you to the Message Flow

Notice a Route node has already been created to pass-through to the validateforCC business service.

Page 21: Oracle OSB Tutorial 1

Next you will add one stage (Stage allows grouping of related actions) with two actions to the Message Flow. Validate action will validate the incoming request payload against a schema type definition and if the validation fails, you will configure an error handler to signal the failure Report action will track incoming messages and stream data as it arrives from the POProcessing composite Click on the envelope above ValidateCredit Select Add Pipeline Pair.

Click on left Request_Pipeline and select Add Stage.

Click on new Stage and select Edit Stage.

Page 22: Oracle OSB Tutorial 1

Now we will add 2 Actions, Report and Validate. The Report action allows you to record any payload elements along with key-value pairs to a database. Validate action will allow us to check for valid input to credit card validation service and throw an error if invalid input message is detected. Click on Add Action->Reporting->Report.

You will see the Report action as below

Fill in fields as follows: Expression: $body (Click on <Expression>, Enter $body in text area, Click Save) Click Add a key: KeyName: CCNumber Key Value: ./cca:creditcardStatusRequest/cca:CCNumber To specify the Key Value, Click <XPath>

Page 23: Oracle OSB Tutorial 1

Either cut paste the above XPATH value into the text area OR select Variable Structures on the left bottom. Select body from Drop Down, Expand $body – execute (request) and select CCNumber (as shown in the figure below)

The Property Inspector field will be populated with the XPath as shown below. Click on Copy Property to copy the XPath automatically into the text area above. (Make sure the cursor is in the text area before you click Copy Property for the copy to work)

Click Save In the in variable field type body and Click Save

Add Validate Action – Click on Stage icon and Select Edit Stage, Add an Action – Message Processing – Validate

Page 24: Oracle OSB Tutorial 1

Fill in fields. XPath: ./* (dot slash star) variable: body Resource: XMLSchema_-1537259875* ( Element = "creditcardStatusRequest" ) Note: the schema resource name will not match exactly as the name specified above as the name includes hash code, which is generated based on the URL

Click Save Button. Navigate to top of message flow and click on envelope.

Select Add Service Error Handler. Click on Error Handler Select Add Stage.

Click on stage and select Edit Stage.

Page 25: Oracle OSB Tutorial 1

Click on Add Action -> Reporting->Alert

Configure the Alert as depicted below and click on Save All.

Activate the session in Change Center.

Re-wire POProcessing Composite Next you'll open your POProcessing composite and fix the getCreditCardStatus reference to invoke Oracle Service Bus. Open JDeveloper if not already open. Navigate to the POProcessing application. Double-click the composite.xml within “SOA_Content” folder in left hand pane open the Composite editor.

Page 26: Oracle OSB Tutorial 1

Double click the getCreditCardStatus reference link. In the Update Reference dialog click the icon next to the WSDL URL field. In the SOA Resource Browser select Resource Palette from the drop down. Expand the IDE Connections tree to select the ValidateCredit Proxy Service from OSB as shown below. Alternatively, you can also create a WSIL Connection to OSB (http://orabpm- server:7001/sbinspection.wsil) and browse the Proxy Service.

Click OK. This will populate the WSDL URL pointing to the OSB ValidateCredit Proxy Service

Page 27: Oracle OSB Tutorial 1

Click OK Save the composite.xml and Re-deploy the POProcessing Composite. To keep things simple, be sure to overwrite any existing composites of the same version, as shown here. Also, do not forget to leave the ADF Task Flow un-selected.

You are now ready to test your end-to-end scenario with Oracle Service Bus.

Test the end-to-end application After deploying, in the EM console, click on the POProcessing application and then open the Test page. You might get the following error when navigating in the Enterprise Manager FWM Control. You can ignore this error and simply repeat the action again

Page 28: Oracle OSB Tutorial 1

Click XML View. Create a large order which the Mediator will route to the BPEL approval process. Copy the entire contents and paste them into the large text field in your browser:

Click Test Web Service. Navigate back to the Oracle Service Bus console. Log in. Navigate to Operations Review the Message Reports. You will see the report as shown below


Recommended