掲示板

Setting the HTTP Response in a liferay service

11年前 に Tim Cardwell によって更新されました。

Setting the HTTP Response in a liferay service

Junior Member 投稿: 29 参加年月日: 12/07/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
thumbnail
11年前 に Andew Jardine によって更新されました。

RE: Setting the HTTP Response in a liferay service

Liferay Legend 投稿: 2416 参加年月日: 10/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?
11年前 に Tim Cardwell によって更新されました。

RE: Setting the HTTP Response in a liferay service

Junior Member 投稿: 29 参加年月日: 12/07/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...
thumbnail
10年前 に Charly Wu によって更新されました。

RE: Setting the HTTP Response in a liferay service

New Member 投稿: 4 参加年月日: 13/04/11 最新の投稿
I'm also interested in returning http status other than 200 when exception occurs.
Hi Tim, do you have any solution?
thumbnail
10年前 に Nicolas Forney によって更新されました。

RE: Setting the HTTP Response in a liferay service

Junior Member 投稿: 78 参加年月日: 11/05/23 最新の投稿
Anyone found a solution to set the HTTP response code ?