Monday, 30 April 2012

How To Work with Domain Value Map




In the below Example I will create one DVM file using four Column CityCode, CityName, CityLocation and Country. Where Country and CityLocation Column will act as qualifier. Mediator will lookup value from .dvm file and write result to local file system.

Step1:- Create .DVM FILE using  Right click on project -> Select SOA-> Transformation-> Domain Value Map . Give some name to domain value map file and give some name to the domain fields then click OK.
Now in .DVM file click on add button -> select the option add domain. In this example I am adding one more domain with name CityLocation with Qualifier as true and hierarchical order as 1 and another domain with name Country with Qualifier as true and hierarchical order as 2 to show the hierarchy weightage.

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi51UGtJlswDqrx4B0N2CzhhJqyZ7_zedXMh8RCbr-rs2boXlOmdFZREDmMB9Rn3Jlsj9N2VBnUM7qhzbt92jPUkCbc8hoPYtIZ95WxsAipWmgGAEX5071DssA37ruDenyAcHyrpWoI8_Y/s320/Pic.png

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMBZHske9utFbOKmPPlxfjk7fEIzNkClZ6mRiajnMxCQPyVplVPGI1ZEaYLMGG-zVvLIeBYep1ER-nb8exCSSmbOVoVp0VJy7aYuKn_uU9q7VgxLo-u3qIRhFFgJYlyRWVJw7LmEFlXdM/s320/Pic.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrtjP7ZubWdzs6lpLV5fq-VXkBbRwrGP6wbY-LQyO4cOISdu19uA9Ye9zrIDB16jrWaCvOw-JOyJVkzi8mGOVZIUY8OgPGT3i6bfZRLiVskBBjR23YZwSzfMqTX_YOpKmIAGT4vKojMEE/s400/Pic.png

Step 2:- Now I am creating one Asynchronous Mediator in composite and exposing it as web Service and created one file Adapter which will be writing onto the local system. Wire the Mediator with write File adapter.

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyCTV4y7BucgMVBzuzt88PSQUbIS3NV-QUA42sWnJtEgu-gYDfkaol5AtYflKvDMIbg0nRCk0GpDWblsrCGxhGd0cUczN7b3E5_jB0kiH1TBPihpFn6hULN0DZW0x1JQYAk5cmXhFwZ7w/s400/Pic.png

Step 3:- Now open the mediator and click on the transformation icon and select the Advance Function in XSLT Mapper file in Component Palette. Then select the DVM Funtion->lookupValue1M.
Drag this function onto the line connecting field from source to target. Open the function and select the following below values in respective field. In the sourceValue  column  click and press the ctrl+Shift to get the field from XSD. In my case I have taken XSD as Employee. The XSD can be anyone.
Whatever value will come from field EmployeeName will go to Source Column CityCode in .dvm file.
Target column is selected as CityName will show the value of output means full name of City and default value is selected as “Not Known”. If the passed value while testing will not be present in the CityCode column then the default value “Not Known” will come as output.
Qualifier columns will pick values from the EmployeeDetail and EmployeeSummary field passed while testing in Employee XSD.

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCuTFKyBY4aK-GA6-kovYjEp7y2e4VtQWjoW8Kk19bc91EwDR6CdjBAC-lhn-KfgRdRfRVUD91DK2kfPKYqxnku6KRxZmRl12PEc88slINyctB8b-4EIUXTPywXf1_SdoeoTS30vG2FXM/s400/Pic.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgW7pRxzYuuuKRKr9fPYi2oMKOUKsMuEdc46GMlCdOmtnB5UcaLJWpBbn3Ze-J7Bxwbiv_wubDLrQkXQCAi6fbx-8wLSM-PkT04aNJUOIsvovxRhtJlGYx8wGbvrZcLDHfgqBfly8YHuYg/s400/Pic.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4kXGPiVq-ap5zfflpkip3DuvBXvQMFSeytZDUPaB0Pccpo-Cok4RhSFXGwTuXxzPSFizIKmfRGHQ3FG5yTvjyecy04h0KRK6Spvs_wDBDD4QPHRUNfpe58-VNBk0WM56SFDDAOdAQEqE/s400/Pic.png
Step 4:- After  Mapping deploy the function on Application server and test the function.

A qualifier order is used to find the best match during lookup at runtime. The order of a qualifier varies from highest to lowest depending on the role of the qualifier in defining a more exact match. In the CityLocation qualifier(1) have a higher order  than the Country qualifier(2), as a matching CityLocation indicates a more exact match.

