Sitemap

Sunday, December 29, 2019

Concepts: Serverless and AWS Lambda

Serverless computing (or serverless for short), is an execution model where the cloud provider (AWS, Azure, or Google Cloud) is responsible for executing a piece of code by dynamically allocating the resources. You will only get charged for the time that your function executes. The code is typically run inside stateless containers that can be triggered by a variety of events including HTTP requests, database events, queuing services, monitoring alerts, file uploads, scheduled events (Cron jobs), etc. The code that is sent to the cloud provider for execution is usually in the form of a function. Hence serverless is sometimes referred to as “Functions as a Service” or “FaaS”.

Principles of Serverless
1. Use a compute service to execute code  on demand
2. Write single-purpose stateless functions
3. Design push-based, event-driven pipelines
4. Create thicker, more powerful front ends
5. Embrace third-party services

Tenets of Serverless
  • You bring the code, provider brings the infrastructure
  • Scale seamlessly with demand
  • Pay as you go, but never pay for idle time

Serverless Patterns
  • Compute as Back End
  • Compute as Glue
  • Command pattern
  • Messaging pattern
  • Priority queue pattern
  • Fan-out pattern
  • Pipes and filters pattern

Serverless Components
  • Lambda: Functions as a Service (compute)
  • API Gateway: HTTP endpoints as a Service (connectivity)
  • DynamoDB: Managed NoSQL (storage)
  • S3: Managed object store (storage)
  • Cognito: User management & authentication (security)
  • Certificate Manager: free, automatic SSL certs (security)

Use Cases of Lambda
  • ETL jobs
  • APIs (with API Gateway)
  • Mobile backends
  • Infrastructure automation
  • Data validation
  • Security remediation

Under the hood, when you are using Lambda, you are using containers that are running on EC2 instances, which are not accessible by you in terms of administration and management. They download your code from Lambda and run it inside of an isolated container. So it looks to you like you have an isolated machine even though there may be many lambDa functions executing at the same time on that machine. These containers enforce resource isolations so you are only allowed to use the amount of RAM that you have configured and they enforce 100ms execution limit for the purpose of billing and also for timeouts. At the end of the timeout, the container will be killed regardless of the state of your process.

Your application is composed of
  • the code that you provide and any dependencies of your code such as external libraries.
  • the event that comes in from the external service
  • the output is what your function sends back whether it sends to an external service or returns it as the output of the function

Event sources
  • Schedules: similar to a cronjob
  • S3 events: which hands the information about a new/deleted/changed file into Lambda
  • DynamoDB streams:  when a change is made in DynamoDB
  • Kinesis streams
  • SNS topics: simple notification service, messages that come in from webhooks or any other sources
  • API Gateway: mapping between HTTP request that might be coming in and events being sent to your Lambda functions
  • AppSync
  • CloudTrail logs
  • EC2 Lifecycle events
  • SDK invocation: language SDKs for different languages like Perl, PHP, JS, Python; from any of these, you can invoke your Lambda function and just let it run async or wait around for the result

Thursday, September 13, 2018

Salesforce: Links at my click!

External IDs
http://www.salesforcefinessed.com/2017/10/why-should-you-care-about-external-ids.html

aura:method
https://quirkyapex.com/2018/03/18/lightning-component-methods/

Data Loader with Command Line
https://kloudrac.com/blog/data-loader-with-command-line/

Platform Events
http://www.mstsolutions.com/blog/content/platform-events
https://andyinthecloud.com/2017/11/12/platform-events-and-lightning-components/
https://trailhead.salesforce.com/projects/workshop-platform-events

Apex Code Coverage hack
https://pavelslepenkovdotinfo.wordpress.com/2013/07/27/apex-code-coverage-hack/

Elements of a Salesforce Workflow Rule
https://cloudcraze.com/the-elements-of-a-salesforce-workflow-rule-workflow-deep-dive-pt-i/
https://cloudcraze.com/real-world-examples-of-salesforce-workflow-rules-workflow-deep-dive-pt-ii/

Truthy and Falsy Values in JavaScript
http://adripofjavascript.com/blog/drips/truthy-and-falsy-values-in-javascript.html

CSS Selectors
https://learn.shayhowe.com/advanced-html-css/complex-selectors/

