Serviços Java "Alô Mundo" | Lumis XP
Neste vídeo explicamos como criar um novo serviço com servicedefinition.xml e uma interface em Java a partir do Eclipse
Para isso, são executados os seguintes passos:
<?xml version="1.0" encoding="UTF-8"?>
<serviceDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.lumis.com.br/lumisportal/xsd/servicedefinition.xsd">
<service name="Hello World" />
<interfaces>
<interface name="Hello" id="hello" className="br.com.treinamento.service.helloworld.HelloWorldInterface">
</interface>
</interfaces>
</serviceDefinition>
package br.com.treinamento.service.helloworld;
import java.io.IOException;
import lumis.portal.PortalException;
import lumis.portal.serviceinterface.GenericServiceInterface;
import lumis.portal.serviceinterface.IServiceInterfaceRenderRequest;
import lumis.portal.serviceinterface.IServiceInterfaceRenderResponse;
import lumis.portal.serviceinterface.ServiceInterfaceException;
public class HelloWorldInterface extends GenericServiceInterface
{
@Override
public void render(IServiceInterfaceRenderRequest request, IServiceInterfaceRenderResponse response) throws ServiceInterfaceException, PortalException
{
try {
response.getWriter().print("<div>Hello <b>world</b></div>");
} catch(IOException e) {
e.printStackTrace();
}
}
}
- Criar um novo pacote no Eclipse que representa o serviço; (0:55)
- Criar servicedefinition.xml a partir do template; (1:37)
- Atualizar módulo com o novo serviço e instanciar ele no projeto; (2:43)
- Criar interface para o serviço; (3:44)
- Criar nova clase java que representa a interface sendo criada; (4:22)
- Atualizar módulo e instanciar nova interface criada para o novo serviço. (6:38)
- servicedefinition.xml:
- HelloWorldInterface.java: