ADF Business components: creating a basic Fusion webapp (FMW)
Sep 05, 10 by Juan Lebrijo about weblogic, JDeveloper, blog
After explore diferent ways, trying to cover the business layer with Spring/Eclipse and after that with EJB 3. If you want to develop with Oracle ADF framework, our best choice is ADFbc (business components). The reason, simple, it is better integrated with top layers (data controls and view) than EJB, this is the reference solution of the company (Oracle). Finally I choose the Oracle Development full stack, it is the best integrated, and then the most productive:
adfsimple.gif 43.4 KB
To create the application in JDeveloper select  File > New > Applications > Fusion Web Application (ADF). We call it HRApplication2:
create_app.png 173 KB
As in the case of Java Web generic Application, it will create tw projects:
  • ViewController: contains the wiew layer of our application, ADF.
  • Model: contains XML with our entities and relations in ADFbc.
To create a database connection go to the "Database Navigator" tab, and with right buton> New, introduce the connection configuration:
db-connection.png 31.2 KB
Drag and drop the connection to our application:
drag_drop_hr.png 17.9 KB
Then we are ready to start modeling and programming.
JAX-WS: Generando un cliente de WS con SoapUI
Sep 02, 10 by Juan Lebrijo about Web Services, SoapUI, blog, Java
Vamos a generar las clases necesarias para generar un cliente de un Web Service a partir de su WSDL. Nos basaremos en el proyecto HelloWorld de hace unas semanas, y aquí le añadimos seguridad. En este proyecto devolvíamos el saludo según el nombre que nos pasaban como parámetro a través del Web Service. Para generar las clases auxiliares utilizaremos SoapUI:
1004.thumbnail.gif 6.14 KB
Tendremos que tener bien localizada en nuestro equipo la herramienta wsimport.bat, que nos descargamos con todo el paquete de la implementación estándar de SUN (de JAX-WS):
1005.thumbnail.gif 5.47 KB
Nos ha generado un directorio con los fuentes y otro con las clases ya compiladas:
1006.thumbnail.gif 8.12 KB
Escribir el cliente con ayuda de estas clases es tan fácil como esto:
package client;

import java.net.MalformedURLException;
import java.net.URL;

import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;

public class HelloClient {

    public static void main(String[] args) {
        HelloService service = null;
        try {
            // Creamos el servicio con el WSDL
            URL wsdlLocation = new URL("http://localhost:7001/wsc/HelloService?WSDL");
            String targetNamespace="http://services/";
            String name="HelloService";
            service = new HelloService( wsdlLocation, new QName(targetNamespace, name));
            Hello port = service.getHelloPort();
            // Añadimos capacidades de seguridad a la llamada
            BindingProvider provider = (BindingProvider) port;
            provider.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "user");   
            provider.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "12345678");
            //Mostramos el resultado
            System.out.println(port.sayHello(args[0]));
        } catch (MalformedURLException e ) {
            e.printStackTrace();
        }
    }
}
JAX-WS: WS client generating with SoapUI
Sep 02, 10 by Juan Lebrijo about Web Services, SoapUI, blog, Java
We will create the needed classes to generate a Web Service client from its WSDL. We will base in the HelloWorld project, and here will add the security. In this project we response with a Hello for the name which sent as argument through the Web Service. In order to generate the classe we will use SoapUI:
1004.thumbnail.gif 6.14 KB
We must to locate in our hard disk the wsimport.bat tool, downloaded with the SUN standard package implementation (of JAX-WS):
1005.thumbnail.gif 5.47 KB
It generates a folder with sources and other with compiled classes:
1006.thumbnail.gif 8.12 KB
To write the client helped with this classes is as easy as this:
package client;

import java.net.MalformedURLException;
import java.net.URL;

import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;

public class HelloClient {

    public static void main(String[] args) {
        HelloService service = null;
        try {
            // Creamos el servicio con el WSDL
            URL wsdlLocation = new URL("http://localhost:7001/wsc/HelloService?WSDL");
            String targetNamespace="http://services/";
            String name="HelloService";
            service = new HelloService( wsdlLocation, new QName(targetNamespace, name));
            Hello port = service.getHelloPort();
            // Añadimos capacidades de seguridad a la llamada
            BindingProvider provider = (BindingProvider) port;
            provider.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "user");   
            provider.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "12345678");
            //Mostramos el resultado
            System.out.println(port.sayHello(args[0]));
        } catch (MalformedURLException e ) {
            e.printStackTrace();
        }
    }
}