Javascript: Pagination
https://gist.github.com/kottenator/9d936eb3e4e3c3e02598

Events: Bubbling and capturing
https://javascript.info/bubbling-and-capturing

Triggers and order of execution
https://albasfdc.wordpress.com/2016/12/19/triggers-and-order-of-execution/

Salesforce Apex: Maps
http://www.iterativelogic.com/working-with-apex-code-maps/

Apex: Sorting Wrapper list based on multiple conditions
https://salesforce.stackexchange.com/questions/192818/sort-wrapper-list-in-apex-based-on-levels
http://blog.deadlypenguin.com/blog/2015/10/10/comparable-sorting-objects-in-salesforce/

lightning:container
https://developer.salesforce.com/blogs/2018/04/lightning-container-component-building-components-with-react-angular-and-other-libraries.html

Lightning Service Components
https://developer.salesforce.com/blogs/2018/08/implement-and-use-lightning-service-components.html

Communication: Lightning Components and Visualforce Pages
https://developer.salesforce.com/blogs/developer-relations/2017/01/lightning-visualforce-communication.html



SOQL Builder: apex-commons
http://apex-commons.github.io/query/soql-builder/
https://github.com/apex-commons/SoqlBuilder

Salesforce Security Token and Password Policies
http://webkul.com/blog/salesforce-security-token/
http://www.infallibletechie.com/2012/12/password-policies-are-user-security.html

Which Automation Tool Do I Use?
https://help.salesforce.com/articleView?id=process_which_tool.htm

Modifying Components Outside the Framework Lifecycle
http://www.jitendrazaa.com/blog/salesforce/calling-apex-method-at-regular-interval-from-lightning-component/

How to write SOQL to traverse across two objects and their junction object
http://kingkoo-salesforce.blogspot.in/2012/12/how-to-write-soql-to-traverse-across.html

Best practices for writing code that doesn’t exceed certain governor limits.
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_limits_tips.htm
https://developer.salesforce.com/page/Apex_Code_Best_Practices
https://help.salesforce.com/articleView?id=000232681&language=en_US&type=1

Pop, Push, Shift and Unshift Array Methods in JavaScript
https://alligator.io/js/push-pop-shift-unshift-array-methods/

JS events: target vs currentTarget
https://javascript.info/bubbling-and-capturing

Prototypes in JavaScript
https://hackernoon.com/prototypes-in-javascript-5bba2990e04b

How to Select All Fields with SOQL in Apex
https://douglascayers.com/2015/10/08/salesforce-how-to-select-all-fields-with-soql-in-apex/

Salesforce: Setting Up Your Java Developer Environment
Link: https://resources.docs.salesforce.com/210/latest/en-us/sfdc/pdf/salesforce_developer_environment_tipsheet.pdf




Downloadable Salesforce User Guides
Set Up and Maintain Your Salesforce Organization
https://resources.docs.salesforce.com/212/latest/en-us/sfdc/pdf/setup.pdf

Sales Cloud Basics
https://resources.docs.salesforce.com/214/latest/en-us/sfdc/pdf/sales_core.pdf

Enhance Salesforce with Point and Click Tools
https://resources.docs.salesforce.com/214/latest/en-us/sfdc/pdf/extend_click.pdf

Enhance Salesforce with Code
https://resources.docs.salesforce.com/214/latest/en-us/sfdc/pdf/extend_code.pdf

List of important StackExchange links

How can I efficiently generate a Set<Id> from a List<SObject>
https://salesforce.stackexchange.com/questions/8910/how-can-i-efficiently-generate-a-setid-from-a-listsobject-structure

Why are foreach loops slower in Apex than standard for loop?
https://salesforce.stackexchange.com/questions/227272/why-are-foreach-loops-slower-in-apex-than-standard-for-loop


Monday, April 2, 2018

Machine learning crash course from Google

https://ai.google/education#?modal_active=none
https://developers.google.com/machine-learning/crash-course/

Wednesday, May 24, 2017

AEM: SegmentNotFoundException Segment not found

A SegmentNotFoundException in the error log means a segment is not present any more although we are still trying to access it.

To resolve this, please follow the below steps:

