Thursday, 24 November 2011

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.

Wednesday, 23 November 2011

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.

Tuesday, 22 November 2011

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
StateCode
Closed and Aborted8
Closed and Cancelled7
Closed and Completed 5
Closed and Faulted 6
Closed and (Pending or Cancel)4
Closed and Stale9
Initiated 0
Open and Faulted3
Open and Running1
Open and Suspended2


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.









Thursday, 17 November 2011

SCA (Service Component Architecture)

Service Component Architecture (SCA):-
It's a set of specifications that defines an assembly model for composite services and also provides a programming model to build applications which are SOA-based.The composite service is having a well defined assembly of all the components involved in your application and ready to be deployed. You don't need to deploy the individual components separately. All will be handled by SCA. All the assembly information is stored in an SCA Descriptor.
SCA is part of OASIS (Organization for the Advancement of Structured Information Standards), a not-for-profit consortium that drives the development, convergence and adoption of open standards.

Service Component Architecture specifications:-
The set of specification can be split into four main elements: the assembly model specification, component implementation specifications, binding specifications, and the policy framework specification.
(i)Assembly model specification:-This model defines how to specify the structure of a composite application. It defines what services are assembled into a (Service Oriented Business Applications) SOBA and with which components these services are implemented. The assembly model is defined with XML files.
(ii)Component implementation specifications:- These specifications define how a component is actually written in a particular programming language ex:- Java , BPEL, C++ or C code.
(iii)Binding specifications:- these specifications define how the services and references using different transports type. Binding types can be configured for both external systems and internal wires between components. The SCA service binding type should only be used for communication between composites and components within an SCA domain.
(iv)Policy framework specification:-describing how to add non-functional requirements to services,such as security of service defination. Two kinds of policies exist: interaction and implementation policies. Interaction policies affect the contract between a service requestor and a service provider. Examples of such policies are message protection, authentication, and reliable messaging. Implementation policies affect the contract between a component and its container. Examples of such policies are authorization and transaction strategies.
Deployment and the Service Component Architecture:-
SCA composites are deployed within an SCA domain.

SCA vs SOA:-
SCA focuses on the assembly of various components to provide an easier design and deployment while SOA provides an architecture or style to design and develop the individual components.So, we create components with SOA and assemble them using SCA mainly to make the deployment easier.

SOAP (Simple Object Access Protocol)

SOAP is a simple XML-based protocol to let applications exchange information over HTTP.SOAP provides a way to communicate between applications running on different operating systems, with different technologies and programming languages.
RPC(Remote Procedure Calls) represents a compatibility and security problem; firewalls and proxy servers will normally block this kind of traffic.A better way to communicate between applications is over HTTP, because HTTP is supported by all Internet browsers and servers. SOAP was created to accomplish this.

What is SOAP:-SOAP is a communication protocol
SOAP is for communication between applications
SOAP is a format for sending messages
SOAP communicates via Internet
SOAP is platform independent
SOAP is language independent
SOAP is based on XML
SOAP is simple and extensible
SOAP allows you to get around firewalls

SOAP Building Blocks:-
A SOAP message is an ordinary XML document containing the following elements:
  • An Envelope element that identifies the XML document as a SOAP message
  • A Header element that contains header information
  • A Body element that contains call and response information
  • A Fault element containing errors and status information
All the elements above are declared in the default namespace for the SOAP envelope:
http://www.w3.org/2001/12/soap-envelope
and the default namespace for SOAP encoding and data types is:
http://www.w3.org/2001/12/soap-encoding

SOAP Envelope Element:-
The required SOAP Envelope element is the root element of a SOAP message.
Example
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
  ...
  Message information goes here
  ...
</soap:Envelope>

"http://www.w3.org/2001/12/soap-envelope%22.The namespace defines the Envelope as a SOAP Envelope.
If a different namespace is used, the application generates an error and discards the message.

SOAP Header Element:-
The optional SOAP Header element contains application-specific information (like authentication, payment, etc) about the SOAP message.If the Header element is present, it must be the first child element of the Envelope element.
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

<soap:Header>
  <m:Trans xmlns:m="http://www.w3schools.com/transaction/"
  soap:mustUnderstand="1">234
  </m:Trans>
</soap:Header>
...
...
</soap:Envelope>
SOAP defines three attributes in the default namespace ("http://www.w3.org/2001/12/soap-envelope"). These attributes are: mustUnderstand, actor, and encodingStyle.The attributes defined in the SOAP Header defines how a recipient should process the SOAP message.

(i)mustUnderstand Attribute:-
If you add mustUnderstand="1" to a child element of the Header element it indicates that the receiver processing the Header must recognize the element. If the receiver does not recognize the element it will fail when processing the Header.
Syntax
soap:mustUnderstand="0|1"

(ii)actor Attribute:-
The SOAP actor attribute is used to address the Header element to a specific endpoint.
Syntax
soap:actor="URI"
example:-
<soap:Header>
  <m:Trans xmlns:m="http://www.w3schools.com/transaction/"
  soap:actor="http://www.w3schools.com/appml/%22%3E234
  </m:Trans>
</soap:Header>

(iii)encodingStyle Attribute:-
The encodingStyle attribute is used to define the data types used in the document.This attribute may appear on any SOAP element, and it will apply to that element's contents and all child elements.
Syntax
soap:encodingStyle="URI"

SOAP Body Element:-
The required SOAP Body element contains the actual SOAP message.Immediate child elements of the SOAP Body element may be namespace-qualified.
Example
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Body>
  <m:GetPrice xmlns:m="http://www.w3schools.com/prices">
    <m:Item>Apples</m:Item>
  </m:GetPrice>
