AWS Lambda Function Hello World! in Java

The below is literally all the code you have to do in order to have a functioning AWS Lamda function:

package com.wordpress.vrsbrazil.lambda.functions;


 * Created by vrsbrazil on 02/03/2017.
public class TestFunctionHandler implements RequestHandler<Object, Object> {

    public Object handleRequest(Object o, Context context) {
        return ("Hello, " + o + "!");


Here is the dependency you need:


Now to test it, you will need some simple JUnit coding, for this test coding here is the dependencies you will need:


When you test a lambda function you will need a Lamda context, as you are making an offline test you will need to make you own, this is dead simple, you just need a class that implements, so here is the context I created:


 * Created by vrsbrazil on 02/03/2017.
public class LamdaTestContext implements Context{
    public String getAwsRequestId() {
        return null;

    public String getLogGroupName() {
        return null;

    public String getLogStreamName() {
        return null;

    public String getFunctionName() {
        return null;

    public CognitoIdentity getIdentity() {
        return null;

    public ClientContext getClientContext() {
        return null;

    public int getRemainingTimeInMillis() {
        return 0;

    public int getMemoryLimitInMB() {
        return 0;

    public LambdaLogger getLogger() {
        return null;

Finally, here is the test code:

import com.wordpress.vrsbrazil.lambda.functions.TestFunctionHandler;
import org.junit.Assert;
import org.junit.Test;

 * Created by vrsbrazil on 02/03/2017.
public class TesteTestFunction {

    public void testLambdaFunctionHandler() {

        TestFunctionHandler function = new TestFunctionHandler();
        Context ctx = new LamdaTestContext();
        String s = "Teste";

        Object output = function.handleRequest(s, ctx);

        if (output != null) {
        Assert.assertEquals("Hello, Teste!", output);



Here is a git project for you:

Thank you!

How to map mongodb collections on spring-data-mongodb when the names differ from your pojo definition

package com.wordpress.vrsbrazil;


/*When collection name is different*/
public class MyPojo {

public String id;

/*When field name is different*/
public Integer myAttribute;

//getters and setters


How to Publish REST services using Oracle SOA Suite 12c

Hello and welcome!


Continuing our deep dive into the Oracle SOA Suite 12c, we will now explore the new REST adapter! That is something clients have been asking for a long time and it is finally here!

For our test I will create a REST POST web-service that will receive either XML, JSON or URL params and pass them to a BPEL process, so as always we will start creating a new SOA pŕoject:



After the process is created we will need to design our data structure for our example to work, to do that we will create a new XSD Schema file! Yes, we are creating a REST service, stay with me, we are going somewhere with this, here is my schema:

<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns:xsd="" xmlns:vrs=""
targetNamespace="" elementFormDefault="qualified">
<xsd:element name="restElement">
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="dateTime" type="xsd:dateTime"/>

Important: If you want to create a schema from scratch like I am doing, on the “New Gallery” choose the “XML Schema” option not the “XSD Schema” this one is a wizard for creating XSDs based on file patterns, not covered on this post.

Next we drag a REST Adapter from the Components Palette into the Exposed Services column at the composite.xml, this will bring up the “Create REST Binding” wizard:


At the “Operation Bindings” section, click on the “green plus sign” and then click on  “Add operation binding”, this will bring up the “REST Operation Binding” wizard:


At the “Request” tab you will see the options offered for payload: XML, JSON, URL-Encoded and No Payload, we are choosing all BUT No Payload.

You should have also noticed a Schema URL field available, we will click on that one’s search icon and select the  “restElement” element on the XSD we just created. The operation Name and HTTP verb is on the image below:


At the “Request” screen, on the “Payload” section there is a cogs button, this button creates data examples for the payloads we have selected, here are those it created when I clicked:


<restElement xmlns="">


  "name" : "name43",
  "dateTime" : "2014-07-22T16:06:58.415"



If you want the wizard will save these generated code on your Adapters folder within the project, it can be useful!

Now for our response tab I will also choose our xsd element and choose all data available BUT “No payload” again:


We are all set here, click OK to create the operation and OK again on the “Create REST binding” wizard.


Time to create our Synchronous BPEL process, drag a BPEL component to the composite.xml screen.
On the creation wizard, at the Input/Output section, select our XSD element for both and UNCHECK “Expose as a SOAP Service”:


Your composite should look like this:


A Mediator is all we need now to link both these guys:


Make sure you assign the payload values for input and output:


And do the same thing on your BPEL process:


If your process looks like this you are probably all set:


Finally we can deploy and test it, lets start with the basic XML Request and XML Response:


Looking good, how about a JSON/JSON Test:


Let’s mix it up a little with a URL/JSON one:


Well this is it, hope I could help you!

Thank you,