Download oak-run jar file from here http://repo1.maven.org/maven2/org/apache/jackrabbit/oak-run/
* AEM6.0 - If using Oak 1.0.12 or later then use Oak 1.1.8 - oak-run-1.1.8.jar. If the Oak version is 1.0.11 or earlier then use oak-run 1.1.6.
Note: We are using a 1.1.x branch version of oak-run because 1.0.x branch doesn't have the "check" command implemented.

1) Stop AEM

2) Run this command:
java -jar oak-run-*.jar check -d1 --bin=-1 -p crx-quickstart/repository/segmentstore/
It which will search backwards through the revisions until it finds a consistent one, Example:
14:00:30.783 [main] INFO o.a.j.o.p.s.f.t.ConsistencyChecker - Found latest good revision afdb922d-ba53-4a1b-aa1b-1cb044b535cf:234880

3)Revert the repository to this revision by editing ./crx-quickstart/repository/segmentstore/journal.log. Delete all lines after the line containing the latest good revision.
If you would like to find out what date and time you are reverting the repository to then run this command in the segmentstore folder (replace afdb922d-ba53-4a1b-aa1b-1cb044b535cf with the latest good revision in your journal.log):
find . -type f -name "data*.tar" -exec sh -c "tar -tvf {} |grep afdb922d-ba53-4a1b-aa1b-1cb044b535cf" \; -print
The output would show you an approximate date and time of that revision.

4)Remove all ./crx-quickstart/repository/segmentstore/*.bak files.

5)If using AEM6.0 then download the oak-run version matching what is installed in AEM for the remaining steps. Download it from here http://repo1.maven.org/maven2/org/apache/jackrabbit/oak-run/

6)Run checkpoint clean-up to remove orphaned checkpoints:
java -jar oak-run-*.jar checkpoints ./crx-quickstart/repository/segmentstore rm-unreferenced

7)Finally compact the repository:
java -jar oak-run-*.jar compact ./crx-quickstart/repository/segmentstore/


After the Above steps are completed, your system should now boot up properly.

Tuesday, January 24, 2017

Utility for taking backup of AEM contents

This utility is in the form of a unix shell script. The script will take the backup of AEM contents present in production author instance, create a zip file of it, download it and keep it in a particular location as defined in the script. Once the process is completed, an email will be sent to users to let them know the status of the job, whether the process was a success or resulted in an error. To automate this entire process, a cronjob can be set up which needs to be scheduled.

The technical document and the script are attached in a zip file. Check the downloads section for the zip file.

Friday, August 5, 2016

UCM: GET_SEARCH_RESULTS iterating resultset

package com.company;

import oracle.stellent.ridc.IdcClient;
import oracle.stellent.ridc.IdcClientException;
import oracle.stellent.ridc.IdcClientManager;
import oracle.stellent.ridc.IdcContext;
import oracle.stellent.ridc.model.DataBinder;
import oracle.stellent.ridc.model.DataObject;
import oracle.stellent.ridc.model.DataResultSet;
import oracle.stellent.ridc.protocol.ServiceResponse;

import java.util.List;

/**
 * Created by Sonal_Chaudhary on 8/4/2016.
 */
public class ExtractEmailIDs {
    public static void main(String[] args) {
        int startIndex = 1;
        int pageNumber = 1;
        int totalRows = 20;
        IdcClientManager manager = new IdcClientManager();
        try {
            IdcClient idcClient = manager.createClient("idc://143.127.54.171:4444");
            IdcContext userContext = new IdcContext("sysadmin");

            boolean stillLoop = true;
            while (stillLoop) {
                DataBinder dataBinder = idcClient.createBinder();
                dataBinder.putLocal("IdcService", "GET_SEARCH_RESULTS");
                dataBinder.putLocal("QueryText", "dSecurityGroup <contains> `Partner`  <AND>  xLanguage <contains> `4`  <AND>  xCountries <contains> `1`");
                dataBinder.putLocal("SearchQueryFormat", "Universal");
                dataBinder.putLocal("StartRow", Integer.toString(startIndex));
                dataBinder.putLocal("ResultCount",  Integer.toString(totalRows));
                dataBinder.putLocal("PageNumber",  Integer.toString(pageNumber));
                dataBinder.putLocal("TotalRows",  Integer.toString(totalRows));

                ServiceResponse response = idcClient.sendRequest(userContext, dataBinder);
                DataBinder responseData = response.getResponseAsBinder();
                DataResultSet resultSet = responseData.getResultSet("SearchResults");

                if (resultSet != null && resultSet.getRows() != null) {
                    List<DataObject> dataObjects = resultSet.getRows();
                    if (dataObjects.size() == totalRows) {
                        startIndex += totalRows;
                        pageNumber++;
                    } else {
                        stillLoop = false;
                    }
                    for (DataObject dataObject : dataObjects) {
                        System.out.println(dataObject.get("dID") + "," + dataObject.get("dDocName") + "," + dataObject.get("dExtension"));
                    }
                }
            }
        } catch (IdcClientException ice) {
            ice.printStackTrace();
        }
    }
}