Domain value maps support hierarchical lookup. If we specify a qualifier value during a lookup and no exact match is found, then the lookup mechanism tries to find a more generalized match by setting the higher order qualifiers to a "".

First Test case in the Usecase:-
Pass value BO in all four field. Now the result will come as Boston1 because it picks value where the CityLocation and Country Value Column has no value entered.

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjf6mIRL6PNdlq6_8H1VOLx9QXE_leZpT1TcZK30s7op01w1lpuvTgO5TKkhSg_p1YGzzbR1cU_zSUoGj8NnnwMmikeroms7YXUg6v3YTO0CCDpAZXqjCLmvyUsRIr3FAaKG4lb61ra014/s400/Pic.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBoO5HvluyzJUeF9M3LkjsCcBAE9oE0Lil8jaQVbWdOefvZeGXxU-gtT1iJTEprCwOfb58BoK4fvJPr4qUo-ruPkcTew4A-EGVRksTg85lR31WOcw_jJXj2abB-DkhpG2qx07cpR8Xdlg/s400/Pic.png
Second Test case in the Usecase:-
Pass value BO in all three field. Now the result will come as Boston1 because it picks value where the CityLocation is blank and Country is blank. It happens because CityLocation Column has hierarchy set 1 which is taking precedence over the Country Column. That’s why it did not pick value from the field where Country name is set as USA because in that case CityLocation is not set as BO.
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEido2kDeH6q6yPEFgSlXfD3ck1WIGnKf85aIU0bWH2_18ILp-PIO39OhkimkRifMxfQffdT-EOYjpwvRs13fytnUX_WK3qYmJHj6d3t9Ld0BcyxhObK8cjubq5tWqOahP1jsJbVOlIGMMY/s400/Pic.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1ur1tNlitk4GocN8IVvq10cD_HTkdMetA2CO9sGXTTMiNU3mMXzG7520Y0Gig4cgljsVmOKIEAXKxnFOfNMJY0tZc6GBOdTZjrDnbwV5RW_O_fWUQtvbDIti99VlHp05AAqcG8FK5OqA/s400/Pic.png
Third Test case in the Usecase:-
Pass value BO in all two field. Now the result will come as Boston because it picks value where the CityLocation is EastUSA and Country is USA.
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEir1SCKVP5e5yS65WeW127cIYRE_CESoQ4Z4Z2Bzknk_NFcci6NLnlsur7dVc_ZqKe3kaf8UjtsSCD2HGsAOo4-tQlneu3yIPGYE6YN8SrZ1Nbe1jSxqshsMLz7y8SQRDn7WgjRy8vD1Io/s400/Pic.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0-gNvriWbksUfnKf01SYkrqgXY86xvNDkTv6SqDLFvqFOD8VBlVBknBnPsNhYVuF_PEPH03JpV97VxR43CymC8XtT_6nv5u9AnO0uHMOVbhKfBwZnofTe9imBy95aR5REN-sGoZgeqCw/s400/Pic.png

Hope this Example would help in understating DVM concept.

Domain Value Map Features:-
(i)                  Qualifier Support:- Qualifiers qualify mappings. A mapping may not be valid unless qualified with additional information. For example, a domain value map containing city code to city name mapping may have multiple mappings from KN to Kensington as Kensington is a city in Canada as well as USA. Hence this mapping requires a qualifier (USA or Canada) to qualify when the mapping becomes valid . You can also specify multiple qualifiers for a domain value map. Qualifiers are used only to qualify the mappings. Therefore, the qualifier values can not be looked up.
(ii)                Qualifier Order Support:- A qualifier order is used to find the best match during lookup at run time. Domain value maps support hierarchical lookup. If you specify a qualifier value during a lookup and no exact match is found, then the lookup mechanism tries to find a more generalized match by setting the higher order qualifiers to "". It proceeds until a match is found, or until a match is not found with all qualifiers set to "".
(iii)               One-to-Many Mapping Support:- You can map one value to a multiple values in a domain value map. For example, a domain value map for Payment Terms can contain mapping of payment terms to three values such as discount percentage, discount period, and total payment period.

Difference between concrete and abstract WSDL



Abstract WSDL:- 
Used on server side,contains request,response and type of operation performed.An abstract WSDL document describes what the web service does, but not how it does it or how to contact it. An abstract WSDL document defines the operations provided by the web service. the input, output and fault messages used by each operation to communicate with the web service, and their format. Including Abstract WSDL is reusable because there is no binding details in it.Abstract WSDL contains only messages and operations.Abstract WSDL is used by web Server.

