OSB-12c : WSDL,XSDs usecase
Oracle Service Bus defines
some types of business services and proxy services using a WSDL, an XML-based
specification for describing Web services. A WSDL document describes service
operations, input and output parameters, and how a client application connects
to the service.
Create new service bus project and rename it as ‘ServiceType_useCase’.
Create folder and sub folders as mentioned below.
Create new XML schema and name it as “SampleRequest.xsd”.
XSDs (Right Click) New -> XML Schema
A pop up window will appear name XML schema as “SampleRequest.xsd”.
In below screen shot you can see design view of XML schema.
Rename Root element as “SampleRequest” and add sequence to it.
SampleRequest (Right Click) Insert Inside Element -> Sequence
Similarly add element inside sequence.
Add two elements inside
sequence and name it as ‘Input1’ and ‘Input2’.
Similarly specify datatype for elements.
(Right Click) Input1 -> set Type -> xsd: float
Note: Here we have considered data type as float, but you can choose any data type as per requirement.
Similarly create response schema and rename it as “SampleResponse.xsd”.
Specify element and name it as “Output” and set data type as “double”.
Next we need to create WSDL using these schema files.
WSDL -> (Right Click) -> New -> WSDL (Builder)
Name WSDL as “SampleTest.wsdl”
and select Interface type as “Synchronous Interface.”
Binding: execute_bind
Port Type: execute_ptt
Operation: execute
Interface Type: Synchronous
Interface
In ‘Input’ section of WSDL
builder click on ‘+’ and select element type of “SampleRequest.xsd”. Specify
part name as “Request”.
Similarly in ‘Output’ section
of WSDL builder click on ‘+’ and add element type of “SampleResponse.xsd”.Finalized WSDL builder will be
shown as below.
Below is design view of WSDL.
Create new http based proxy service along with pipeline.
Name pipeline service as
“WSDL_Based_ServiceTypePipeline”. Select option in Template.(Click on check
box)
Select
RoBTESB_REQ_WSDL_CapabiltiyAccessPipeline_Template
Select Created
“SampleService.wsdl”
Note: Here in this case we
have created Mock service to get static response like “WSDL based service type
tested successfully.”
Add a Service Callout activity and invoke created “WSDL_MockResponse” service.
Response from mock service will be saved in a variable called ‘$response’.
In Request action of Service callout add a Transport Header activity and add new header with below details.
Direction: Outbound request
Action: Set
Name: transportHeader
Value: WSDL.
In addition to Transport Header, add one assign node in request action of service callout and include logic to sum up values of input.
sum(($body/exam:SampleRequest/exam:Input1,$body/exam:SampleRequest/exam:Input2))
Save result in a variable called ‘$addedResult’.
Add a replace activity in
Response action of Service callout and replace body with contents of $response
(output result from Mock service).
Next add an Insert activity to
insert contents of $addedResult into changed body.
Deploy service into standalone server and once deployment is successful, we can locate this service in sb console.
Run WSDL_Based_ServiceType pipeline.
Pass some valid values as shown below in request structure.
One successful execution we
will get response as shown below.


































Comments
Post a Comment