Saturday, July 16, 2016

Java: Arrays

package com.company;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

/**
 * Created by Sonal_Chaudhary on 7/16/2016.
 */
public class TestScoreAverage {
    public static void main(String[] args) {
        final int NUMBER_OF_STUDENTS = 3;

        /**
         * The first statement declares a variable called numbers of the array type, with each element of type int. The
         * second statement allocates contiguous memory for holding 10 integers and assigns the memory address of the first
         * element to the variable numbers. The declaration and allocation can be done in the same statement like below:
         * int[] marks = new int[NUMBER_OF_STUDENTS];
         * Array literals provide a shorter and more readable syntax while initializing an array like below:
         * int[] marks = {15, 2, 9, 200, 18};
         */
        int[] marks;
        marks = new int[NUMBER_OF_STUDENTS];

        try {
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));


            for (int i = 0; i < NUMBER_OF_STUDENTS; i++) {
                System.out.print("Enter marks for student #" + (i + 1) + ": ");
                String str = reader.readLine();
                marks[i] = Integer.parseInt(str);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        //The clone method copies all the elements of the array into a new array
        int[] marksCopy = marks.clone();

        int total = 0;

        /**
         * The for-each construct is very useful if you want to traverse all the elements of the array. Specifically,
         * it allows you to iterate over collections and arrays without using iterators or index variables. The for-each
         * has certain restrictions. It can be used for accessing the array elements but not for modifying them.
         * The 'm' specifies the type of variable and its name.
         * for (int m : marks) {
         *      System.out.println (m);
         * }
         */
        for (int m : marksCopy) {
            total += m;
        }

        System.out.println("Average Marks " + (float) total / NUMBER_OF_STUDENTS);
        System.out.println(Arrays.toString(marksCopy)); //To print the contents of an array
    }
}


Wednesday, May 11, 2016

AEM Sightly

Templates
http://adobeaemclub.com/guide-for-working-with-templates-and-call-in-sightly-aem-6-1/

data-sly-repeat / data-sly-list / sly / URL manipulation
http://www.accunitysoft.com/tag/data-sly-repeat/

Wednesday, April 20, 2016

UCM: Important Doc IDs

Doc ID 1558212.1: Remote Intradoc Client (RIDC) Master Note for Sample Code

Doc ID 1603523.1: How to Setup and Test Webcenter Content 11g IPM AXF Managed Attachments

Doc ID 1606687.1: How to Setup EBS 12.1.x / 12.2.x Forms with Webcenter Content 11g AXF Managed Attachments

Doc ID 1636056.1: How Do You Search for Content Where The Title Contains an Ampersand (&) Character?

Doc ID 1902002.1: Master Note : How to Use Profiles and Rules to Achieve Custom Requirements on Webcenter Content Server

Doc ID 1927793.1: How to Setup EBS 12.1.3 / 12.2.x OAF with Webcenter Content 11g AXF Managed Attachments






Listing tables where a column is being used


SELECT * FROM ALL_TAB_COLUMNS WHERE COLUMN_NAME LIKE '%DDOCNAME%';

Monday, April 4, 2016

Get Portable 8 Java

http://www.davismol.net/2014/08/31/installing-the-jdk-on-a-windows-machine-without-administrator-privileges/

Sunday, February 14, 2016

Excel: Difference of data in 2 columns


G A G
H D H
E E
B C
X B X
Y Y
Z Z

=IF(ISERROR(VLOOKUP(A1,B:B,1,FALSE)),A1,"")

