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:

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:

To access to WSDL: http://localhost:7001/wsc/HelloService?WSDL
To test every WSDL published: http://localhost:7001/wls_utc/begin.do
Here we are going to see how to install GAE plug-in in Eclipse, and to make and deploy my first basic application, in order to see how to manage the life deployment cycle this plug-in.
We will base in the Eclipse Galileo R2 for JEE projects on 64 bits package. And Google Plugin for Eclipse, which supports the GWT and GAE technologies, in Galileo version.
Eclipse installation is easy, download and unzip where you want. Then we execute it.
To install Google plug-in, Help > Install New Software … > Add, add the url Google Plugin for Eclipse for Galileo. And install Eclipse and both SDKs.
Create the application in Web File > New > Web Application Project:

To test it in local mode, in the contextual menu choose Debug As > Web Application. Then we can how to debug an application with the usual eclipse debugger.
To deploy in the server we must enter in https://appengine.google.com, and create an ID (pe: firstapp-lebrijo). We configure it through the contextual menu Google > App Engine Settings… Then Eclipse knows where deploy it when we do Google > Deploy to App Engine.
I have my first application in: http://firstapp-lebrijo.appspot.com/

In order to make the service layer and use the dependency injection we will take Spring.
Spring 2.5.6 is the OEPE default version supported.
First we will add the Spring Facet to our project. Right mouse button over the project > Properties… :

After genertate the ORM classes. They will generate with contextual menu > Spring > Generate Spring ORM Classes …

You can see, about the JPA defined in our persistence package, it will create th access classes and services ones. I recommend you see the lebrijo.school.services and lebrijo.school.dao packages.
After we must clean this class of methods, the generator generates all possibilities (remove, persist, findById,…). For example, if one entity of our model is a view, we can destroy persist or remove methods.
Here I keep the zip eclipse project after these steps.
Today we will see how to make the persistence in a Eclipse project with EclipseLink JPA implementation.
We will base in the last post Eclipse project. In the project properties (right buton) we will add the power to manage JPA entities, adding the facet:

We will ue EclipseLink 1.1.2, it is the JPA implementation by defect in WebLogic 11g.
Generating entities from tables
Over the project, in the contextual menu (right button), JPA > Generate Entities from Tables… We choose the conection SCHOOL, created in other posts, and tables REGISTRY and SCHOOLCERTIFICATES. Generating the entities in the package lebrijo.school.model:

To maintain the JPA coherence we must add an Identifier on every classes, Registry has one, but we must add one to SchoolCertificates:

You may see the file src/META-INF/persistence.xml, how it configures the connection and map the entities.
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="school" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>lebrijo.school.model.Registry</class>
<class>lebrijo.school.model.Schoolcertificate</class>
<properties>
<property name="eclipselink.target-server" value="WebLogic_10"/>
<property name="eclipselink.jdbc.driver" value="oracle.jdbc.OracleDriver"/>
<property name="eclipselink.jdbc.url" value="jdbc:oracle:thin:@192.168.0.7:1521:xe"/>
<property name="eclipselink.jdbc.user" value="school"/>
<property name="eclipselink.jdbc.password" value="school"/>
<property name="eclipselink.logging.level" value="FINEST"/>
</properties>
</persistence-unit>
</persistence>
here I leaveth eclipse zip project after these steps.
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 »
There is a very basic choice for templating creation with JSP based on “includes. It could be useful to response quickly to a client, very little project, avoid to use heavy technologies, or we want to deploy our project on every application server.
The technique creates little JSP code chunks for header and footer. After create all pages from a template.
Read the rest of this entry »