论坛

主页 » Liferay Portal » English » 3. Development

组合视图 统一视图 树状图
讨论主题 [ 上一个 | 下一个 ]
toggle
Tim Cardwell
Setting the HTTP Response in a liferay service
2012年9月13日 下午12:00
答复

Tim Cardwell

等级: Junior Member

帖子: 27

加入日期: 2012年7月19日

最近的帖子

I have a liferay service, and a .NET app that calls this service.

The .NET app will only continue processing it's code if the HttpResponseStatus from the liferay service call is OK. However, lets say my service needs to manually set an http response if an exception occurs. Is there a way to do this in liferay? Do I need to pass the request into my service or something along those lines?

Thanks,
-Tim
Andew Jardine
RE: Setting the HTTP Response in a liferay service
2012年9月13日 下午12:27
答复

Andew Jardine

等级: Expert

帖子: 479

加入日期: 2010年12月22日

最近的帖子

Hey Tim,

It's been a while since I've had to do anything with services but if memory serves me, you should be able to throw an exception that get returned as a SOAP Fault to the caller. I am pretty sure that Faults, although representing errors, do use a HTTP Status code of 200 OK. Have you tried that avenue yet?
Tim Cardwell
RE: Setting the HTTP Response in a liferay service
2012年9月13日 下午12:37
答复

Tim Cardwell

等级: Junior Member

帖子: 27

加入日期: 2012年7月19日

最近的帖子

Well my service is catching a few types of exceptions, including PortalExceptions. The problem is I don't want it to return with status code 200, I want it to return with an error status code, but even when I trip the portal exception, it still returns with status code 200...
Charly Wu
RE: Setting the HTTP Response in a liferay service
2013年5月16日 下午11:33
答复

Charly Wu

等级: New Member

帖子: 4

加入日期: 2013年4月10日

最近的帖子

I'm also interested in returning http status other than 200 when exception occurs.
Hi Tim, do you have any solution?
Nicolas Forney
RE: Setting the HTTP Response in a liferay service
2013年11月15日 上午2:50
答复

Nicolas Forney

等级: Junior Member

帖子: 78

加入日期: 2011年5月23日

最近的帖子

Anyone found a solution to set the HTTP response code ?