Monday, January 18, 2016

Java: WSDL to JAR

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <groupId>weatherForecast</groupId>
   <artifactId>sample-ws-client</artifactId>
   <version>0.0.1-SNAPSHOT</version>
   <name>WeatherForecast Service</name>
   <packaging>jar</packaging>
   <properties>
      <cxf.version>3.0.4</cxf.version>
   </properties>
   <build>
      <!-- maven compiler plug-ins -->
      <plugins>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.2</version>
            <configuration>
               <source>1.7</source>
               <target>1.7</target>
            </configuration>
         </plugin>
         <!-- maven wsdl2java plug-ins -->
         <plugin>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-codegen-plugin</artifactId>
            <version>${cxf.version}</version>
            <executions>
               <execution>
                  <id>generate-sources</id>
                  <phase>generate-sources</phase>
                  <configuration>
                     <sourceRoot>${project.build.directory}/generated/cxf</sourceRoot>
                     <wsdlOptions>
                        <wsdlOption>
                           <wsdl>http://www.webservicex.net/WeatherForecast.asmx?WSDL</wsdl>
                        </wsdlOption>
                     </wsdlOptions>
                  </configuration>
                  <goals>
                     <goal>wsdl2java</goal>
                  </goals>
               </execution>
            </executions>
         </plugin>
      </plugins>
   </build>
   <dependencies>
      <dependency>
         <groupId>org.apache.cxf</groupId>
         <artifactId>cxf-rt-frontend-jaxws</artifactId>
         <version>${cxf.version}</version>
      </dependency>
      <dependency>
         <groupId>org.apache.cxf</groupId>
         <artifactId>cxf-rt-transports-http</artifactId>
         <version>${cxf.version}</version>
      </dependency>
      <dependency>
         <groupId>junit</groupId>
         <artifactId>junit</artifactId>
         <version>4.12</version>
      </dependency>
   </dependencies>
</project>


mvn package

Thursday, October 29, 2015

SOAPUI issue when configured with certificates

Comment the following line in <soapUI installation location>/jre/lib/security/java.security File

jdk.certpath.disabledAlgorithms=MD2, RSA keySize < 1024

Monday, October 26, 2015

UCM: GET_SEARCH_RESULTS using RIDC

import java.io.IOException;

import oracle.stellent.ridc.IdcClient;
import oracle.stellent.ridc.IdcClientException;
import oracle.stellent.ridc.IdcClientManager;
import oracle.stellent.ridc.IdcContext;
import oracle.stellent.ridc.model.DataBinder;
import oracle.stellent.ridc.model.DataObject;
import oracle.stellent.ridc.model.DataResultSet;
import oracle.stellent.ridc.model.serialize.HdaBinderSerializer;
import oracle.stellent.ridc.protocol.ServiceResponse;

public class TestRIDCSearch {
    public static void main(String[] args) {
        IdcClientManager manager = new IdcClientManager();
        try {
            IdcClient idcClient = manager.createClient("idc://localhost:4444");
            IdcContext userContext = new IdcContext("sysadmin");
            HdaBinderSerializer serializer = new HdaBinderSerializer("UTF-8", idcClient.getDataFactory());

            DataBinder dataBinder = idcClient.createBinder();
            dataBinder.putLocal("IdcService", "GET_SEARCH_RESULTS");
            
            /*The easiest way to figure out the QueryText expected by the content server is to execute the query using the content server search screen 
            in the native UI and trace that call. Gather full verbose, system audit trace using the following trace sections:
            system, requestaudit, searchquery, searchcache
            This should be the following output:
            >searchquery/6 03.25 14:24:41.285 IdcServer-826 preparedQueryText: ( dDocName `test` dSecurityGroup `Public` dInDate >= `3/25/15 12:00 AM` )*/
            
            /*NOTE: UCM limits the ResultCount value according to the MaxResults configuration setting for Content Server. 
             * To increase the MaxResults setting, add the setting MaxResults=<integer> in config.cfg*/
            
            dataBinder.putLocal("QueryText", "dDocName `test` dSecurityGroup `Public` dInDate >= `3/25/15 12:00 AM`");
            serializer.serializeBinder(System.out, dataBinder);
            ServiceResponse response = idcClient.sendRequest(userContext, dataBinder);

            DataBinder responseData = response.getResponseAsBinder();
            serializer.serializeBinder(System.out, responseData);
            DataResultSet resultSet = responseData.getResultSet("SearchResults");

            for (DataObject dataObject : resultSet.getRows()) {
                System.out.println("Title is: " + dataObject.get("dDocTitle"));
            }
        } catch (IdcClientException ice) {
            ice.printStackTrace();
        } catch (IOException ioe) {
            ioe.printStackTrace();
        }
    }
}


