Documente Academic
Documente Profesional
Documente Cultură
it's not what you know and who you know but who knows that you
know.
Tuesday, March 28, 2017
Introduction
WS-Addressing
Creating an asynchronous web service with Oracle SOA Suite
Generating a consumer to an asynchronous web service
using Oracle JDeveloper
Adding a new web service operation. Mediator
Conclusions
Introduction
WS-Addressing
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wsa="http://www.w3.org/2005/08/addressing"
xmlns:ins="http://xmlns.oracle.com/sca/tracking/1.0">
<env:Header>
<wsa:To>http://hostname:8001/soa-infra/services/default/AysncB/client_ep</wsa:To>
<wsa:Action>http://xmlns.oracle.com/AsyncA/AsyncB/BPELProcessB/BPELProcessB/process</wsa:Act
ion>
<wsa:MessageID>urn:62772860C2DE8F6A0634D09B</wsa:MessageID>
<wsa:RelatesTo>urn:62772860C2DE8F6A0634D09B</wsa:RelatesTo>
<wsa:ReplyTo>
<wsa:Address>
http://hostname:8001/soa-infra/services/default/AsyncA!1.0*2fc449a6-fa51-
440a-afae-b143d9c26d88/BPELProcessB%23BPELProcessA/BPELProcessB
</wsa:Address>
<wsa:ReferenceParameters>
<ins:tracking.ecid>...</ins:tracking.ecid>
<ins:tracking.conversationId>...</ins:tracking.conversationId>
<ins:tracking.parentComponentInstanceId>...</ins:tracking.parentComponentInstanceId>
</wsa:ReferenceParameters>
</wsa:ReplyTo>
</env:Header>
<env:Body>
:
</env:Body>
</env:Envelope>
view rawws-addressing-request.xml hosted with ❤ by GitHub
The was:To header contains the endpoint, the request is sent to.
The wsa:Action header is a reference on the action that will be being
invoked. Unique message id is passed in the wsa:MessageID header as
well as the unique id of the related message, which is the request we are
answering to, is contained in the wsa:RelatesTo header. Because the
above message is a request, not a response,
the wsa:MessageID and wsa:RelatesTo contains the same values.
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wsa="http://www.w3.org/2005/08/addressing"
xmlns:ins="http://xmlns.oracle.com/sca/tracking/1.0">
<env:Header>
<wsa:To>http://hostname:8001/soa-infra/services/default/AsyncA!1.0*2fc449a6-fa51-
440a-afae-b143d9c26d88/BPELProcessB%23BPELProcessA/BPELProcessB</wsa:To>
<wsa:Action>processResponse</wsa:Action>
<wsa:MessageID>urn:62772860C2EBFB26F9ED8D4E</wsa:MessageID>
<wsa:RelatesTo>urn:62772860C2DE8F6A0634D09B</wsa:RelatesTo>
<wsa:ReplyTo>
<wsa:Address>
http://www.w3.org/2005/08/addressing/anonymous
</wsa:Address>
<wsa:ReferenceParameters>
<ins:tracking.conversationId>...</ins:tracking.conversationId>
<ins:tracking.parentComponentInstanceId>...</ins:tracking.parentComponentInstanceId>
</wsa:ReferenceParameters>
</wsa:ReplyTo>
</env:Header>
<env:Body>
:
</env:Body>
</env:Envelope>
view rawws-addressing-response.xml hosted with ❤ by GitHub
Here we can see, the value of header wsa:To is equal to the data in
request's header wsa:ReplyTo/wsa:Address. In the same time, the value
of the wsa:RelatesTo header is the same as the one in
header wsa:MessageID. Because the message is a response and it's
impossible to send another response on a response,
the wsa:ReplyTo/wsa:Address header contains the stub
address: http://www.w3.org/2005/08/addressing/anonymous.
Let's look how to leverage Oracle SOA Suite for the creation of an
asynchronous web service. The business logic of the demo service will be
encapsulated to an asynchronous BPEL-process.
The second step of the master helps to create a project. Project name
and a folder for project's sources must be specified. Since an SOA
application is being created, technology "SOA" already is under selection.
The third step of the master is used for the specification of the Oracle
SOA Suite composite under construction and it's template. For demo
purposes, we should create a number of XSDs specifying the service's
interface; therefore, firstly the 'empty composite' template should be
selected.
The name of the XSD file, source folder, target namespace and a prefix
for the namespace should be chosen from here.
For example, a web service for communication with Help Desk will be
created. The service will be used for the ticket registration and
publication of new comments for these claims. Two data types should be
put into the composite: tTicket is a complex type describes a claim,
and tTicketComment is a complex type describes a comment for a ticket
in Help Desk. The structure of these data types is the following:
Once the messages have been defined, the web service may be taken
under construction. Let's begin from the development of
operation CreateTicket. Operation logic will be encapsulated within
the CreateTicketBPELProcessBPEL-process. To create a new process, the
BPEL service component has to be moved from the Component palette to
the Composite area.
The BPEL process creation master will be here. A version of the WS-
BPEL specification has to be chosen: 1.1 or 2.0, and a name for the
process should be specified as well as a target namespace and a process
type: synchronous, asynchronous, or one-way (fire and forget). A very
important detail is the input and (if it's needed) output messages'
formats.
Once the OK button has been pressed, the created BPEL-process is put
into the Composite area. Because the Expose as a SOAP service checkbox
was checked, a WebService component is created simultaneously. This
web service is an entry point into the composite.
The service design is the following: when a request from a consumer
arrived at the entry point, the service puts it into a JMS queue. A receiver
consumes the request from the queue, handles it, shapes a response and
puts this one into a JMS response queue. The BPEL-process consumes the
response from the response queue and sends it to the callback service
provided by a service consumer.
There is the JMS adapter in Oracle SOA Suite. The purpose of the adapter
is to allow BPEL-processes to interact with JMS queues. To add a JMS
adapter to the composite, the adapter component has to be moved from
the Component palette to the Composite area. There is a master for
configuration the adapter. The first step of the master is for information
purposes only and would not be of interest to us. The name of the JMS
adapter has to be specified on the second step of the master.
On the third step of the master, a JMS provider type that will be used has
to be chosen, e.g. Oracle WebLogic JMS.
On the sixth step of the master, a pattern for JMS interaction should be
specified. The adapter can be a subscriber to a queue, produce JMS
messages to a queue, or request for incoming messages from a JMS
destination and replies by putting messages to a JMS destination either
synchronously or asynchronously.
On the seventh step of the master, the parameters for the Request
operation (destination name, message parameters, JNDI name for the
JMS Connection) have to be specified.
On the eighth step of the master, the parameters (the same as above)
for the Reply operation have to be specified as well.
On the second last step of the master, the schema that defines the
message payload of the JMS destination should be specified (schema file
location and schema element).
The last step of the master just contains the WSDL-file name created into
the project directory.
Once the Finish button has been pressed, the defined above JMS adapter
is put into the Composite area. The adapter should be connected to the
BPEL-process.
The most interesting part is the last activity, before callback sending, in
the BPEL process. Since Oracle SOA Suiteis a stateful solution, all
persisted before parameters are useful during the callback activity. The
state of a process instance is persisted in a database, so even if the
server was be restarted between the arrival of a request and the sending
of a callback, the process state would not be lost.
4. Select the partition in that to deploy this archive. If the server contains
no partitions, you cannot deploy this archive. Also, if the server is not in a
running state, you cannot deploy this archive. By default, a partition
named default is automatically included with Oracle SOA Suite. You
create partitions in the Manage Partitions page of Oracle Enterprise
Manager Fusion Middleware Control.
5. Review the deployment details on the Summary page.
Once the Finish button has been pressed, the composite deployment
process is started. The Deployment Finishedrecord in the Deployment -
Log window notices about the completion of the deployment process.
Once the web service has been deployed, the WSDL definition of the
service is available. Since the web service is generated by a BPEL-
process, the WSDL definition contains the partner link types which link
together asynchronous request and response.
targetNamespace="http://xmlns.oracle.com/TicketApplication/TicketService/CreateTicketBPELPro
cess"
xmlns:ns1="http://www.url.ru/integration/service/ticket"
xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
xmlns:client="http://xmlns.oracle.com/TicketApplication/TicketService/CreateTicketBPELProces
s"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<wsdl:documentation>
<abstractWSDL>http://SAMOLISOV:7001/soa-infra/services/default/TicketService!
1.0/CreateTicketBPELProcess.wsdl</abstractWSDL>
</wsdl:documentation>
<plnk:partnerLinkType name="CreateTicketBPELProcess">
<plnk:role name="CreateTicketBPELProcessProvider">
<plnk:portType name="client:CreateTicketBPELProcess"/>
</plnk:role>
<plnk:role name="CreateTicketBPELProcessRequester">
<plnk:portType name="client:CreateTicketBPELProcessCallback"/>
</plnk:role>
</plnk:partnerLinkType>
<wsp:Policy xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-
utility-1.0.xsd" wsu:Id="wsaddr_policy"
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
<wsaw:UsingAddressing xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"/>
</wsp:Policy>
view rawasync-wsdl.wsdl hosted with ❤ by GitHub
The WSDL definition contains two port types, the first port type
encapsulates the links on the defined above request messages while the
second one encapsulates the links response messages. The noted above
partner types make an association between the port types.
<wsdl:portType name="CreateTicketBPELProcess">
<wsdl:operation name="process">
<wsdl:input message="client:CreateTicketBPELProcessRequestMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:portType name="CreateTicketBPELProcessCallback">
<wsdl:operation name="processResponse">
<wsdl:input message="client:CreateTicketBPELProcessResponseMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="CreateTicketBPELProcessCallbackBinding"
type="client:CreateTicketBPELProcessCallback">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="processResponse">
<soap:operation style="document" soapAction="processResponse"/>
<wsdl:input>
<soap:body use="literal"
namespace="http://xmlns.oracle.com/TicketApplication/TicketService/CreateTicketBPELProcess"/
>
</wsdl:input>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="CreateTicketBPELProcessBinding" type="client:CreateTicketBPELProcess">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsp:PolicyReference xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
URI="#wsaddr_policy" wsdl:required="false"/>
<wsdl:operation name="process">
<soap:operation style="document" soapAction="process"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="TicketService_ep">
<wsdl:port name="CreateTicketBPELProcess_pt"
binding="client:CreateTicketBPELProcessBinding">
<soap:address location="http://samolisov:7001/soa-
infra/services/default/TicketService/TicketService_ep"/>
</wsdl:port>
</wsdl:service>
view rawasync-wsdl-porttypes.xml hosted with ❤ by GitHub
The Test Web Service button sends the shaped test request to the web
service endpoint. But, since the web service is asynchronous, the
response demonstration page won't be shown, only a page which
contains the Request successfully received status will be here instead.
The master should be used to define the project name and set of project
technologies. More generally, the set of project technologies can be
empty.
The created project will be added to the Application Navigation tree of
JDeveloper.
The next step is the stub generation. JDeveloper calls this stub as Web
Service Proxy and the menu for the stub generation is located in
the Business Tier/Web Services list of the Categories tree.
The Create Web Service Proxy master proposes one of the two most
widely used specification: JAX-RPC or JAX-WS. Let's select the last one.
A WSDL definition of the web service should be selected. The URL can be
copied just from the corresponding page of Oracle Enterprise Manager.
Default mappings from WSDL namespaces to Java packages have to be
provided. Because there is a partner link type connecting a port type for
requests with a port type for responses in the WSDL, the Generate As
Asynccheckbox is available. If the checkbox is checked, the callback
service stub will be generated as well.
The web service endpoint should be specified on the Port Endpoints page.
The Asynchronous Methods page allows us to choose the asynchronous
methods to be added. Three options are there: Don't generate any
asynchronous methods, Generate asynchronous methods where specified
by the JAX-WS binding, or Generate asynchronous methods for all
operations.
The last page of the master informs about which service endpoint
interfaces and methods will be generated.
Once the Finish button has been pressed, the all required classes: data
type mappings, web service consumer stubs, a console client for
demonstration, and a callback web service are generated.
The callback web service can be started by the Run context menu item.
The client launching in the same way as the callback web service: using
the Run context menu item. The console window which contains the
result of the service invocation will be enabled after the launch.
The asynchronous web service works as designed along with the client.
The last action for the configuration is the definition of the input to output
messages transformation. The Transform Using action is taken into
account (please, have a look at the crosswise pictured button).
An existing, as well as a new mapper, file can be used.
Conclusions
Social
Google+
Popular Posts
Labels
My readers
828 Pageviews
Feb. 19th - Mar. 19th