Foros de discusión
How to build a servlet for an application hoste in a different server
Gabriel Venegas, modificado hace 12 años.
How to build a servlet for an application hoste in a different server
Junior Member Mensajes: 28 Fecha de incorporación: 10/11/10 Mensajes recientes
Hello all, I hope you can help me.
I need to create a servlet that receive an html request with some post type parameters. Process some information and return an xml file in the response for example, receive a poll id number, do a PollsQuestionLocalServiceUtil.getQuestion(id) for polls portlet and return an xml in the html response with an xml of the information obtained from the service.
Normally I would create a servlet class that extends HttpServlet. Create a service method in it to process the request and write the response, and finally register it in the web.xml file. I don know if this could be achieved in liferay and if it is, Is it possible to still use the services created by the service-builder in the server?
I am using Liferay 5.2.3 and Tomcat 6.0. Is this the correct way to do it? please, if someone knows how to do this or has a tutorial on how to do it, I would really appreciate if you could share this info with me.
Thanks in advance to anyone that might help me.
I need to create a servlet that receive an html request with some post type parameters. Process some information and return an xml file in the response for example, receive a poll id number, do a PollsQuestionLocalServiceUtil.getQuestion(id) for polls portlet and return an xml in the html response with an xml of the information obtained from the service.
Normally I would create a servlet class that extends HttpServlet. Create a service method in it to process the request and write the response, and finally register it in the web.xml file. I don know if this could be achieved in liferay and if it is, Is it possible to still use the services created by the service-builder in the server?
I am using Liferay 5.2.3 and Tomcat 6.0. Is this the correct way to do it? please, if someone knows how to do this or has a tutorial on how to do it, I would really appreciate if you could share this info with me.
Thanks in advance to anyone that might help me.
Jay Patel, modificado hace 12 años.
RE: How to build a servlet for an application hoste in a different server
Regular Member Mensajes: 118 Fecha de incorporación: 24/02/10 Mensajes recientesGabriel Venegas:
Hello all, I hope you can help me.
I need to create a servlet that receive an html request with some post type parameters. Process some information and return an xml file in the response for example, receive a poll id number, do a PollsQuestionLocalServiceUtil.getQuestion(id) for polls portlet and return an xml in the html response with an xml of the information obtained from the service.
Normally I would create a servlet class that extends HttpServlet. Create a service method in it to process the request and write the response, and finally register it in the web.xml file. I don know if this could be achieved in liferay and if it is, Is it possible to still use the services created by the service-builder in the server?
I am using Liferay 5.2.3 and Tomcat 6.0. Is this the correct way to do it? please, if someone knows how to do this or has a tutorial on how to do it, I would really appreciate if you could share this info with me.
Thanks in advance to anyone that might help me.
Hi Gabriel,
If I am not wrong then, what you want to achieve is something like..."You want to access data/content of some Liferay entity/DB from such as Polls etc. from some other system"..
If this is what you want to achieve then existing web-services provided by Liferay would be the best fit for you.
Try accessing "http://localhost:8080/tunnel-web/axis"..you will get list of services what Liferay provides...
Best Regards,
Jay.
Gabriel Venegas, modificado hace 12 años.
RE: How to build a servlet for an application hoste in a different server
Junior Member Mensajes: 28 Fecha de incorporación: 10/11/10 Mensajes recientes
Hello Jay, and thanks for your quick response.
You got it right Jay, accessing the polls entities from the liferay database from another application is exactly what I need to do. However, I tried the url you suggested (http://localhost:8080/tunnel-web/axis) to get the list of webservices, instead I got the following error message:
Am I missing something? do I need to configue something else?
Please advise
Thanks in advance for any help you might give me.
You got it right Jay, accessing the polls entities from the liferay database from another application is exactly what I need to do. However, I tried the url you suggested (http://localhost:8080/tunnel-web/axis) to get the list of webservices, instead I got the following error message:
HTTP Status 403 - Access denied for 0:0:0:0:0:0:0:1
type Status report
message Access denied for 0:0:0:0:0:0:0:1
description Access to the specified resource (Access denied for 0:0:0:0:0:0:0:1) has been forbidden.
Apache Tomcat/6.0.29
Am I missing something? do I need to configue something else?
Please advise
Thanks in advance for any help you might give me.
Mika Koivisto, modificado hace 12 años.
RE: How to build a servlet for an application hoste in a different server
Liferay Legend Mensajes: 1519 Fecha de incorporación: 7/08/06 Mensajes recientes
Your computer has IPv6 enabled for localhost so you need to add the IPv6 equivalent of 127.0.0.1 to your portal-ext.properties like this:
axis.servlet.hosts.allowed=127.0.0.1,SERVER_IP,0:0:0:0:0:0:0:1
Jay Patel, modificado hace 12 años.
RE: How to build a servlet for an application hoste in a different server
Regular Member Mensajes: 118 Fecha de incorporación: 24/02/10 Mensajes recientes
Thanks Mika for clearing this...
Gabriel, did you try after putting this property?
Regards,
Jay.
Gabriel, did you try after putting this property?
Regards,
Jay.
Gabriel Venegas, modificado hace 12 años.
RE: How to build a servlet for an application hoste in a different server
Junior Member Mensajes: 28 Fecha de incorporación: 10/11/10 Mensajes recientes
Helo Patel, after I modified the property I was able to get the list of services. However I didn knew how to use those, so I created the servlet manually and added the servlet mapping in web.xml manually. I imported the local services in the class and it worked perfectly.
Thanks everyone for their help.
Thanks everyone for their help.
Kamesh Sampath, modificado hace 12 años.
RE: How to build a servlet for an application hoste in a different server
Regular Member Mensajes: 158 Fecha de incorporación: 27/05/10 Mensajes recientes
please check with the client files that are available as part of additional files download in the Liferay Distribution Download. You need to create the Web Services client ofr consuming these services, for testing purposes you can use SOAP UI, if you want to consume them from your Portlets please develop a client
Hope this is the information you are looking for.
~Kamesh
Hope this is the information you are looking for.
~Kamesh
Gabriel Venegas, modificado hace 12 años.
RE: How to build a servlet for an application hoste in a different server
Junior Member Mensajes: 28 Fecha de incorporación: 10/11/10 Mensajes recientes
Thanks a lot for the advice Kamesh. Do you know if the versions of these complements are available for liferay 5.2.3?
Jacques Traore, modificado hace 10 años.
RE: How to build a servlet for an application hoste in a different server
Junior Member Mensajes: 49 Fecha de incorporación: 21/01/13 Mensajes recientes
You guys, you saved my life.
Thank you very much
Thank you very much