Installation of multiple versions of JDeveloper

Navigate to <Installation_Folder>\jdeveloper\jdev\bin\jdev.boot file.

Locate the ide.user.dir property and change it to something like this:
ide.user.dir= C:/JDev11117SOADefaultDomain

Friday, October 9, 2015

Prerequisites before SOA Development

Creation of JMS Queue
Queue: Defines a point-to-point destination type, which are used for asynchronous peer communications. A message delivered to a queue is distributed to only one consumer.

Click SOAJMSModule.


In the Summary of Resources table, click New. Select the resource type: Queue and click Next.

Enter name: demoFulfillmentQueue and JNDI name: jms/demoFulfillmentQueue

Select Subdeployment SOASubDeployment. Select JMS Server SOAJMSServer

Creation of Connection Factory
Connection Factory: Defines a set of connection configuration parameters that are used to create connections for JMS clients.

Select the resource type: Connection Factory and click Next
Enter name: demoCF and JNDI name: jms/demoCF.

You should see both the queue and the connection factory listed in the Summary of Resources as shown here.

Now add the connection pool. The connection pool is configured in the JMSAdapter application and uses a Deployment Plan. First, create a directory to contain that plan.

Create a directory JMSPlan: C:\Oracle\Oracle_SOA1\soa\JMSPlan

Click Deployments. Click JMS Adapter. Click the Configuration tab and then the Outbound Connection Pools tab.

Click New. Select the factory oracle.tip.adapter.jms.IJmsConnectionFactory. Click Next. Enter eis/Queue/demo.

Click on eis/Queue/demo. Change the property ConnectionFactoryLocation to value jms/demoCF. Now update the JMSAdapter adapter.

=====================================================================

Create a data source with name as soademoDatabase, and JNDI Name as jdbc/soademoDatabase

Create a directory DBPlan: C:\Oracle\Oracle_SOA1\soa\DBPlan

Click Deployments. Click DbAdapter. Click the Configuration tab and then the Outbound Connection Pools tab.

Enter the JNDI Name as follows: eis/DB/soademoDatabase

Edit the connection pool to reference the data source. You have created a connection pool.

Monday, September 21, 2015

SOA Glossary

Service Component Architecture (SCA)
Service Component Architecture (SCA) is a set of specifications that describe a model for building applications using a service-oriented architecture.
1. Services are assembled together to form a composite application that creates a solution that addresses a specific business requirement.
2. Composite applications may contain new services (specifically for the application) and business functions from existing systems and applications (reused in the composite application).


SOA Composite
A SOA composite is an assembly of services, service components, and references designed and deployed together in a single application. Wiring between the service, service component, and reference enables message communication.
  1. Services provide the outside world with an entry point to the SOA composite application. The service advertises its capabilities (also known as operations) to external applications with a WSDL (Web Services Description Language) file. The binding of the service describes the protocols that can communicate with the application. Examples include SOAP/HTTP or a JCA adapter.
  2. Service components are the building blocks of a SOA composite application. Oracle SOA Suite 11g includes the following components:
    - The BPEL Process component enables design and execution of a business process that integrates a series of business activities and services into an end-to-end process flow.
    - The Business Rules component provides the means of making business decisions based on defined rules.
    - The Human Task component allows you to model a workflow that describes tasks for users or groups to perform as part of an end-to-end business process flow.
    - The Mediator component is used for validation, filtering, transformation, and routing of message data between components.
  3. References enable messages to be sent from the SOA composite application to external services in the outside world.

Service Data Object (SDO)

An SDO exposes any data source as a service, which enables retrieval and manipulation of the data in an XML format through service operations. The task of connecting applications to data sources is performed by a data mediator service.
Oracle SOA Suite 11g enables a BPEL Process to access an SDO through an Entity Variable, a special type of BPEL variable associated with a SDO as a service. Oracle ADF-BC components can be deployed simultaneously as Web Service and an SDO.


