Create REST Service in OSB 12c over BD
Starting by creating Database adapter to the table you need
Please provide a meaningful name
Choose the DB connection from the application server you are deploying to
Choose the DB connection from the application server you are deploying to
The recommended way to run SQL’s
Choose the DB schema and run query to get the tables, views and synonyms list
The import will bring the table to the work area
Next for now
Choose the fileds to retrieve In this case, there is a screen that is skipped because the table has clear primary key. In other cases, such as views, you will have a selection of the key fields. It is important to select the fields that reflects the unique key of the data you retrieve
Add the parameter. In this case the CustomerId
Add the parameter. In this case the CustomerId
Add to use the parameter
OK, Next, Next, Finish
Time to deploy and test the DB adapter
Copy and save for later
Create the service response schema
Please provide a meaningful name
In my case, the response schema is generated from a JSON. This is good if you already have an existing service. You can always create it manually.
The copied JSON and Next
The schema and Next
Create a service proxy to be exposed
Please provide a meaningful name This is to use the schema you just created
Edit the path to call the service Add an operation
Give a nice name to the operation Add the parameter according to the DB parameter from the DB adapter
The parameter definition The Expression can be used to get or manipukate the parameter in the process
Finished with the Request and go to Response
Choose the response schema If you haven’t created the schema before you can do it now in the same way The schema you created
Response payload format
Service Proxy is done but not complete without a connection to something
Start with the Pipeline. This is center piece to complete the development
Select the WSDL of the Service Proxy. The WSDL was generated during the creation of the proxy. Why WSDL and not WADL? This is because OSB “nature” is SOAP and this service is not pure REST. The Service Proxy is exposing REST while the DB adapter is exposed internally as SOAP
Create the XSL to map the DB result with the REST/JSON response
The DB adapter Response is the Source of the map
The Service Proxy Response is the Target of the map
Review the Source schema Review the Target schema
The xsl:for-each covers the multiple records in the response. Please learn Xpath, Xquery and XSLConnecting the fields by dragging
Double-click to open
Create the Variables that you will use very soon Create this by drag&drop from Nodes icons on the right
Create this by drag&drop from Communication icons on the right Choose the DB adaptor service you created Choose the DB adaptor service you created
Choose the DB adaptor service you created Use the variables for Input and Output payload Using Variables provides flexibility to manipulate the service calls as you will see soon enough
Remember the XML from the DB Adaptor test? This is where you use it. The CustomerId parameter is provided with Xpath that extract it from the Body. The Assign activity insert a value to a variable. In our case, it creates the Request for the DB Adaptor service The Assign activity insert a value to a variable. In our case, it creates the Request for the DB Adaptor service
The Replace takes the response from the DB and converts it to the output of the service by using the XSL you created 1. Choose XSLT Resource from the list 2. Select the XSL you created 3. The variable that will accept the result The part of the Response where everythiong is done The scope of the Replace effect
Thank you!

Create rest service in osb 12c over database table

  • 1.
    Create REST Servicein OSB 12c over BD
  • 2.
    Starting by creatingDatabase adapter to the table you need
  • 3.
    Please provide ameaningful name
  • 4.
    Choose the DBconnection from the application server you are deploying to
  • 5.
    Choose the DBconnection from the application server you are deploying to
  • 6.
    The recommended wayto run SQL’s
  • 7.
    Choose the DBschema and run query to get the tables, views and synonyms list
  • 8.
    The import willbring the table to the work area
  • 9.
  • 10.
    Choose the filedsto retrieve In this case, there is a screen that is skipped because the table has clear primary key. In other cases, such as views, you will have a selection of the key fields. It is important to select the fields that reflects the unique key of the data you retrieve
  • 11.
    Add the parameter.In this case the CustomerId
  • 12.
    Add the parameter.In this case the CustomerId
  • 13.
    Add to usethe parameter
  • 14.
  • 15.
    Time to deployand test the DB adapter
  • 16.
    Copy and savefor later
  • 17.
  • 18.
    Please provide ameaningful name
  • 19.
    In my case,the response schema is generated from a JSON. This is good if you already have an existing service. You can always create it manually.
  • 20.
  • 21.
  • 22.
    Create a serviceproxy to be exposed
  • 23.
    Please provide ameaningful name This is to use the schema you just created
  • 24.
    Edit the pathto call the service Add an operation
  • 25.
    Give a nicename to the operation Add the parameter according to the DB parameter from the DB adapter
  • 26.
    The parameter definition TheExpression can be used to get or manipukate the parameter in the process
  • 27.
    Finished with theRequest and go to Response
  • 28.
    Choose the responseschema If you haven’t created the schema before you can do it now in the same way The schema you created
  • 29.
  • 30.
    Service Proxy isdone but not complete without a connection to something
  • 31.
    Start with thePipeline. This is center piece to complete the development
  • 32.
    Select the WSDLof the Service Proxy. The WSDL was generated during the creation of the proxy. Why WSDL and not WADL? This is because OSB “nature” is SOAP and this service is not pure REST. The Service Proxy is exposing REST while the DB adapter is exposed internally as SOAP
  • 34.
    Create the XSLto map the DB result with the REST/JSON response
  • 35.
    The DB adapterResponse is the Source of the map
  • 36.
    The Service ProxyResponse is the Target of the map
  • 37.
    Review the Sourceschema Review the Target schema
  • 38.
    The xsl:for-each coversthe multiple records in the response. Please learn Xpath, Xquery and XSLConnecting the fields by dragging
  • 39.
  • 40.
    Create the Variablesthat you will use very soon Create this by drag&drop from Nodes icons on the right
  • 41.
    Create this bydrag&drop from Communication icons on the right Choose the DB adaptor service you created Choose the DB adaptor service you created
  • 42.
    Choose the DBadaptor service you created Use the variables for Input and Output payload Using Variables provides flexibility to manipulate the service calls as you will see soon enough
  • 43.
    Remember the XMLfrom the DB Adaptor test? This is where you use it. The CustomerId parameter is provided with Xpath that extract it from the Body. The Assign activity insert a value to a variable. In our case, it creates the Request for the DB Adaptor service The Assign activity insert a value to a variable. In our case, it creates the Request for the DB Adaptor service
  • 44.
    The Replace takesthe response from the DB and converts it to the output of the service by using the XSL you created 1. Choose XSLT Resource from the list 2. Select the XSL you created 3. The variable that will accept the result The part of the Response where everythiong is done The scope of the Replace effect
  • 46.