Monday 28 March 2016

Creating the composite (Client) by configuring OWSM Client Policy to Invoke Sevice


Create this composite by following the step by step procedure from this post Click Here
and for the Hello World service which is configured with OWSM Service Policy please visit the post Click Here



Give the URL of the deployed Hello World service in the WSDL URL tab and name it as InvokingHelloWorldProject.



Click OK and join BPEL with the web service created.





I. Configuring OWSM Client Policy for the InvokingHelloWorldProject Service

Right Click on the service --> Configure WS Policies



Click on Add(+) button and Select oracle/wss_username_token_client_policy from Server Security Policies



Click OK



Click on Edit Policy which is highlighted below



Give Override Value in csf-key as TestKey which is the name of the key configured in em console (for detailed steps Click Here) and Click OK.

Finally the composite will look as below



Double click on BPEL

1) Add Invoke and join that to Partner Link (InvokingHelloWorldProject)
2) Add two assigns (one before invoke and after invoke as shown below)



Assign1:



Assign2:



Now Deploy and Test.

Testing the client

Request:



Response:



Launch Flow Trace:



Thank You!!!!


Happy Learning!!!!

Testing the Hello World Service which is configured with OWSM Service Policy

For the Hello World service which is configured with OWSM Service Policy please visit previous post Click Here

Test 1: 

Invoking the service without selecting any security policy as shown below.



Then we will get SOAP Fault from server:Invalid Security: error in processing the WS-Security error.



Test 2:

Before invoking the service we will perform following steps along with Input Request.

1) Select oracle/wss_username_token_client_policy policy inside OWSM Security Policies and
2) Provide the proper username and password which is used to connect to the server.



Click on Test Web Service button



Now we will get the proper response as shown above.

Example:

Input: Shankar
Output: Hello Shankar

Thank You!!!!


Happy Learning!!!!

Configure OWSM Policy to the domain in em console and to the Service

Use Case: Configure OWSM Policy inside the domain in em console and to the service to provide security.

To create Hello World Service please visit this post Click Here

I. Configure OWSM in em console for the particular domain.

login in to http://localhost:7001/em and follow the below steps 

Inside WebLogic Domain Right Click on your specific domain --> Security --> Credentials  



Here we need to follow two steps

a) Create Map b) Creating Key based on Map

Create Map:

Click on Create Map



Map Name should be oracle.wsm.security (Standard Name)

Note: If you give other than oracle.wsm.security name this policy won't work.



Map Created Successfully



Create Key:

Click on Create Key and give the following details

1. Select the Map which is created earlier
2. Give the Key Name (It's User Choice)
3. Give User Name, Password, Confirm Password
4. Description (Optional)



and Click OK



Now we will see the created Key as above.

II. Configuring OWSM Policy for the created Hello World service



Click on Add(+) button



Select oracle/wss_username_token_service_policy from Server Security Policies



Click OK



Click on Edit Policy which is highlighted below



Give Override Value as TestKey and Click OK



Now the composite will look like below



Now its ready to deploy and test.

Thank You!!!!


Happy Learning!!!!

Saturday 26 March 2016

Creating a client for Addition Of Two Numbers using JDeveloper

Use Case: Creating a client to invoke the SOAP Based Web Service for Addition of two numbers.

To create SOAP Based Web Service for Addition of two numbers, to deploy and to test the service please visit my previous post Click Here  

1) Right click on AdditionWS.java service and select Create Client for Web Service Annotations



Select the target project and click Next



Check copy WSDL into project which is optional and click Next



2) Give the Package Name as com.addition,client and click Next



Click Next



Click Next



Click Next



Click Next



Click Finish



3) Now we can see the following files created inside the package com.addition.client

Open AdditionWSPortClient.java to test the AdditionWS service.



4)  Add following lines to the code

int number3 = additionWS.add(20,21);
System.out.println("Addition of two numbers is: "+number3);

Now run this java class



We will get the result as Addition of two numbers is: 41 as highlighted above.

Thank You!!!!


Happy Learning!!!!

SOAP Based Web Service for Addition Of Two Numbers using JDeveloper


Use Case: Creating SOAP Based Web Service for Addition of two numbers.

1) Create a new J2EE Web Application



2) Name the application as AdditionOfTwoNumbersWebService



3) Name the project 1 (i.e. Controller) as AdditionOfTwoNumbersController



Click Next



4) Name the project 2 (i.e. Model) as AdditionOfTwoNumbersModel



Click Next



Click Finish



Initial structure of Application with two Project's will look as below



5) Create a Java Class with
    Package: com.addition.ws
    Name: AdditionWS



6) Now write a simple method add which takes two input numbers and returns addition of those numbers as result as shown below.



Configuring/Creating Web Service

7) Right click on AdditionWS.java class and select Create Web Service option



Click Next



Click Next



Select Document/Wrapped and click Next



Select the method add(int number1,int number2):int and click Next



Click Next



Click Next



Click Next



Click Finish



8) Now Soap based service is created for Addition Of Two Numbers as you can see the symbol on AdditionWS.java has been changed which indicates that it is a service.



Testing Web Service generated/Created

9) Right click on AdditionWS.java and select Test Web Service which internally starts the integrated weblogic server and deploys this application on top of it.



10) After completion of weblogic server start with deploying the application we will get the below window open where we are providing some inputs for Addition of two numbers service.

Input1: 20 
Input2: 21

Click on Send Request



11) We will get the following result with status 200 OK

Result: 41



Thank You!!!!


Happy Learning!!!!