WSIL (Web Services Inspection Language) Connection
The http://localhost:8001/inspection.wsil URL accesses a Java EE application that dynamically discovers WSDL URL endpoints for Java EE and SOA composite applications deployed to the same run-time server.


Adapters
Adapters provide a service interface that:
• Exposes external application functionality in a form that can be used by SOA composite application components
• Converts request and responses into a form suitable for other (external) systems
• Implements interfaces by using the Java Connector Architecture (JCA) API standards


Oracle Web Service Manager Policy Manager Policy Manager

Oracle WSM  Policy Manager provides the infrastructure for enforcing global security and auditing policies in the service infrastructure. By securing various endpoints and setting and propagating identity, it secures applications. Oracle WSM Policy Manager provides a standard mechanism for signing messages, performing encryption, performing authentication, and providing role-based access control.


The Oracle Metadata Repository

The Oracle SOA Suite 11g runtime environment requires MDS to maintain SOA application configuration and runtime information. It is used to manage deployed services and composite applications.
The MDS can also be used as a central location for storing and referencing shared service artifacts, such as business events, rule sets for Oracle Business Rules, XSLT files for Oracle Mediator, XSD and WSDL documents for Oracle BPEL Process Manager, and other service documents, which can be deployed in a sharable archive format known as the Metadata archive (.mar files).


Business Events and the Event Delivery Network

A business event is a way for one application to notify another application of a significant occurrence to the business. When a business event is published, another application (or service component) can subscribe to it and initiate whatever processing is implied by that event. For example, when product stock levels are updated in an inventory database, an event can serve as a trigger or signal for another process to fulfill orders that have been on hold until products become available.
Business events are typically an asynchronous fire-and-forget (one-way) notification of a business occurrence.
Events are defined by using Event Definition Language (EDL) to specify the name and structure of an event. Definitions for business events are stored in the MDS, and published in the Event Delivery Network (EDN).
The Event Delivery Network is designed to handle asynchronous messaging arising from a business or system event. The EDN is not messaging infrastructure. It provides an application with a declarative publish-subscribe implementation to publish events so that a composite application with a Mediator component can subscribe to events that trigger execution of the composite application.

Wednesday, September 16, 2015

SOAP-based web service in Java

TimeServer.java
package com.sonal;

import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;

/**
 * SEI for a web service that returns the current time as either a string or as
 * the elapsed milliseconds from the Unix epoch, midnight January 1, 1970 GMT.
 * 
 * The annotation @WebService signals that this is the SEI (Service Endpoint
 * Interface). @WebMethod signals that each method is a service operation.
 *
 * The @SOAPBinding annotation impacts the under-the-hood construction of the
 * service contract, the WSDL (Web Services Definition Language) document.
 */
@WebService
@SOAPBinding(style = Style.DOCUMENT)
public interface TimeServer {
 @WebMethod
 String getTimeAsString();

 @WebMethod
 long getTimeAsElapsed();
}


TimeServerImpl.java
package com.sonal;

import java.util.Date;
import javax.jws.WebService;

/**
 * The @WebService property endpointInterface links this SIB (Service
 * Implementation Bean) to the SEI (com.sonal.TimeServer). Note that the method
 * implementations are not annotated as @WebMethods.
 */
@WebService(endpointInterface = "com.sonal.TimeServer")
public class TimeServerImpl implements TimeServer {
 public String getTimeAsString() {
  return new Date().toString();
 }

 public long getTimeAsElapsed() {
  return new Date().getTime();
 }
}


TimeServerPublisher.java
package com.sonal;

import javax.xml.ws.Endpoint;

/**
 * This application publishes the web service whose SIB is
 * com.sonal.TimeServerImpl. For now, the service is published at network address
 * 127.0.0.1., which is localhost, and at port number 9876, as this port is
 * likely available on any desktop machine. The publication path is /ts, an
 * arbitrary name.
 *
 * The Endpoint class has an overloaded publish method. In this two-argument
 * version, the first argument is the publication URL as a string and the second
 * argument is an instance of the service SIB, in this case
 * com.sonal.TimeServerImpl.
 *
 * The application runs indefinitely, awaiting service requests. It needs to be
 * terminated at the command prompt with control-C or the equivalent.
 *
 * Once the application is started, open a browser to the URL
 *
 ** http://127.0.0.1:9876/ts?wsdl
 *
 * to view the service contract, the WSDL document. This is an easy test to
 * determine whether the service has deployed successfully. If the test
 * succeeds, a client then can be executed against the service.
 */