Concrete wsdl:-
Used on client side,contains abstract wsdl and transport used.A concrete WSDL document adds the information about how the web service communicates and where you can reach it. A concrete WSDL document contains the abstract WSDL definitions, and also defines the communication protocols and data encodings used by the web service.The port address that must be used to contact the web service.Concrete WSDL has all the things that the abstract wsdl has in addition it has transport(http,jms) details.Concrete WSDL contains messages, operations and binding/transport specific information i.e. SOAP over Http/HTTPS/JMS having wsdl style i.e. RPC/DOC literal.

Difference between XA and non XA datasource


An XA transaction is a "global transaction" that may span multiple resources. A non-XA transaction always involves just one resource.

An XA transaction involves a coordinating transaction manager, with one or more databases (or other resources, like JMS) all involved in a single global transaction. Non-XA transactions have no transaction coordinator, and a single resource is doing all its transaction work itself (this is sometimes called local transactions).
XA transactions come from the X/Open group specification on distributed, global transactions. JTA includes the X/Open XA spec, in modified form.
Example of non-XA - a Servlet or EJB or plain old JDBC in a Java application talking to a single database. XA gets involved when you want to work with multiple resources - 2 or more databases, a database and a JMS connection, all of those plus maybe a JCA resource - all in a single transaction. In this scenario, you'll have an app server like Websphere or Weblogic or JBoss acting as the Transaction Manager, and your various resources (Oracle, Sybase, IBM MQ JMS, SAP, whatever) acting as transaction resources. Your code can then update/delete/publish/whatever across the many resources. When you say "commit", the results are commited across all of the resources. When you say "rollback", _everything_ is rolled back across all resources.

The Transaction Manager coordinates all of this through a protocol called Two Phase Commit (2PC). This protocol also has to be supported by the individual resources.
In terms of datasources, an XA datasource is a data source that can participate in an XA global transaction. A non-XA datasource generally can't participate in a global transaction.

Binding Components in SOA 11g


Binding components establish the connection between a SOA composite application and the external world. There are two types of binding components:
Services:- Provide the outside world with an entry point to the SOA composite application. The WSDL file of the service advertises its capabilities to external applications. These capabilities are used for contacting the SOA composite application components. The binding connectivity of the service describes the protocols that can communicate with the service (for example, SOAP/HTTP or a JCA adapter).
References:-Enable messages to be sent from the SOA composite application to external services in the outside world.
Binding components enable you to integrate the following types of technologies with SOA composite applications:
(i)Web services:- This service enables you to integrate with a standards-based web service using SOAP over HTTP. Web services are described in the WSDL file. The Create Web Service dialog also enables you to configure support for WS-Coordination and WS-Atomic (WS-AT) transactions. WS-AT provides transaction interoperability between Oracle WebLogic Server and other vendors' transaction services  or external transaction processing systems, such as Websphere, JBoss, Microsoft .NET, and so on.
Property used to describe the WS-Atomic Transaction fields:-
Transaction Participation:-Select a value. If you added the web service to the Exposed Services swim lane, this action enables external transaction managers to coordinate resources hosted on Oracle WebLogic Server over WS-AT. If you added the web service to the External References swim lane, this enables Oracle WebLogic Server transactions to coordinate resources hosted in external environments over WS-AT.
(a)Never:- No transaction context is imported (for services) or exported (for references). This is the default value if you add the web service as a service binding component in the Exposed Services swim lane.
(b)Supports:-If a transaction exists, a transaction context is imported (for services) or exported (for references). This information is added to the composite.xml file.
(c)Mandatory:-A transaction context is imported (for services) or exported (for references). This information is added to the composite.xml file. For exports, a web service exception message is thrown if there is no active transaction. For imports, a fault is returned to the client if there is no transaction context in the request.
(d)WSDL Driven:-This property only displays if you add the web service as a reference binding component in the External References swim lane. This is the default value.
Version:- Displays the WS-AT supported version (1.0, 1,1, 1,2, or default). By default, this list is only enabled if you select Supports or Mandatory from the Transaction Participation list.
(ii)HTTP  binding:- The HTTP binding service enables you to integrate SOA composite applications with HTTP binding.
(iii)JCA adapters:- JCA adapters enable you to integrate services and references with the following technologies:
(a)     Databases:- The database adapter enables a BPEL process to communicate with Oracle databases or third-party databases through JDBC.
(b)     File systems:- The file adapter enables a BPEL process or Oracle Mediator to exchange (read and write) files on local file systems. The file contents can be in both XML and non-XML data formats.
(c)      FTP servers:- The FTP adapter enables a BPEL process or Oracle Mediator to exchange (read and write) files on remote file systems through use of the file transfer protocol (FTP). The file contents can be in both XML and non-XML data formats.
(d)     Message systems such as Advanced Queueing (AQ) and Java Messaging Systems (JMS):- The AQ adapter enables you to interact with a single consumer or multiconsumer  queue. Multiple queues can also service a single application, partitioning messages in a variety of ways and providing another level of scalability through load balancing. The JMS adapter enables an Oracle BPEL process or Oracle mediator to interact with a Java Messaging System (JMS). The JMS architecture uses one client interface to many messaging servers. The JMS model has two messaging domains, point-to-point and publish-subscribe. In the point-to-point domain, messages are exchanged through a queue and each message is delivered to only one receiver. In the publish-subscribe model, messages are sent to a topic and can be read by many subscribed clients.

