留言板

how to get response,request,themedisplay object in EntityServiceImpl class

thumbnail
Raju oukanti,修改在9 年前。

how to get response,request,themedisplay object in EntityServiceImpl class

Regular Member 帖子: 143 加入日期: 12-2-21 最近的帖子
Hi Guys,

I am exposing my services as webservices.But i need response,request,themedisplay object in order to perform the functionality.So how can i get these objects in EntityServiceImpl class .Please help me ASAP.

Thanks,
Raju
thumbnail
Olaf Kock,修改在9 年前。

RE: how to get response,request,themedisplay object in EntityServiceImpl cl

Liferay Legend 帖子: 6403 加入日期: 08-9-23 最近的帖子
In case you'd get your hands on a request object: What data would you expect in there? A HttpServletRequest is bound to servlet requests (not webservice requests) and will have different structure (read: e.g. parameters) than anything that's forwarded through a webservice. You obviously can't have a portlet request, as you're not within a portlet and neither in an action nor render phase.

ThemeDisplay is an attribute in a portlet request - thus you don't have it either. In a web service you're not in the portal context. Please state what data you want to access, we might help you to find this data if we know what you want to achieve without requiring these objects.
thumbnail
Raju oukanti,修改在9 年前。

RE: how to get response,request,themedisplay object in EntityServiceImpl cl

Regular Member 帖子: 143 加入日期: 12-2-21 最近的帖子
Hi,

How to convert soap webservices to json webservices.Please help me ASAP.

Thanks,
Raju
thumbnail
Raju oukanti,修改在9 年前。

RE: how to get response,request,themedisplay object in EntityServiceImpl cl

Regular Member 帖子: 143 加入日期: 12-2-21 最近的帖子
Hi,

In order to access service context and theme display object we can make entry like this in the service-config.wsdd file.

<parameter xmlns:tns="http://service.portal.liferay.com" qname="serviceContext" type="tns:ServiceContext"></parameter>
<parameter xmlns:tns="http://theme.portal.liferay.com" qname="themeDisplay" type="tns:ThemeDisplay"></parameter>


In the same way how we can get the request and response objects.Please help me how should access to the request and response objects.


Thanks,
Raju
thumbnail
Olaf Kock,修改在9 年前。

RE: how to get response,request,themedisplay object in EntityServiceImpl cl

Liferay Legend 帖子: 6403 加入日期: 08-9-23 最近的帖子
I don't understand what request/response you'd like to get access to: You're implementing a webservice. Do you need a HttpServletRequest or a PortletRequest? And what do you expect to find in it?
thumbnail
Raju oukanti,修改在9 年前。

RE: how to get response,request,themedisplay object in EntityServiceImpl cl

Regular Member 帖子: 143 加入日期: 12-2-21 最近的帖子
Hi,

Thanks Kock for giving quick replays for me. I want access the theme display ,action request and response objects in <Entity>ServiceImpl class.How should i access them and how should create those objects in the serviceImpl class.I want these objects to get user details,locale objects etc.How should i use HttpServletRequest or a PortletRequest in order to create action request and response objects in the <Entity>ServiceImpl class.Please help me ASAP.

Thanks,
Raju
thumbnail
David H Nebinger,修改在9 年前。

RE: how to get response,request,themedisplay object in EntityServiceImpl cl

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
Raju you're just wrong for trying to do it in the first place. There is absolutely nothing from any of these request objects or the theme display that you need during a service call.

The services are for retrieving data and updating data in the database. It is a completely separate concern from the handling of requests, rendering of responses or making decisions based upon the theme.

By mixing all of your concerns together you're not going to have proper separation on any of these elements on their own.

Olaf might not tell you you're on the wrong path, so let me say it for him: You're on the wrong path.
thumbnail
Raju oukanti,修改在9 年前。

RE: how to get response,request,themedisplay object in EntityServiceImpl cl

Regular Member 帖子: 143 加入日期: 12-2-21 最近的帖子
Hi David,

Thanks for your suggestion.Actually i am implementing webservices for my service call.In performing the service call functionality i need action request and response objects,theme display objects.I am implementing that webservice call in <Entity>ServiceImpl class.From this class how should i get these objects.If not possible how should i handle the functionality which are doing by these objects(action request and response,theme display).Please suggest any alternate solution for me ASAP.

Thanks,
Raju
thumbnail
David H Nebinger,修改在9 年前。

RE: how to get response,request,themedisplay object in EntityServiceImpl cl

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
Then your implementation is all wrong. All of the Liferay remote services, the ones that respond via soap or rest, none of them need or use the request objects, the response objects, the theme display...

And even if you're going to build your own web service tier by implementing serveResource() methods, you still separate the concerns of extracting necessary data from the objects and passing them as parameters (either directly or via the service context object).

The fact that you're trying to implement something that no one else has, doesn't that give you pause? Doesn't that make you ask yourself if you're not approaching things in the correct fashion?
thumbnail
Raju oukanti,修改在9 年前。

RE: how to get response,request,themedisplay object in EntityServiceImpl cl

Regular Member 帖子: 143 加入日期: 12-2-21 最近的帖子
Hi David,

Thanks a lot for giving quick replay.I will agreed with your suggestion.But how should i implement with via the service context object.Please can you give some guidelines regarding service context object.Please help me.

Thanks,
Raju
thumbnail
Raju oukanti,修改在9 年前。

