In this blog, I'm gonna to write a very basic example on the Oracle Service Bus 12.1.3.
After this blog, you should have learned to:
1) How to create SB(Service Bus) application with SB project
2) How to create simple REST service
3) Understanding of some basis components involved in the example
4) How to run and test REST service.
To complete this example, you must have Jdeveloper 12.1.3 installed on you computer with the integrated weblogic.
Let's get started.
After this blog, you should have learned to:
1) How to create SB(Service Bus) application with SB project
2) How to create simple REST service
3) Understanding of some basis components involved in the example
4) How to run and test REST service.
To complete this example, you must have Jdeveloper 12.1.3 installed on you computer with the integrated weblogic.
Let's get started.
Below are step by step procedure how to createe REST service and provide response in XML/JSON both:
1) Go to File -> New -> From Gallery -> Application-> Service Bus Application with Service Bus Project:
3) Enter Project name RestServiceProject and click Finish.
5) Create a schema called Rest.xsd under Schemas folder with below structure. The is very simple schema definition that will be used during REST adapter.
6) Double click on the RestServiceProject composite
7) Right click on the Proxy service swim lane and select REST adapter. REST adapter is used to create REST service.
8) Click on the + sign in the Operation Bindings section and click Add operation binding. This will allow us to create REST service operation.
9) Select GET from HTTP verb drop down as we are gonna to create simple GET operation
10) Click browse for schema file icon and select input element of Rest.xsd schema
11) Click on the Response tab. Select XML and JSON if you need output in both format. Click on the browse for schema file icon and select output element of the Rest.xsd schema
12) Click OK twice
13) Right Click on the middle swim lane of the composite and select Insert -> Pipeline.
14) Select WSDL radio button and click Browse WSDLs icon and select RestService.wsdl. Uncheck Expose as a proxy service and click Finish
15) Wire RestService and RestPipeLine together.
17) Drop Replace activity from component pallet in the Response pipeline
18) Select Replace activity and enter the expression as below:
<output>
<greeting>
{fn:concat("Hello ", $body/exam:input/exam:name)}
</greeting>
</output>
19) Composite will look like.
Service has been completed. It's time to test the service.
20 ) Right click on RestService and click Run
21) Enter name and click Execute button, you will see the output in XML format.
23) Go back and select application/json from Accept drop down to get response in json format.
24) Click Execute
So we have completed a very basic example of Service Bus.
More helpful example:
Tidak ada komentar:
Posting Komentar