(e)     IBM WebSphere MQ:- The MQ adapter provides message exchange capabilities between BPEL processes and Oracle Mediator and the WebSphere MQ queuing systems. Messaging and Queuing Series (MQ Series) is a set of products and standards developed by IBM. MQ Series provides a queuing infrastructure that provides guaranteed message delivery.


(f)      Oracle Applications Adapter:- The Oracle applications adapter provides connectivity to Oracle Applications. The adapter supports all modules of Oracle Applications in Release 12 and Release 11i.

(g)     TCP/IP sockets:- The socket adapter enables you to create a client or a server socket, and establish a connection. This adapter enables you to model standard or nonstandard protocols for communication over TCP/IP sockets.


(h)     Third-party adapters (SAP, PeopleSoft, and others):- The third party adapter enables you to integrate third-party adapters such as PeopleSoft, SAP, and others into a SOA composite application.

(iv) Oracle Business Activity Monitoring (BAM):- The Oracle BAM adapter enables you to integrate Java EE applications with Oracle BAM Server to send data.
(v) Oracle B2B:- The Oracle B2B service enables you to browse B2B metadata in the MDS repository and select document definitions.
(vi) ADF-BC services:- The ADF-BC service enables you to integrate Oracle Application Development Framework (ADF) applications using service data objects (SDOs) with SOA composite applications.
(vii) EJB services:- The EJB service enables Enterprise JavaBeans and SOA composite applications to interact by passing service data object (SDO) parameters (uses a WSDL file to define the interface) or Java interfaces (does not use a WSDL file to define the interface).
(viii) Direct binding services:- The direct binding service uses the Direct Binding Invocation API to invoke a SOA composite application in the inbound direction and exchange messages over a remote method invocation (RMI). You can also invoke an Oracle Service Bus (OSB) flow or another SOA composite application in the outbound direction.

Dehydration in SOA 11g


Oracle BPEL Process Manager uses the dehydration store database to maintain long-running asynchronous processes and their current state information in a database while they wait for asynchronous callbacks. Storing the process in a database preserves the process and prevents any loss of state or reliability if a system shuts down or a network problem occurs.If you have a large number of composite instances present for a single or multiple composites the Enterprise Manager will not be a very ideal place to look at if we want to know the states of these instances.
The table below shows the various State Value for composite instances in the CUBE_INSTANCE table of the SOA_INFRA schema in the dehydration store.It stores instance meta data information like creation date,last modified date, current state, process id etc. Following are processes state codes and their meaning
State
Code
Closed and Aborted
8
Closed and Cancelled
7
Closed and Completed
5
Closed and Faulted
6
Closed and (Pending or Cancel)
4
Closed and Stale
9
Initiated
0
Open and Faulted
3
Open and Running
1
Open and Suspended
2


Instance data occupies space in Oracle BPEL Process Manager schema tables. Data growth from auditing and dehydration can have a significant impact on database performance and throughput.

Oracle BPEL Process Manager Tables Impacted by Instance Data Growth:-
(i)audit_trail:-
Stores the audit trail for instances. The audit trail viewed in Oracle BPEL Control is created from an XML document. As an instance is processed, each activity writes events to the audit trail as XML.

(ii)audit_details:-Stores audit details that can be logged through the API. Activities such as an assign activity log the variables as audit details by default.Audit details are separated from the audit_trail table due to their large size. If the size of a detail is larger than the value specified for this property, it is placed in this table. Otherwise, it is placed in the audit_trail table.

(iii)cube_instance:-Stores process instance metadata (for example, the instance creation date, current state, title, and process identifier)

(iv)cube_scope:-Stores the scope data for an instance (for example, all variables declared in the BPEL flow and some internal objects that help route logic throughout the flow).

