Creating a basic JSF View: Hello World!!

In a previous project we saw how to create a Weblogic basic web project. Based on this we will create a very basic view with JSF.

JSF has some advantages:

  • Clean Cross browsing: we can forget styles and javascript, and navigator sigularities.
  • Encapsulates the view components
  • It is XML, then is text, then is always editable.
  • Standards based = XHTML + JavaScript + JSP + Java (JEE5+)
  • Some libraries (oracle-ADF, richfaces, icefaces) allow Rich Inernet Applications development.

Read the rest of this entry »

EJB 3.0: Business Layer

In this phase we will see how JDeveloper solves the business layer. EJB 3.0 is the standard to solve it. This is about to construct the business process, which will be called by the view, web services, …

We will base on a past post, where we 聽created the persistence layer for our little application.

Read the rest of this entry »

Securing Weblogic with SQLAuthenticator provider

In a previous article we saw how to secure a Web Service with basic authentication (this could be used for every page in our application). We did it creating users with Weblogic Default Authenticator.

Today we will create an SQLAuthenticator in Weblogic, then the server will take users and groups from the data base.

Read the rest of this entry »

Weblogic / JDeveloper: Creating the base application

Open JDeveloper with “Default role” option, to activare al environment features. We are interested in JEE and database development features.

File > New > Java EE Web Application, then we are creating the new application estructure:

Creating app

Put the name “HRApplication”, and it creates two projects on the app:

  • ViewController: contains the view of our application, which corresponds with ADF technology based on JSF standard.
  • Model: contains EJB session beand and JPA entities.

To create a database connection go to the “Database Navigator” tab, and with right buton> New, introduce the connection configuration:

Creating db connection

Drag and drop the connection to our application:

Adding HR connection to our application

Then we are ready to start modeling and programming.

JDeveloper Architecture with Weblogic

Seems obvious that the best tool to develop Weblogic/OracleDB is JDeveloper. But for me, until now, it was not so obvious, because Eclipse is my favorite IDE, it is the standard for Java development (Jboss, Spring, Android,…).

If your architecture is Oracle/Weblogic, have no fear to change, and your obsesion is to increase your productivity, then, your tool is JDeveloper. I am gonna write some posts trying to demonstrate this point. But if you want an advancement, you can see this video, you will see howcan be really ssimple make RIA applications over complex enterprise environments.

Read the rest of this entry »

JAX-WS: Container level security on Weblogic

In this post we are going to see how to secure a Web Service with basic HTTP Auth, in weblogic. We will base in a previous project where we created a very basic WS: Hello World.

In the Security Realm > MyRealm we have to create:

  • An user: user/12345678
  • A group: TutorialUser
  • Add the user to the group

In the Weblogic console as we see on the picture:

Managing users and groups

In web.xml we have to add the security confs needed (path, basic type,….):

   <!--
    SECURITY
    -->
    <security-constraint>
        <display-name>Regla01</display-name>
        <web-resource-collection>
            <web-resource-name>WSPOST</web-resource-name>
            <description>
            <url-pattern>/*</url-pattern>
            <http-method>POST</http-method>
        </description>
        <auth-constraint>
            <description>
            <role-name>TutorialUser</role-name>
        </description>
    </auth-constraint>
    <session-config>
        <session-timeout>5</session-timeout>
    </session-config>
    <login-config>
        <auth-method>BASIC</auth-method>
        <realm-name>myrealm</realm-name>
    </login-config>
    <security-role>
        <description>
        <role-name>TutorialUser</role-name>
    </description>
</security-role>
</web-resource-collection>
</security-constraint>

In weblogic.xml map the application role with server role (it is mandatory):

    <wls:security-role-assignment>
        <wls:role-name>TutorialUser</wls:role-name>
        <wls:principal-name>TutorialUser</wls:principal-name>
    </wls:security-role-assignment>

We can test with SoapUI creating a new WS project, with WSDL address (http://localhost:7001/wsc/HelloService?WSDL) and previous Weblogic credentials created:

SoapUI Test

JAX-WS: Serving Web Services SOAP

Today we will create a SOAP Web Service, based on LebrijoSchool project which we were making in early weeks over Oracle-Weblogic Architechture.

First of all is to add the Web Services facet. Right button > Properties … :

Add WS facet

After, we will create the class from a Spring Service class. Right button > New > WebLogic Web Service for Spring Beans:

Expose Spring as a WS

Choose the Service, and the methods that we want to publish as Web Service.

Finally put it in the logical package: lebrijo.school.webservices. And name it as “SchoolCertificatesWS”.

This is the code:

	@Autowired
	@Qualifier("RegistryService")
	private IRegistryService springServ;
 
	@WebMethod
	public Registry findRegistryById(java.lang.String id) throws Exception {
		return springServ.findRegistryById( id );
	}

We have a Weblogic client to test the WS, we can acces thru the URL http://localhost:7001/wls_utc/.

JAX-WS: Hello World!!

Today we are going to see ho to create a WS which says Hello over Weblogic, with its IDE Eclipse OEPE.
We will create a New project > Web Service Project:

Create project

We created teh following class:

package services;import javax.jws.*;
@WebService
public class Hello {
@WebMethod
    public String sayHello(String name) {
        return "Hello, "+name+".";
    }
}

With these annotations we can serve the WS, and with right button on the classes and Run as > Run on Server. It launches the test WS application in the navigator:

WS Test

To access to WSDL: http://localhost:7001/wsc/HelloService?WSDL
To test every WSDL published: http://localhost:7001/wls_utc/begin.do

OEPE: Creating a basic Eclipse Project for WebLogic

In the last posts we had defined an Oracle EE architecture, we had installed Oracle XE and we connected it to our Eclipse, and we designed our data model for our example application.

Now we have to create a basic Eclipse project running on Weblogic.

Read the rest of this entry »

Oracle Java Enterprise Architecture

This post comes from the last, which treats my generic definition for a Web Applications Development Architecture.

Taking basis in Oracle documentation, investing on internet, and searching the most realistic situation for an enterprise environment, I purpose the following architecture WebLogic based:

Oracle Architecture

The figure shows the generic architecture against Oracle’s one:

  • JSF: MVC on presentation layer, wanting to avoid javascript and crossbrowsing.
  • JAX-WS: the standard to make Web Services
  • Jasper: tool to make reports in many formats (PDF,XSL,DOC,..) and from many data sources (SQL, XML, XLS,….)
  • Spring: creating service layer, and using Dependecy Injection in the other layers.
  • EclipseLink: JPA implementation.
  • Weblogic: JEEreference server for Oracle (at the moment).
  • Java 6: advantages of 6 version of Java language.
  • Eclipse OEPE: Eclipse Oracle distro, with its best tools for this IDE.