</soap:Body>
</soap:Envelope>
The example above requests the price of apples. Note that the m:GetPrice and the Item elements above are application-specific elements. They are not a part of the SOAP namespace.

SOAP Fault Element:-
The optional SOAP Fault element is used to indicate error messages.If a Fault element is present, it must appear as a child element of the Body element. A Fault element can only appear once in a SOAP message.
The SOAP Fault element has the following sub elements:
Sub Element Description
<faultcode> A code for identifying the fault
<faultstring> A human readable explanation of the fault
<faultactor> Information about who caused the fault to happen
<detail> Holds application specific error information related to the Body element

SOAP Fault Codes
The faultcode values defined below must be used in the faultcode element when describing faults:
Error Description
VersionMismatch:- Found an invalid namespace for the SOAP Envelope element
MustUnderstand:- An immediate child element of the Header element, with the mustUnderstand attribute set to "1", was not understood
Client:- The message was incorrectly formed or contained incorrect information
Server:- There was a problem with the server so the message could not proceed

SOAP HTTP Binding:-
HTTP communicates over TCP/IP. An HTTP client connects to an HTTP server using TCP.
A SOAP method is an HTTP request/response that complies with the SOAP encoding rules.
HTTP + XML = SOAP
A SOAP request could be an HTTP POST or an HTTP GET request.




WSDL (Web Services Description Language)

WSDL (Web Services Description Language) is an XML-based language for describing Web services and how to access them.
  • WSDL is used to describe Web services

  • WSDL is also used to specifies the location of the service and the operations (or methods) the service exposes.

  • WSDL is written in XML

  • WSDL is an XML document


  • The WSDL Document Structure:-
    It contains set of definitions to describe a web service.A WSDL document describes a web service using these major elements:
    <types>The data types used by the web service
    <message>The messages used by the web service
    <portType>The operations performed by the web service
    <binding>The communication protocols used by the web service
    A WSDL document can also contain other elements, like extension elements, and a service element that makes it possible to group together the definitions of several web services in one single WSDL document.

    WSDL Ports:-The <portType> element can be compared to a function library (or a module, or a class) in a traditional programming language.
    ex:-
    <portType name="EmployeeDetail">
      <operation name="getEmployeeDetail">
        <input message="getEmployeeIDRequest"/>
        <output message="getEmployeeDetailResponse"/>
      </operation>
    </portType>

    WSDL Messages:-The <message> element defines the data elements of an operation.
    ex:-
    <message name="getEmployeeIDRequest">
      <part name="ID" type="xs:integer"/>
    </message>

    <message name="getEmployeeDetailResponse">
      <part name="value" type="xs:string"/>
    </message>

    WSDL Types:-The <types> element defines the data types that are used by the web service.

    WSDL Bindings:-The <binding> element defines the message format and protocol details for each port.
    The binding element has two attributes - name and type.The name attribute (you can use any name you want) defines the name of the binding, and the type attribute points to the port for the binding.
    <binding type="glossaryTerms" name="b1">
       <soap:binding style="document"
       transport="http://schemas.xmlsoap.org/soap/http" />
       <operation>
         <soap:operation soapAction="http://example.com/getTerm"/>
         <input><soap:body use="literal"/></input>
         <output><soap:body use="literal"/></output>
      </operation>
    </binding>
    The operation element defines each operation that the port exposes.


     

    Wednesday, 16 November 2011

    WSIL(Web Services Inspection Language) Connection

    WSIL (Web Services Inspection Language) is designed around an XML based model for building aggregated references to the existing Web service descriptions, which are exposed using standard Web server technology.
    The WS-Inspection specification provides an XML format for inspection of a site for the available services and the guidelines for how inspection related information should be made available for use.The WS-Inspection specification provides mechanisms with which the existing repositories which store the descriptive information about Web services can be referenced and utilized so that the information contained in them need not be duplicated.

    WSIL is a complementary model to the UDDI (Universal Description Discovery and Integration) specification to service discovery.While UDDI implements service discovery using a centralized model of one or more repositories containing information on multiple business entities and the respective services, the WSIL approaches service discovery in a decentralized manner, where service description information can be distributed to any location using a simple extensible XML document format. The WSIL relies on the service description mechanisms for functionality without being in any concern with the business entity information.

    What is UDDI:-
    UDDI is a platform-independent framework for describing services, discovering businesses, and integrating business services by using the Internet.
    • UDDI stands for Universal Description, Discovery and Integration
    • UDDI is a directory for storing information about web services
    • UDDI is a directory of web service interfaces described by WSDL
    • UDDI communicates via SOAP
    • UDDI is built into the Microsoft .NET platform

    How can UDDI be used:-

    If the industry published an UDDI standard for flight rate checking and reservation, airlines could register their services into an UDDI directory. Travel agencies could then search the UDDI directory to find the airline's reservation interface. When the interface is found, the travel agency can communicate with the service immediately because it uses a well-defined reservation interface.

    How to Create WSIL connection using jDeveloper:-
    When you create an Application Server connection in jdeveloper, Only deployed composites are visible.
    How do you view the deployed web services?
    Jdeveloper has an inbuilt WSIL(Web Services Inspection Language) browser. WSIL is an XML document format which helps in discovery of web services in a standard fashion.
    To create a WSIL connection in jdevloper go to Resource Pallete and select the new-> New Connection -> WSIL
    In the connection Wizard, Give a connection name.Click Next
    In WSIL URL give the address usually is http://localhost:8001/inspection.wsil
    Note:- Port here is managed server port.
    Give user name and password.Click to Test Connection button. Sucees come then click on OK
    Now expand WSIL in resource palette, and you can view all the deployments on the WLS.You can also test web services from there, right click and Test Web Service.