Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Tim Cardwell
Setting the HTTP Response in a liferay service
September 13, 2012 12:00 PM
Answer

Tim Cardwell

Rank: Junior Member

Posts: 27

Join Date: July 19, 2012

Recent Posts

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
September 13, 2012 12:27 PM
Answer

Andew Jardine

Rank: Expert

Posts: 260

Join Date: December 22, 2010

Recent Posts

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
September 13, 2012 12:37 PM
Answer

Tim Cardwell

Rank: Junior Member

Posts: 27

Join Date: July 19, 2012

Recent Posts

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
May 16, 2013 11:33 PM
Answer

Charly Wu

Rank: New Member

Posts: 4

Join Date: April 10, 2013

Recent Posts

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
November 15, 2013 2:50 AM
Answer

Nicolas Forney

Rank: Junior Member

Posts: 78

Join Date: May 23, 2011

Recent Posts

Anyone found a solution to set the HTTP response code ?