掲示板

Calling new web services

13年前 に Bruno Santos によって更新されました。

Calling new web services

New Member 投稿: 17 参加年月日: 10/06/30 最新の投稿
Hello all,

I have just generated a new service using the Liferay IDE. First i created a Liferay Portlet Plugin and then I added a Liferay Service to it. I created the service.xml and clicked on the Build Services on the Eclipse IDE. Ok now according to your wiki i have to insert my methods on the {my_package}.model.impl.{service_name}Impl.java and run the service Builder again. My doubt is if everythin went ok i have now a portlet that i will deploy on liferay but how can i test it (Through JSON REST API)? For instants, whats the URL path i have to call on a browser to access my method? and how can i build a secure service?

Regards
13年前 に Bruno Santos によって更新されました。

RE: Calling new web services

New Member 投稿: 17 参加年月日: 10/06/30 最新の投稿
Hello all,

I just to want to create a very simple web service for logging using JSON REST. I followed the wiki about the service builder and coded the following code:


package pt.log.model.impl;


/**
 * <a href="logImpl.java.html"><b><i>View Source</i></b></a>
 *
 * @author 
 */
public class logImpl extends logModelImpl implements pt.log.model.log {
	public logImpl() {
	}
	
	public void createLogEntry(String userId, String account, String actionType, String actionDescription){
		setUserId(userId);
		setAccount(account);
		setActionType(actionType);
		setActionDescription(actionDescription);
	}
	
	public String getLogEntry() {
		return "Testing 1 2 3!";
	}
}


Then executed the build services again. Then I deployed it on liferay and everything was ok. Now, how can i call it using REST JSON? for example, on the tunnel-web I can call http://liferay-host/tunnel-web/secure/json?... How can I perform this kind of calls on my new web service?

Regards
Bruno Santos