Asked originally on StackOverflow at http://stackoverflow.com/questions/34187789/possible-to-read-response-body-of-a-ria-service-call, I was told I might find more help here.
We're somewhere around round 20 in the epic battle between RIA services and corporate firewall. Since the requests occasionally contain "PHP injection attacks" against our IIS-hosted .NET RIA server, I wanted to be a bit proactive in separating the actual program errors from just whenever the firewall has performed some arbitrary and invalid denial.
Is it possible to get the actual response content of the message returned via a RIA service call when the call returns an error?
My basic handling call is as such:
protected void AfterSubmitChanges(SubmitOperation so)
Somewhere in there can I get the raw response body, which I'd then be able to parse against the standard blocked-by-firewall page?
There is no specific functionality to get the returned text built into OpenRiaServices.
To simplify matters, can you not just specify what your firewall should return in case of a block?
The most simple solution would be if you got your firewall to return a correct (serialized) DomainException DomainOperationException (you should be able to use fiddler to capture the correct resoponse) or a separate html status code.
Since the communication is WCF you should be able to extend it keep the request if you need it.
I cannot however help you with that part since I am no WCF expert.
In order to do so you should be able to either subclass the WebDomainClient (which performs the communication) to add the specific WCF logic there or to modify the ChannelFactory used by your DomainClient.
You should be able to access the channelfactory from within your *DomainContext classes by using code similar to ((WebDomainClient)DomainClient).ChannelFactory
To communicate the type of error I would just make sure to create an Exception with enough information to identify the firewall violation from normal errors.