Implement a portlet using SOAP in Liferay Portal Professional

xiaoxiao2021-03-06  44

The main tools used are: Liferay-Tomcat-

3.1.0

a

XIS-1.1.

Download the zip folder of these two tools, unzipped to two directories, respectively.

Point Tomcat_Home, Axis_HOME in the environment variable, points to the root directory of these two files, respectively.

Specific configuration method

Liferay

Axis

Implementation: Use SOAP to access Web Service in portlet, display the result in the Portal interface

First, configure the AXIS Server end

1. Simple service programs, similar to Hello World, as follows

Package com.kevingq.service

Helloservice.java

Public Class HelloService

{

Public String Sayhello (String Name)

{

System.out.Println ("HelloService");

Return "Axis Say Hello To" Name;

}

}

Put the% axis_home% / webapps / axis folder to% tomcat_home / webapps /, put compiled HelloService.class in Axis / Web-INF / CLASSES.

Add the following XML piece in Server-Config.WSDD

Second, write three JSP files in portlets (refer to the Weather portlet in Liferay)

INIT.JSP

<% @ include file = "/ html / common / init.jsp"%>

<%

PortletPreference. PREFS = renderRequest.getPReference ();

String [] Names = prefs.getvalues ​​("names", new string [0]);

%>

2. View.jsp

<% @ include file = "/ html / portlet / hello / init.jsp"%>

<% @ page import = "com.kevingq.portlet.Hello.util. *"%>

<% @ page import = "com.kevingq.portlet.Hello.model.Hello"%>

Welcome!

<%

For (int i = 0; i

{

Hello Hello = Helloutil.getHello (Names [i]);

%>

<% = names [i]%>

<%

IF (Hello! = null) {

%>

<% = hello.gethello ()%>

<%

} else {

%>

<% = "NULL"%>

<%

}

%>

<%

}

%>

3 edit.jsp

<% @ include file = "/ html / portlet / hello / init.jsp"%>

" method = "post" name = " FM ">

<% = constants.cmd%> "type =" hidden "value =" <% = constants.Update%> ">

>


<% = languageutil.get (pageContext, "You-have-surcessfully-updated-your-preferences")%>

<% = languageutil.get (pageContext, "")%>