Forums

Home » Liferay Portal » English » 2. Using Liferay » General

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Prabhpreet Singh
Using Article Service as Web Service
January 13, 2009 1:52 PM
Answer

Prabhpreet Singh

Rank: New Member

Posts: 9

Join Date: January 13, 2009

Recent Posts

Hi there,

I need assistance in the following scenario:

I have downloaded and installed Liferay Portal 5.5-5.1.2. on my Windows Vista. I am planning to use Liferay Portal to store all my articles.

I need to develop a solution wherein there is another web application which is being developed using Zend Framework and would be physically deployed on a separate physical location other than Liferay Portal. This web application needs to display all the articles which is being maintained / stored in Liferay Portal. The possible solution I could think of is using Web Services (exposed via Liferay Portal) which I can consume in my Zend Framework based web application to retrieve list of artciles, article's content etc.

Please let me know if the above solution is practically possible and if yes then how?

Look forward for a postive response.

Regards,
Prabhpreet
Prabhpreet Singh
RE: Using Article Service as Web Service
January 14, 2009 3:23 PM
Answer

Prabhpreet Singh

Rank: New Member

Posts: 9

Join Date: January 13, 2009

Recent Posts

Guys,

Please reply.

Regards,
Prabhpreet
Hervé Ménage
RE: Using Article Service as Web Service
January 15, 2009 10:56 PM
Answer

Hervé Ménage

Rank: Junior Member

Posts: 50

Join Date: March 1, 2007

Recent Posts

Hello,

I think you can do it quite "easily" as soon as you get familiar with Liferay SOAP interface.
In a PHP project, I called Liferay SOAP operations to manage users. Until now, I experimented user search and user account activation, but it is a start only.

The Liferay SOAP interface is available here (update the URL to your environment if needed): http://localhost:8080/tunnel-web/axis

You will be interested in:
 1# Portlet_Journal_JournalArticleService
 2
 3    * addArticle
 4    * addArticle
 5    * copyArticle
 6    * getArticle
 7    * removeArticleLocale
 8    * removeArticleLocale
 9    * updateContent


When you are accessing SOAP services from another host, you must extend the portal.properties files into portal-ext.properties (in <liferay_web_app_dir>/WEB-INF/classes):
1tunnel.servlet.hosts.allowed=
2axis.servlet.hosts.allowed=

You have to set the allowed host names/IPs as properties' values (comma separated). Leave to blank to allow all hosts.

Here is the PHP code I used to activate a user account. If you translate it to Zend language, it should work :-)
1       
2        $server_url = "http://2:test@192.168.59.1:8081/tunnel-web/secure/axis/Portal_UserService"; [i]// 2 is the user ID that corresponds to test@liferay.com[/i]
3        $liferay_client = new nusoapclient($server_url, TRUE); [i]// nusoapclient is the PHP nusoap client to call web services[/i]
4       
5        $user_email = "user_to_activate@liferay.com";
6        $liferay_user = $liferay_client->call('getUserIdByEmailAddress', array('companyId' => '1', 'emailAddress' => $user_email));
7        $liferay_result = $liferay_client->call('updateActive', array('userId' => $liferay_user, 'active' => true));


Hope this helps...
Regards
Hervé
Prabhpreet Singh
RE: Using Article Service as Web Service
January 17, 2009 7:58 AM
Answer

Prabhpreet Singh

Rank: New Member

Posts: 9

Join Date: January 13, 2009

Recent Posts

Thanks a lot, Herve,

Regards,
Prabhpreet
Prabhpreet Singh
RE: Using Article Service as Web Service
January 17, 2009 8:57 AM
Answer

Prabhpreet Singh

Rank: New Member

Posts: 9

Join Date: January 13, 2009

Recent Posts

Hey Herve,

When I am using the following URL on my local machine:

http://localhost:8080/tunnel-web/axis

I am getting "Access Denied" page. Please see the attached image.

Regards,
Prabhpreet
Attachment

Attachments: AccessDenied_TunnelWebAxis.jpg (88.3k)