Quantcast
Channel: Web API
Viewing all articles
Browse latest Browse all 4850

odata post method - send exception or message to client

$
0
0

Hi,

I am creating the odata web api and sending it to consumers to add new product.

While adding I will check if the product is already available then I have to send a message to client "Product already exist", also if any of the product property is null then I have to send like "x property should not be empty".

I am throwing exception like below.

responseMsg = new HttpResponseMessage()
                {
                    Content = new StringContent("<strong>Product Name property should not be empty.</strong>"
                 )
                };

                throw new HttpResponseException(responseMsg);

I am creating a container of my service in my client application and trying to consuming it to add new product. while doing testing am getting exception like below.

"The response to this POST request did not contain a 'location' header. That is not supported by this client." and am not getting the exact exception what am sending from my odata service.

Could you please anyone help me?

Suresh.


Viewing all articles
Browse latest Browse all 4850


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>