public class TimeServerPublisher {
 public static void main(String[] args) {
  // 1st argument is the publication URL
  // 2nd argument is an SIB instance
  Endpoint.publish("http://127.0.0.1:9876/ts", new TimeServerImpl());
 }
}



WSDL document for the TimeServer service
<?xml version="1.0" encoding="UTF-8"?>
<!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.4-b01. -->
<!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.4-b01. -->
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://sonal.com/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://sonal.com/" name="TimeServerImplService">
   <types>
      <xsd:schema>
         <xsd:import namespace="http://sonal.com/" schemaLocation="http://127.0.0.1:9876/ts?xsd=1" />
      </xsd:schema>
   </types>
   <message name="getTimeAsString">
      <part name="parameters" element="tns:getTimeAsString" />
   </message>
   <message name="getTimeAsStringResponse">
      <part name="parameters" element="tns:getTimeAsStringResponse" />
   </message>
   <message name="getTimeAsElapsed">
      <part name="parameters" element="tns:getTimeAsElapsed" />
   </message>
   <message name="getTimeAsElapsedResponse">
      <part name="parameters" element="tns:getTimeAsElapsedResponse" />
   </message>
   <portType name="TimeServer">
      <operation name="getTimeAsString">
         <input wsam:Action="http://sonal.com/TimeServer/getTimeAsStringRequest" message="tns:getTimeAsString" />
         <output wsam:Action="http://sonal.com/TimeServer/getTimeAsStringResponse" message="tns:getTimeAsStringResponse" />
      </operation>
      <operation name="getTimeAsElapsed">
         <input wsam:Action="http://sonal.com/TimeServer/getTimeAsElapsedRequest" message="tns:getTimeAsElapsed" />
         <output wsam:Action="http://sonal.com/TimeServer/getTimeAsElapsedResponse" message="tns:getTimeAsElapsedResponse" />
      </operation>
   </portType>
   <binding name="TimeServerImplPortBinding" type="tns:TimeServer">
      <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
      <operation name="getTimeAsString">
         <soap:operation soapAction="" />
         <input>
            <soap:body use="literal" />
         </input>
         <output>
            <soap:body use="literal" />
         </output>
      </operation>
      <operation name="getTimeAsElapsed">
         <soap:operation soapAction="" />
         <input>
            <soap:body use="literal" />
         </input>
         <output>
            <soap:body use="literal" />
         </output>
      </operation>
   </binding>
   <service name="TimeServerImplService">
      <port name="TimeServerImplPort" binding="tns:TimeServerImplPortBinding">
         <soap:address location="http://127.0.0.1:9876/ts" />
      </port>
   </service>
</definitions>

The portType section, near the top, groups the operations that the web service delivers, in this case the operations getTimeAsString and getTimeAsElapsed, which are the two Java methods declared in the SEI and implemented in the SIB. The WSDL portType is like a Java interface in that the portType presents the service operations abstractly but provides no implementation detail.
The other WSDL section of interest is the last, the service section, and in particular the service location, in this case the URL http://localhost:9876/ts. The URL is called the service endpoint and it informs clients about where the service can be accessed.

TimeClient.java
package com.sonal;

import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import java.net.URL;

class TimeClient {
 public static void main(String args[]) throws Exception {
  URL url = new URL("http://localhost:9876/ts?wsdl");
  // Qualified name of the service:
  // 1st arg is the service URI
  // 2nd is the service name published in the WSDL
  QName qname = new QName("http://sonal.com/", "TimeServerImplService");
  // Create, in effect, a factory for the service.
  Service service = Service.create(url, qname);
  // Extract the endpoint interface, the service "port".
  TimeServer port = service.getPort(TimeServer.class);
  System.out.println(port.getTimeAsString());
  System.out.println(port.getTimeAsElapsed());
 }
}