RE: how to get response,request,themedisplay object in EntityServiceImpl cl

Regular Member 帖子: 143 加入日期: 12-2-21 最近的帖子
Hi David,

I got it.I seen the api of service context class.Thanks for your help.

Thanks,
Raju
thumbnail
Raju oukanti,修改在9 年前。

RE: how to get response,request,themedisplay object in EntityServiceImpl cl

Regular Member 帖子: 143 加入日期: 12-2-21 最近的帖子
Hi David,

When i retrieving the company id from service context object it is giving zero.Please help me how should i get the required data from the service context object.
And also when i am adding user through UserServiceUtil class it is giving "java.lang.SecurityException: Authenticated access required" error.How to overcome from this issue.

Please help me ASAP.
Thanks,
Raju
thumbnail
Olaf Kock,修改在9 年前。

RE: how to get response,request,themedisplay object in EntityServiceImpl cl

Liferay Legend 帖子: 6403 加入日期: 08-9-23 最近的帖子
You are on the wrong track. ServiceContext contains only what you put in it in the first place. It doesn't magically manifest all the data. Especially not when accessed through SOAP. David already told you that your approach is wrong, I tried to do the same by asking rhetoric questions (that you never answered).

Please describe the (business) problem that you want to solve. Not the technical problem (because that's a wrong solution for whatever problem).
thumbnail
Raju oukanti,修改在9 年前。

RE: how to get response,request,themedisplay object in EntityServiceImpl cl

Regular Member 帖子: 143 加入日期: 12-2-21 最近的帖子
Hi Kock,

I agreed with your suggestion.My requirement is i created my service as web services.For this i created class as follows as

<Entity>ServiceImpl(String orgName,String orgType,ServiceContext serviceContext){
OrganizationCreation.createOrganization(orgName,orgType,serviceContext);

}
public class OrganizationCreation{
public static void createOrganization(String orgName,String orgType,ServiceContext serviceContext){
//when i am calling OrganizationLocalServiceUtil.addOrganization(all required parameters) it is giving "java.lang.SecurityException: Authenticated access required" ;
}
}


According to my requirement i have to create an organization from the above web service call(<Entity>ServiceImpl(String orgName,String orgType,ServiceContext serviceContext)), but i cant due of the "java.lang.SecurityException: Authenticated access required" error.How should i overcome form this error and how should i create an organization through the created web service call.Please help me ASAP.

Thanks,
Raju
thumbnail
Olaf Kock,修改在9 年前。

RE: how to get response,request,themedisplay object in EntityServiceImpl cl

Liferay Legend 帖子: 6403 加入日期: 08-9-23 最近的帖子
As the security exception suggests: You'll have to call the webservice with a user's identity - e.g. BASIC authentication (sadly the only option AFAIK). All of Liferay's remote services require this authenticated access. They'll check permission based on the user's identity and then forward to the actual implementation in the *LocalService.

If you use "code" formatting rather than "quote" formatting, your code actually would look like code and be properly indented, easier to read.

I don't recommend having a ServiceContext in the interface of a webservice - rather have explicit parameters. ServiceContext is a holder for random individual parameters, effectively hiding what's required. Plus it needs to be serialized through the WS layer, which is another hassle. Determine what parameter you need in your service and replace the serviceContext parameter with them. But first and foremost: Authenticate your WS calls.
thumbnail
Raju oukanti,修改在9 年前。

RE: how to get response,request,themedisplay object in EntityServiceImpl cl

Regular Member 帖子: 143 加入日期: 12-2-21 最近的帖子
Hi Kock,

I agreed your suggestion.How should i do authentication and create an organization through web services.Please help me .

Thanks,
Raju
Ranjit Reval,修改在8 年前。

RE: how to get response,request,themedisplay object in EntityServiceImpl cl

New Member 帖子: 13 加入日期: 14-6-25 最近的帖子
How can I get themedisplay object in XYZServiceImpl ?
My scenarios is like I am trying to fetch all document using web services but I need to WebDAV URL for each document using which user can download document.

I have done some googling for the same and I found following methods which provides the webdav and thumbnail but for that I required themedisplay object.
1.) DLUtil.getWebDavURL(themeDisplay, folder, fileEntry);
2.) DLUtil.getThumbnailSrc(fileEntry, dlFileShortcut, themeDisplay)

Also I need to check permission for each folder and document to get permission checker object I need themedisplay object.

Can anyone help me to get out from this as soon as possible OR any alternate solution to get this object?

Please find below stackoverflow link for the same quesion.
http://stackoverflow.com/questions/32087573/how-can-i-get-themedisplay-object-in-xyzserviceimpl?noredirect=1#comment52072877_32087573
vipul gupta,修改在7 年前。

RE: how to get response,request,themedisplay object in EntityServiceImpl cl

New Member 帖子: 4 加入日期: 15-8-11 最近的帖子
how can I get session information of all logged in portal users inside a web service ?
thumbnail
David H Nebinger,修改在7 年前。

RE: how to get response,request,themedisplay object in EntityServiceImpl cl

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
You can't, not reliably.

if you enable live users, you can see users who are logged into a node. But if you're in a cluster those lists are not shared.

Also it is just a list of current sessions; people who have closed their browsers, went out of cell range or clicked on a link that went to a different site - basically they are not online but the server is waiting for their sessions to expire.







Come meet me at the LSNA!