In previous
exercises you learnt how to create an OSB Application (and Project), Proxy
Service and a Business Service in JDev 12c
Now, we are
going to create a Pipeline under ‘Pipelines/Split-Joins’ swim-lane
Please follow
the steps below:-
Give name to your pipeline
Select the correct WSDL
WSDL and Binding is populated once WSDL is selected in the wizard
Pipeline is created
Join Proxy with the Pipeline as below:-
Now we will create the flow in the pipeline. Double click the Pipeline
Now, right click on the 'SBDemoPP' node to add the operational branch as below:-
Operational Branch is used to provide you the separate pipelines for each operations which are exposed in the Proxy Service's WSDL. In our case we have exposed just one operation which is 'getDemo'
Now, right click on the 'getDemo' operational branch in order to add the 'Routing' Action.
NOTE: We can also use the 'pipelinepair' node instead of 'Routing'
Now, we will do the transformation of the data which is coming from the client into the format of the business service's wsdl which in turn will be converted into JSON format by the WADL before business service calls the REST Service i.e. http://fixer.io/
For doing this we will first create an XSLT transformation file. Source will be the schema file (demo.xsd) which have been used in Proxy Service and the Target will be the schema file (DemoCurrencyExchange.xsd). Follow the steps as below:-
Code must look like as below:-
Below is the design view of mapping:-
We are now done with the Request mapping..
Now we will add a validation of the request message coming from source as per the XSD (Demo.xsd)
Right click on the 'Request Action' and add a 'validate' and follow steps as below:-
The above 'validate' action will validate the request message against the schema. If it does not conform to the given schema, error will be thrown.
For response mapping, we will need to send these currency codes to XSL as parameters. For doing this, we need to add two 'Assign' actions after 'validation' we already added in pipeline. See below screenshots:-
Name this variable as 'varFromCurr' and provide value as below expression..
Similarly add another assign with variable name as 'varToCurr' and provide expression as below:-
Now, we will do the response mapping for converting the response coming from fixer.io API to the client side schema.
For seeing the XSLT code click here... or find path below:-
Response pipeline:-
Now, since we have made the response mapping i.e. response-xsl, we need to add a 'Replace' action in Response-Pipeline in order to get this XSL file working. After getting the business service called from 'Routing' action, we get the result from fixer.io API. So we need to pass this result to the response-xsl as input along with the variables 'varFromCurr' and 'varToCurr'
follow the below steps:-
Now, our service is ready, lets deploy it and test it using this post...