Showing posts with label demo. Show all posts
Showing posts with label demo. Show all posts

Saturday, 22 October 2016

Operation Based Routing using mediator

 Operation based routing from Mediator 



Mediator is one very important component of SOA Suite.  Mediator is routing mechanism, decide which BPEL or service need to be called. There can be five different type of routing, which is possible is using the mediator.

1. Operation Based Routing

2. Content based routing.

3. Dynamic Routing

4. Event based Routing.

5. Header Based routing.


In the current example we are talking about the operation based routing. Other examples which will be followed in the other following posts. 

Now first what is mediator, its one of the basic component of SOA suite, which works as a router between the service calls and BPEL or any other component connected to Mediator.

 Now first we are taking content based routing, here based on the content of payload we mediator will  decide which BPEL/Service to be called.


 For this we are taking a very simple example of payload and we are first designing the WSDL to allow four different operations

1. Add
2. Substract
3. Delete
4. Multiply



Application Creation.

1. First we need to create an SOA application. Open the jdevelper and select for SOA Application.



2.  Now give name as "SOAOperationBasedRoutingDemo"  and then say next.



3. Now name the project "MediatorOperationBasedRoutingDemo" and then click next. You can choose your own name also, map the instructions accordingly.


4. Now choose the empty composite and then then finish it will create an empty composite.



Schema Creation 


1. Now select the schema and then say -> New --> Xml Schema and say OK.


2. Now name the schema as mediatorDemoSchema.xsd and say finish. you can change the namespace or can leave it.


4. Now create one request and one response element as give below, its a simple xsd. You can copy the schema from our project also.


5. Now we are going to create wsdl which is having two operations.


6. Now  name the wsdl and MedatorOprationsWSDL.



8. Once WSDL is created then you need to  create the message first name the message as "mathOperationRequestMessage".  then create the part and select the referece value as MathRequest from the schema we created.





9. Once created then we need to create one more message as mathOperationResponseMessage. Choose the porty type.




10.Once done we can create two opreations inside it, name it as given in the two images.





Mediator Creation

  1. Now place the mediator from the component palate to the Composite and then we can choose wsdl now choose the wsdl from the location where we have created.






2. Let the service to be exposed as SOAP to be checked.



3. It will create the mediato like given below with two operations.




BPEL Creation

1. Now we can place the BPEL from the component palate to composite, name is AdditionBPELProcess and then choose template as :Synchronous" and then select input and putput type from the xsd.





2. It will look like with all the parameters. now say ok.
.

3. Once BPEL is created then attach the wire between the BPEL and mediator it will ask you to select the operations select for the addition.





3. Now add a assign activity to BPEL and assign the sum of param1 and param2 to result and :"Success" string to status.





4. Complete assign will look like this.



5. Now go back to composite and add one more BPEL which is multiplicationBPEL.


6. Choose the same parameters as we did for the last BPEL and final outcome will look like below and thenclick ok , which will create one more MultiplicationBPEL.


7. Now add the multiplication BPEL to Mediator and select the operation as multiplication.



8. Now add a assign activity and assign multiplication to the result as given below.




Once you are done your process are ready for the deployment.  Deploy the composite to the integrated server and test it.


Testing.

1. Select the operation as addition and then provide both the parameters,  then click on test.






2. You can change the operations now and can choose the operation as multiplication now the multiplication BPEL will be executed.






Download the sample

You can download the sample from the location.





Exercise 


1. Add one more operation to the Mediator, which is subtraction.



Please let me know the feedback. Happy to hear feedback from you.






Wednesday, 24 August 2016

Using Database Adapter SOA 12C

Database Adapter 




We are starting one of most important topic of SOA, database adapter. Its very unlikely that a project in fusion middleware have not used, database adapter.

In SOA we know everything is presented a webservice. Hence to create a process if we need to do some interaction with database then we have two options

1. Create a webservice in any technology  and then expose it.

2. Directly interact with database using the database adapter.


As the name suggest this adapter provide an interface between the database and present it our process in webservice form.  Once this adapter created then there is almost no difference calling a werservice from the BPEL process or calling a database adapter.

  But there are some steps involve in weblogic also. We are breaking this post into two steps

1. Creating a create, insert, delete operations. (Post 1)

2. Weblogic configurations  (Post 1)

3. Calling a plsql procedure from database adapter  (Post 2)

4. Calling a plsql procedure with types from database adapter   (post 2)


In this post we will create a employee and then will update the employee and read it.


1. First create a schema, which have following attributes

  a. emloyeeName
  b. userName
  c.  firstName
  d.  LastName

 or take schema from the project link, given below.
   



2. Once done create a new application and project, and add the new schema, can copy the employeeSchema from the project added in this blog.




3. Now create a new BPEL and choose request and response schema, from the xsd which is been copied from the project.




4, Now create a new connection and give the credentials according to your database.








5.  Now create a new database adapter and name it employee schema.


b) Now choose the db connection which we created earlier.


c) Now choose all the options which you want this db adapter to perform.


d) Now choose table, in this example, we are using employee schema.





g) In this i have created an employeeId parameter to select the employeeId for select.


See the images given below.



6) Now we can call this db adapter as a simple service.  Use xlst or assignment to assign the values to the service (db adapter).




7. Now we are ready to start for the testing of our object. Deploy and provide the inputs.



Weblogic Configurations. 

    Database Connection Creation 
    1. Create a new connection in the web-logic server use the below screenshots for more clarity.


2. Now have the connection, almost same as given below. JNDI name should jdbc/HRDB


3. Now add the information about the host and also the username and also password.


4. Now test the connection and add the target as the Default server.







    DB Adapter Connection Creation 

      1. Now go the weblogic console again and click on deployments, now you can see database adapter as of the application.  To use any connection our connection should be available under database adapter.

     
   

  2. Once DB adapter application open click on configuration and then select outbound connection pools. Once here click on new. 


3.Now provide the JNDI name as eis/db/HRDB.  This jndi should be the same name, which was used in the database adapter. Actually this connection database adapter will search in the application and this connection pool will allow connection to the actual database.


4. Now enter XADataSource name, as we want adapter to execute and should not take part in the actual transaction.  Once done save.



5. Now update the database adapter, select the database adapter and the update.

6. Now it will show the deployment plan and then finish. In SOA 12c, we can use it post deployment.  In older version we need to first restart before using it.






Running part 1.


   Now deploy the application and once deployed you can provide the payload stored with the application.


Once its done click on launch the flow trace and you can see the below level of flow trace.



Database Running.

 Now check the database, this row is already there.


 


Download 


 Please use the link to download the exercise.



Exercise 

1.  Add an operations to delete the employees.

2.  Add an BPEL to merge the employees.


Let us know your feedback. We are continues with next post for the Plsql procedure.