In my previous post I explained how to call
Synchronous SOA service from Oracle Service Bus using soa-direct protocol. In this post I will explain
you how to call Asynchronous SOA service from Oracle Service Bus.
or
You can take "Endpoint URI" from "location" attribute under <Service> tag of AsynchronousComposite Wsdl file.
Only difference between Synchronous and
Asynchronous call is, in case of Asynchronous call we need to created extra
“Call Back Proxy Service” which gets the response back from Asynchronous SOA service.
First of all we need to have Asynchronous
web service. I created one Asynchronous BPEL process that we will invoke from
Oracle Service Bus.
In this post, we will use “soa-direct” OSB protocol to connect to
Asynchronous SOA service. For this one you need to use Direct Binding in
Asynchronous web service instead of default binding. To change the binding go
to Composite.xml and comment out binding.ws part inside service tag.
Original
service tag
<service
name="asynchronousbpelprocess_client_ep"
ui:wsdlLocation="AsynchronousBPELProcess.wsdl">
<interface.wsdl interface="http://xmlns.oracle.com/TestApplication/AsynchronousComposite/AsynchronousBPELProcess#wsdl.interface(AsynchronousBPELProcess)"
callbackInterface="http://xmlns.oracle.com/TestApplication/AsynchronousComposite/AsynchronousBPELProcess#wsdl.interface(AsynchronousBPELProcessCallback)"/>
<binding.ws
port="http://xmlns.oracle.com/TestApplication/AsynchronousComposite/AsynchronousBPELProcess#wsdl.endpoint(asynchronousbpelprocess_client_ep/AsynchronousBPELProcess_pt)"/>
<callback>
<binding.ws port="http://xmlns.oracle.com/TestApplication/AsynchronousComposite/AsynchronousBPELProcess#wsdl.endpoint(asynchronousbpelprocess_client_ep/AsynchronousBPELProcessCallback_pt)"/>
</callback>
</service>
Service
tag with Direct Binding
<service name="asynchronousbpelprocess_client_ep"
ui:wsdlLocation="AsynchronousBPELProcess.wsdl">
<interface.wsdl
interface="http://xmlns.oracle.com/TestApplication/AsynchronousComposite/AsynchronousBPELProcess#wsdl.interface(AsynchronousBPELProcess)"
callbackInterface="http://xmlns.oracle.com/TestApplication/AsynchronousComposite/AsynchronousBPELProcess#wsdl.interface(AsynchronousBPELProcessCallback)"/>
<binding.direct/>
</service>
Since we added Direct Binding in
comspoite.xml file so you can’t get WSDL and Schema files directly from EM
console. To get the WSDL and schema file go to http://host:8001/soa-infra/ login with
your credentials and select your deployed service and save WSDL and schema
files.
Step 1: Create a new OSB project and import
Asynchronous web service WSDL and import as I mentioned in previous post also.
See previous Post Step 1 for details steps.
Step 2: Before creating Business service,
we require Call Back proxy service that we will use in business service.
- Click on “proxy” folder and choose “Proxy Service” as “Select Resource Type” from Create Drop down list.
- Give it any name and choose “WSDL Web Service” as Service Type. Click on Browse button and select previously imported WSDL file.
- Choose AsynchronousBPELProcessCallBackDirectBinding1.2 from Bindings and click Submit. Then click on Next button.
- Choose “sb” protocol and click next.
- Accept default values and we have call back proxy service ready. Now we can move to Business service creation.
Step 3: In this step we will create
Business Service based on Asynchronous web service WSDL file.
- Click on “business” folder and choose “Business Service” as “Select Resource Type” from Create Drop down list.
- Give it any name and choose “WSDL Web Service” as Service Type. Click on Browse button and select previously imported WSDL file.
- Select “AsynchronousBPELProcessDirectBinding1.2” from WSDL definitions. Click Submit and then go to Next step.
- Choose “soa-direct” protocol and check server host and port in Endpoint URI and click on Add button. Then click on Next button.
t3://localhost:8001/default/AsynchronousComposite!1.0/asynchronousbpelprocess_client_ep
Where t3 is protocol, 8001 is port
for soa server, default is web logic domain, AsynchronousComposite!1.0 is name of composite with version (
project), asynchronousbpelprocess_client_ep
is name of the service tag inside
wsdl file.
or
You can take "Endpoint URI" from "location" attribute under <Service> tag of AsynchronousComposite Wsdl file.
- Select “Asynchronous client” as Role. Then browse for Call Back proxy service and choose previously created Call Back proxy service.
- Accept Default values and you are ready with Business service.
Step 4: Now we will create Proxy service
that will invoke Business service that we just created.
- Click on “proxy” folder and choose “Proxy Service” as “Select Resource Type” from Create Drop down list.
- Give it any name and choose “WSDL Web Service” as Service Type. Click on Browse button and select previously asynchronous web service WSDL file.
- Select Direct Binding port. Accept Default values.
- Now we are ready with Client proxy service.
Step 4: Only step remaining is to connect
Client proxy service to Business Service.
- Go to Client proxy Service Message flow.
- Add Route Activity to proxy service flow to call Business Service. You can edit the name of the route activity.
- Now Go to Edit Route.
- Add a new Action “Routing” inside Route Node.
- Choose Business Service. And choose operation for the Business Service.
This is it. Now we are ready to test it.
Testing
Scenario: From Outside we will invoke Client Proxy
service then Client proxy service will invoke Business Service which in turn
calls Asynchronous web service. Asynchronous will process the message and send
the response back asynchronously. Call back proxy catch that response and we
can do whatever we want to do there.
Go through my previous Post
hi Vivek,
ReplyDeleteThanks for the post, this was really helpful. But, we have a requirement to call an external Async wsdl (with http transport). Can you please advice how can we configure the CallBack client details when the transport is 'http'
Regards,
Krishna
Krishna,
ReplyDeleteTo call Async wsdl from OSB we need to use soa-direct protocol. Till now I don't know any way to configure CallBack client for Async Wsdl with http protocol. I will get back to you if I get it working.
Regards,
Vivek
Krishna,
ReplyDeleteI created a new post to explain how we can call Async web service from OSB over http protocol.
http://soawork.blogspot.in/2012/12/call-asynchronous-webservice-from-osb-over-http.html
Regards,
Vivek
If you follow all the steps then it should work but if you are still facing any issue then please send me your code, I will look into it.
ReplyDeleteVivek
How can I get the status of Callback proxy in my response in OSB ???
ReplyDelete