Forums de discussion

Call a webservice with a portlet

Jean Andre Latour, modifié il y a 15 années.

Call a webservice with a portlet

Junior Member Publications: 37 Date d'inscription: 16/06/08 Publications récentes
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:
	          DocumentAnalysisService service = new DocumentAnalysisService();
			ProcessArgs in = new ProcessArgs();
			in.setMediaUnit(doc);
			try {
				doc = (Document) service.getAnalyzerPort().process(in).getMediaUnit();  //call the service here !
			} catch (ProcessException e) {
				e.printStackTrace();
			}


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, modifié il y a 14 années.

RE: Call a webservice with a portlet

Regular Member Publications: 138 Date d'inscription: 04/12/07 Publications récentes
Did you try using spring(using applicationcontext.xml)

Man.