In my previous post, I explained how we can
call Asynchronous web service from Oracle Service Bus using soa-direct protocol. But in many scenario’s we need to invoke asynchronous
web service from Oracle Service Bus using http protocol.
In this post I am going to explain how we
can invoke Asynchronous web service (Async Composite) from Oracle Service Bus over http protocol and route the call back response from Asynchronous web service to another proxy service which in turn call another composite (Second Composite).
Call Asynchronous Composite |
Follow below steps to invoke Asynchronous
Composite from OSB.
Create an Asynchronous Composite. Name it “AsyncComposite” and deploy it on SOA server.
Create a new OSB project and add three folders to it.
resources
proxyServices
businessServices
proxyServices
businessServices
OSB Project |
Click on “resources” folder.
Choose “XML Schema” from “Select Resource Type”, name it as
“AsyncCompositeSchema” and add it to resources folder. Similar ways choose
“WSDL” from “Select Resource Type”, name it as “AsyncCompositeWSDL” and add it
to resources folder.
resources folder |
Now create business service to
invoke Asynchronous Composite. To do this click on “businessServices” folder,
choose “Business Service” from “Select Resource Type”, name it as
“CallAsyncCompositeBS”.
Choose “WSDL Web Service” as “Service Type” and browse to above added WSDL file. Then select the port and submit it.
Choose “WSDL Web Service” as “Service Type” and browse to above added WSDL file. Then select the port and submit it.
BusinessService |
Accept defaults and save this
business Service.
Now create proxy service to invoke above created business service. To do this click on “proxyServices” folder, choose “Proxy Service” from “Select Resource Type”, name it as “CallAsyncCompositeProxy”.
Choose “Business Service” as “Service Type” and browse to above created Business Service. Accept defaults and save this proxy service.
Now create proxy service to invoke above created business service. To do this click on “proxyServices” folder, choose “Proxy Service” from “Select Resource Type”, name it as “CallAsyncCompositeProxy”.
Choose “Business Service” as “Service Type” and browse to above created Business Service. Accept defaults and save this proxy service.
Proxy Service |
Follow below steps to get response back
from Asynchronous Composite.
Create a synchronous or one-way
composite, name it “SecondComposite” and deploy it to SOA server. You can
create either synchronous or One-way as we created this composite to show that
our call back proxy is working.
Go to OSB project that we
created above and click on “resources” folder. Add XSD and WSDL of
SecondComposite to resources folder.
resources folder |
Now create business service to
invoke Synchronous Composite. To do this click on “businessServices” folder,
choose “Business Service” from “Select Resource Type”, name it as “CallSyncCompositeBS”.
Choose “WSDL Web Service” as “Service Type” and browse to above added WSDL file. Then select the port and submit it.
Accept defaults and save this business Service.
Now create proxy service to invoke above created business service. To do this click on “proxyServices” folder, choose “Proxy Service” from “Select Resource Type”, name it as “CallSyncCompositeProxy”.
Note down the “Endpoint URI “. In our case it is “/CallAsyncService/proxyServices/CallSyncCompositeProxy”.
Endpoint URI |
Now we will complete the sample. We will
configure “CallAsyncCompositeProxy” to send the call back response from
Asynchronous Composite to CallSyncCompositeProxy.
Go to CallAsyncCompositeProxy
and click on “Edit Message Flow”.
Proxy Message Flow |
Right Click on route node and
choose “Edit Route”.
Proxy Service Message Flow |
Add Assign activity to flow.
Assign Activity |
Inside assign replace soap
header to below one.
<soap-env:Header
xmlns:ns1="http://schemas.xmlsoap.org/ws/2003/03/addressing">
<ns1:MessageID>ws:uniqueAddress</ns1:MessageID>
<ns1:ReplyTo>
<ns1:Address>http://localhost:8011/CallAsyncService/proxyServices/CallSyncCompositeProxy</ns1:Address>
</ns1:ReplyTo>
</soap-env:Header>
Remember ReplyTo address
refers to CallSyncCompositeProxy endpoints.
SOAP Header |
Edited Message Flow |
Below are testing results
Test Console |
EM Console |
This comment has been removed by the author.
ReplyDeleteGood Post
ReplyDelete