Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Jean Andre Latour
Call a webservice with a portlet
June 18, 2008 2:23 AM
Answer

Jean Andre Latour

Rank: Junior Member

Posts: 37

Join Date: June 16, 2008

Recent Posts

Hi !!

I developed a simple webservice and now I have it in a .war file. I run it with tomcat.

In Liferay, I have a Strut-Portlet, and I want it to call my webservice. But I don't know how to do that. I try this way:
1              DocumentAnalysisService service = new DocumentAnalysisService();
2            ProcessArgs in = new ProcessArgs();
3            in.setMediaUnit(doc);
4            try {
5                doc = (Document) service.getAnalyzerPort().process(in).getMediaUnit();  //call the service here !
6            } catch (ProcessException e) {
7                e.printStackTrace();
8            }


I don't know if my service is really called. I give it a Document and it must modify it and send me the modified Document back. If I don't run tomcat, when my portlet try to call the service, I get an exception:java.net.ConnectException: Connection refused

I read this article on the wiki: http://wiki.liferay.com/index.php/How_to_Expose_and_Consume_a_Method
But I don't really understand it.

Thanks for your help.
JAL
Man V K
RE: Call a webservice with a portlet
April 20, 2010 8:40 AM
Answer

Man V K

Rank: Regular Member

Posts: 139

Join Date: December 4, 2007

Recent Posts

Did you try using spring(using applicationcontext.xml)

Man.