Fóruns

Início » Liferay Portal » English » 3. Development

Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
toggle
Tim Cardwell
Setting the HTTP Response in a liferay service
13 de Setembro de 2012 12:00
Resposta

Tim Cardwell

Ranking: Junior Member

Mensagens: 27

Data de entrada: 19 de Julho de 2012

Mensagens recentes

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
13 de Setembro de 2012 12:27
Resposta

Andew Jardine

Ranking: Regular Member

Mensagens: 161

Data de entrada: 22 de Dezembro de 2010

Mensagens recentes

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
13 de Setembro de 2012 12:37
Resposta

Tim Cardwell

Ranking: Junior Member

Mensagens: 27

Data de entrada: 19 de Julho de 2012

Mensagens recentes

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
16 de Maio de 2013 23:33
Resposta

Charly Wu

Ranking: New Member

Mensagens: 4

Data de entrada: 10 de Abril de 2013

Mensagens recentes

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
15 de Novembro de 2013 02:50
Resposta

Nicolas Forney

Ranking: Junior Member

Mensagens: 78

Data de entrada: 23 de Maio de 2011

Mensagens recentes

Anyone found a solution to set the HTTP response code ?