(v)dlv_message:-Stores incoming (invocation) and callback messages upon receipt. This table only stores the metadata for a message (for example, current state, process identifier, and receive date).

(vi)dlv_subscription:-Stores delivery subscriptions for an instance. Whenever an instance expects a message from a partner (for example, the receive or onMessage activity) a subscription is written out for that specific receive activity.

(vii)document_ci_ref:-Stores cube instance references to data stored in the xml_document table.

(viii)document_dlv_msg_ref:-Stores references to dlv_message documents stored in the xml_document table.

(ix)schema_md:-Stores metadata about columns defined in the Oracle BPEL Process Manager schema (orabpel).

(x)task:-Stores tasks created for an instance. The TaskManager process keeps its current state in this table.

(xi)work_item:-Stores activities created by an instance. All activities in a BPEL flow have a work_item table. This table includes the metadata for the activity (current state, label, and expiration date (used by wait activities)).

(xii)xml_document:-Stores all large objects in the system (for example, dlv_message documents). This table stores the data as binary large objects (BLOBs). Separating the document storage from the metadata enables the metadata to change frequently without being impacted by the size of the documents.

(xiii)Header_properties:-stores headers and properties information

Durable and Transient Processes:-There are two types of processes in Oracle BPEL Process Manager. These processes impact the dehydration store database in different ways.

(i)Transient processes:- this process type does not incur any intermediate dehydration points during process execution. If there are unhandled faults or there is system downtime during process execution, the instances of a transient process do not leave a trace in the system.  Transient processes are typically short-lived, request-response style processes. The synchronous process you design in Oracle JDeveloper is an example of a transient process.

(ii)Durable processes:- this process type incurs one or more dehydration points in the database during execution because of the following activities:
     *   Receive activity
     *   OnMessage branch in a pick activity
     *   OnAlarm branch in a pick activity
     *   Wait activity
Instances of durable processes can be saved in-flight (whether they complete normally or abnormally). These processes are typically long-living and initiated through a one-way invocation.

Properties that can effect the Dehydration Store:-
(i)idempotent BPEL Property:-Idempotent Activities:-An idempotent activity is an activity that can be retried (for example, an assign activity or an invoke activity).
Oracle BPEL Server saves the instance after a nonidempotent activity.A BPEL invoke activity is by default an idempotent activity, meaning that the BPEL process does not dehydrate instances immediately after invoke activities. Therefore, if idempotent is set to true and Oracle BPEL Server fails right after an invoke activity executes, Oracle BPEL Server performs the invoke again after restarting.
If idempotent is set to false, the invoke activity is dehydrated immediately after execution and recorded in the dehydration store. If Oracle BPEL Server then fails and is restarted, the invoke activity is not repeated, because Oracle BPEL Process Manager sees that the invoke already executed.
When idempotent is set to false, it provides better failover protection, but at the cost of some performance, since the BPEL process accesses the dehydration store much more frequently. This setting can be configured for each partner link property.Setting this parameter to true can significantly improve throughput. Some examples of where this property can be set to true are read-only services (for example, CreditRatingService) or local EJB/WSIF invocations that share the instance's transaction.
(ii)BPEL Properties Set Inside a Composite:-
ex:-
<property name="bpel.config.inMemoryOptimization">true</property>
<property name="bpel.config.completionPersistPolicy">faulted</property>

(a)inMemoryOptimization:-This property indicates to Oracle BPEL Server that this process is a transient process and dehydration of the instance is not required. When set to True, the completionPersistPolicy is used to determine persistence behavior. This property can only be set to True for transient processes or processes that do not contain any dehydration points such as receive, wait, onMessage and onAlarm activities. The inMemoryOptimization property is set at the BPEL component level.
Values:
This property has the following values:
False (default): instances are persisted completely and recorded in the dehydration store database.
True: The completionPersist policy is used to determine persistence behavior.

(b)completionPersistPolicy:-
This property configures how the instance data is saved. It can only be set at the BPEL component level. The completionPersistPolicy property can only be used when inMemoryOptimization is set to be True (transient processes). Note that this parameter may affect database growth and throughput (due to reduced I/O).
Value
(i)On (default):-The completed instance is saved normally
(ii)Deferred:-The completed instance is saved, but with a different thread and in another transaction.
(iii)Faulted:-Only the faulted instances are saved.
(iv)Off:-No instances of this process are saved.

xslt padding with characters call template for left pad and right pad

  Could a call-template be written that took two parameters ?   a string, and a   number) return the string with empty spaces appended t...