Monday, 5 December 2011

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.

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.


    Monday, 17 October 2011

    Flow Activity Concept in BPEL process

    Flow Activity is only useful in case of Asynchronous call.
    A BPEL process service component must sometimes gather information from multiple asynchronous sources. Because each callback can take an undefined amount of time (hours or days), it may take too long to call each service one at a time. By breaking the calls into a parallel flow, a BPEL process service component can invoke multiple web services at the same time, and receive the responses as they come in. This method is much more time efficient.
    In case of Synchronous Call:- Oracle BPEL Process Manager executes in a single thread, executing the branches sequentially instead of in parallel
    Create two synchronous BPEL process suppose one is to do Addition of two numbers and second one is to do multiplication of two numbers and one asynchronous process to do the concatenation.Now Invoke these webservices in one BPEL process using Flow Activity and test it in the Enterprise manager and see the Flow trace model.In my case it executed multiplication then after excuted Addition then it will execute concatenation Asynchronous process.
    We need to set nonBlokingInvoke property set to true in partner link properties panel.
    To perform this operation right click on the partner link and select the edit,then go to proprties tab and click the add icon then select this property from the provided values in drop down.

    If this property is set then asynchronous partner link will not be blocked by synchronous partner links.
    If we will not set this property then all synchronous process will execute first then asynchronous process will be executed.
    Hope this would help.


    How to create User Defined Custom XPATH function to use in XSLT

    In this post we will see that how to create user defined function to use in XSLT Mapper.

    Step1:- Create Java class to write the User defined function. The below Java code will convert long value into decimal value.

    package com.geo.xpath;

    public class LongToNumericPrimitiveTypesExample {

    public static double LongToNumericPrimitiveTypes (Long input){
    Long lObj = new Long("input");
    double d = lObj.doubleValue();
    return d;

    }

    }

    Step 2:- Create ext-mapper-xpath-functions-config.xml file to contain the following value

    <soa-xpath-functions version="11.1.1"

    xmlns="http://xmlns.oracle.com/soa/config/xpath"

    xmlns:geo="http://www.oracle.com/XSL/Transform/java/com.geo.xpath.LongToNumericPrimitiveTypesExample">

    <function name="geo:LongToNumericPrimitiveTypes">

    <className>com.geo.xpath.LongToNumericPrimitiveTypesExample</className>

    <return type="number"/>

    <params>

    <param name="input" type="number"/>

    </params>

    <desc/>

    <detail>

    <![CDATA[This function convert long to decimal message.]]>

    </detail>

    </function>
    </soa-xpath-functions>

    In this XML basically Java class method is defined. Put this XML inside the META-INF folder in the same java class and create a JAR file of it.

    Step 3:- For creating JAR file from JDeveloper. Right Click on the Java project select New -> Deployment Profile(From option select JAR File) then name the jar file and click next. Accept the all default value and the click Finish. Now right click again on the same project and click on the deploy option and deploy that JAR Archive. It will create the JAR file on to location like JDeveloper\mywork\Application1\LongTodecimalConversion\deploy. Verify if in the created jar file META-INF folder contains the ext-mapper-xpath-functions-config.xml file.

    Step 4:- Now in JDeveloper select the Tools -> Preferences -> SOA and use the Add button to select the created jar. Now restart the JDeveloper. Created function will be available in user defined section of XSLT Mapper.



    Now this is available at design time. Test it using the test  functionality of XSLT Mapper.

    Step 5:- Now to make it available at run time put ext-mapper-xpath-functions-config.xml on the location <<SOAOracle_HOME>>\Oracle_SOA1\soa\modules\oracle.soa.ext_11.1.1\classes\META-INF and place the built jar file on the location <<SOAOracle_HOME>>\user_projects\domains\soa_domain\lib. Then restart the server. Now deploy the built project and test this user defined Custom XPATH function.

    Hope this will help.


     

    Sunday, 16 October 2011

    How to use While Activity in BPEL process

    I am going to illustrate one example of using while activity in BPEL process.
    In the example I created one Synchronous BPEL process with name ToTestBPELProcessWhileActivity.


    Then Add a new Variable while clicking on highlighted variable icon in below image.

    Name the Variable as Counter and select the type as Int by selecting radio button Type in Create Variable Dialogue.




    Now Drag one Assign Activity in BPEL process and assign value 3 to Counter variable(Intialize value of the Counter Variable)



    Then Drag one While activity below the assign activity and set the condition in General tab of While Activity as if loop should run till Counter variable have value greater then Zero.


    Inside the scope of While Activity. Drop one Transformation activity as provided in below image.


    Use the any activity to repeat it three times. Then Drop Assign activity below the transform activity in While Activity scope then use copy operation .It will decrement the loop counter variable as below


    Once Counter variable value will be less then zero then while loop will terminate. That's it.









    




    Monday, 10 October 2011

    Comparison between BPEL 1.1 and 2.0 Specification

    Messaging:- In BPEL 1.1 there is no defined behavior for a process that receives a message for a request-response operation and finishes without replying. In BPEL 2.0, such a scenario would have trigged a new BPEL standard fault called "missingReply" fault.
    New activity types:- repeatUntil, validate, forEach (parallel and sequential), rethrow, extensionActivity, compensateScope
    Renamed activities:- switch/case renamed to if/else, terminate renamed to exit
    Termination Handler:- added to scope activities to provide explicit behavior for termination
    Variable initialization
    portType attribute:- The attribute "portType" of messaging activities such as "receive," "invoke," "reply," "pick," and "onEvent" is no longer mandatory and can be omitted

    The XML element "compensationHandler" and the XML attribute "enableInstanceCompensation" in the top-level "process" element have been removed.Instance (process) level compensation handlers never had any mechanism for being invoked; therefore, because they could not be used instance level compensation handling is no longer supported.Replace XML attribute "variableAccessSerializable" with "isolated"

    The URI used to specify XPath 1.0 as the expression/query language of choice has been changed, so replace the attribute value "http://www.w3.org/TR/1999/REC-xpath-19991116" of the attributes "expressionLanguage" and "queryLanguage" with the attribute value "urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"
    Replace the XML attribute "variableAccessSerializable" with "isolated" .
    XSLT for variable transformations (New XPath extension function bpws:doXslTransform).
    Locally declared messageExchange (internal correlation of receive and reply activities) .
    XPath access to variable data (XPath variable syntax $variable[.part]/location).

    Sunday, 25 September 2011

    How to publish and subscribe using mediator

    This project illustrate the example of publishing and subscribing through mediator. where publish project will invoke the subscribed project and will do the entry in database.
    Step1:- Create a new Generic Application with any name
    Step 2:- Then create one SOA project with empty Composite for publishing the event.

    Step 3:- Drag mediator in component section of composite.xml and select the input customer.xsd
    Create one customer.xsd using following entry:-
    <schema xmlns="http://www.w3.org/2001/XMLSchema"
            targetNamespace="http://xmlns.oracle.com/ns/Customer"
            xmlns:cust="http://xmlns.oracle.com/ns/Customer"
            attributeFormDefault="qualified" elementFormDefault="qualified">

     <element name="Customer" type="cust:CustomerType"/>
     <complexType name="CustomerType">
        <sequence>
            <element name="customerId" type="string" />
            <element name="Name" type="string" />
            <element name="Age" type="integer" />
    <element name="Address" type="string" />
    <element name="State" type="string" />
    <element name="Country" type="string" />
    <element name="City" type="string" />
        </sequence>
    </complexType>
    </schema>
    Step 4:-  Create one event using the same customer.xsd. Click on the create event flash icon

    Step 5:- Click on the plus icon to select the customer.xsd


    Step 6:- Now right click on the mediator and click the Add Publish Events and then select the .edl file of the created event  in the Event Chooser box.

    Step 7:- Open mediator and click on the Transform icon and select the create new mapper radio button. Now  perform one to one mapping as shown below.
    Step 8:- Now Create a new SOA project  inside same application with empty composite selected.
    Step 9:- Drag n drop the mediator component and select  the subscribed to events template.Then click on the plus icon and select the same .edl  file inside the Event Chooser box.
    Here we can notice Run as publisher whether to set it "no" or "yes". If we will set it as yes then all the security policies which are there in the publisher will be applicale to subscriber service as well.

    Step 10:- Open mediator and click on the Transform icon and select the create new mapper radio button. Now  perform one to one mapping as shown below.
     
    Step 11:- Then drag one BPEL process and choose the template as one way and select the input as customer.xsd.
    Step 12:- Then drag one database adapter in Reference section of composite.xml

    Step 13:- Enter the JNDI name as same created in my previous blog
    Step 14:- select the operation insert as shown below then in next page click on the “Import Table” and then in the Query section dialogue search for the Customer table and Select it.


    Step 15:- Then select one primary key as while creating table I didn’t define any primary key so this step will come for the tables where no primary key is defined.
    Step 16:- Now drag the wire from mediator to bpel and from BPEL to Database Adapter.
    Step 17:- Now open the Mediator Component and drag the transform and then invoke activity.
    Step  18:- From invoke activity drag a wire for database adapter to define the partner link. Inside the partner link dialogue Click on the plus icon to create one input variable and select the default value and click ok.
    
    Step 19:- Open the transformation activity and in the source section click the Plus icon and select the input variable and then in the target variable section select the input variable as of invoke activity. Then click on the plus icon in the Mapper File section to create one new xslt file.

    Step 20:- Inside xslt file map the sections as below.
    Step 21:- After deployment of both the Project. Now select the published one project and click on the test button. Fill all the mandatory field and click on the test web service button below.Now in the response section click on the Launch Flow Trace link and see the flow.
    Then After testing the service check whether the data is updated in database table.