留言板

Publish JournalArticles in Liferay's CMS via HTTP

Jan Matz,修改在17 年前。

Publish JournalArticles in Liferay's CMS via HTTP

New Member 帖子: 13 加入日期: 06-11-6 最近的帖子
Hi,

Is there any possibility to publish a JournalArticle in Liferays CMS via HTTP? There are different Classes, that seem to suit my needs. These are TunnelUtil, TunnelServlet, JournalArticleServiceHTTP... . Unfortunately the only documentation I can find is the uncommented code.

I tried different approaches but always got exceptions. Probably my environment is set up incorrectly. Any ideas out there that follow the KISS principle? If possible with code snippets.

Thanks in advance.
thumbnail
Jörn Ebeling,修改在17 年前。

RE: Publish JournalArticles in Liferay's CMS via HTTP

Regular Member 帖子: 119 加入日期: 06-1-6 最近的帖子
Please have a look here
Jan Matz,修改在17 年前。

RE: Publish JournalArticles in Liferay's CMS via HTTP

New Member 帖子: 13 加入日期: 06-11-6 最近的帖子
Thanks Jörn,

I already found that thread before posting this thread. But it didn´t quite help. You said that you created a WebService running on the same server liferay is running on. But I want a simpler solution. Actually, I just want to call the AddArticle function from my IDE for testing.

What I did so far was creating a HttpPrincipal, creating a MethodWrapper, opening a Connection, and sending the HttpPrincipal and the MethodWrapper as a ObjectValuePair to the ObjectOutputStream of the connection.

Unfortunately, I am getting a ClassNotFoundException in Tomcat. That´s why I said it seems as if my Liferay is not properly set up. In detail, it is the class com.liferay.portal.shared.util.MethodWrapper that is missing.

Any ideas on this?
Jan Matz,修改在17 年前。

ClassCastException for MethodWrapper

New Member 帖子: 13 加入日期: 06-11-6 最近的帖子
After having added the portal-shared.jar to the lib-folder of Tomcat, I am getting a ClassCastException:

10:28:38,802 ERROR [TunnelServlet:104] java.lang.ClassCastException: com.liferay.portal.shared.util.MethodWrapper
at com.liferay.portal.servlet.TunnelServlet.doPost(TunnelServlet.java:75)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at com.liferay.portal.kernel.servlet.PortalServletWrapper.service(PortalServletWrapper.java:80)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
Jan Matz,修改在17 年前。

InvalidClassException BaseModel class incompatible

New Member 帖子: 13 加入日期: 06-11-6 最近的帖子
Well well well, another step forward maybe...

The ClassCastException vanished after importing another Class.

Old import: com.liferay.portal.shared.util.MethodWrapper
New import: import com.liferay.portal.kernel.util.MethodWrapper;

Unfortunately, I´m getting an InvalidClassException now inside my IDE. Thats an improvement, I think:

java.io.InvalidClassException: com.liferay.portal.model.BaseModel; local class incompatible: stream classdesc serialVersionUID = -8086539700132081127, local class serialVersionUID = -5508960563794004406

This should occure due to different class versions between Server and Client. But what do I have to change, which package do I have to import?

Hope that I am on the correct path. emoticon
Jan Matz,修改在17 年前。

RE: InvalidClassException BaseModel class incompatible

New Member 帖子: 13 加入日期: 06-11-6 最近的帖子
Thanks. I found a solution.

By replacing the portal-ejb.jar from my classpath with the jar from the %LIFERAY%\webapps\root\web-inf\lib folder the InvalidClassException was resolved.

I managed to read Articles that I previously created in the CMS.
thumbnail
Jörn Ebeling,修改在17 年前。

RE: InvalidClassException BaseModel class incompatible

Regular Member 帖子: 119 加入日期: 06-1-6 最近的帖子
Jan Matz:
Thanks. I found a solution.

By replacing the portal-ejb.jar from my classpath with the jar from the %LIFERAY%\webapps\root\web-inf\lib folder the InvalidClassException was resolved.

I managed to read Articles that I previously created in the CMS.


Ok, in this case forget about my second posting ;)
thumbnail
Jörn Ebeling,修改在17 年前。

RE: InvalidClassException BaseModel class incompatible

Regular Member 帖子: 119 加入日期: 06-1-6 最近的帖子
Sorry Jan,
I never tried to access the Liferay Http Service from outside lr server.
But I think if you use the same jars as the lr server you won't have any version problems.

Why are you trying to acces this through your IDE? If you deploy a webservice you can use your interfaces on client side even if liferay api has changed. An other point is that I am not sure whether the http-services are running on an other maschine or not. As far as I now the http-service-classes try to acces /tunnel/ (or /tunnel-web/) on the local maschine. Or didn't you use this classes because of the MethodWrapper?