you might want to have a look at this modifed version of the get implementations in the serviceclientbase.cs
I noticed that in the get the request do not push down the requestdto, so the call to
(webrequestutils.cs)
public static Type GetErrorResponseDtoType(object request)
{
var hasResponseStatus = typeof(TResponse) is IHasResponseStatus
|| typeof(TResponse).GetPropertyInfo(“ResponseStatus”) != null;
This is kind of unreadable. Can you provide a concrete example of what the issue is? i.e. what combination Request/Response DTO and service client method has what issue?
Consider this test calling the same operation that raises and exception in its implementation:
If I call it with get method in WebServiceException.ResponseDto there is ServiceStack.ErrorResopnse ,
if I do a POST , WebServiceException.ResponseDto contains the OperationResponse
Note that the responsedto does not implement : IHasResponseStatus (since it cannot, because we implemented a custom response status with different properties, if I do implement IHasResponseStatus the issue disappear)
[Test]
public void TestMethod1()
{
var f = new WebApplication1.ServiceModel.Hello();
f.Name = "ciao";
var t = new JsonServiceClient("http://localhost:26809/");
try
{
var resp = t.Get(f);
}
catch (WebServiceException ex)
{
**//returns ServiceStack.ErrorResopnse**
Debug.WriteLine(ex.ResponseDto.GetType().Name);
}
try {
var resp = t.Post(f);
}
catch (WebServiceException ex)
{
**//returns HelloResponse**
Debug.WriteLine(ex.ResponseDto.GetType().Name);
}
}
As I said, in the previous post, the reason is that when calling a Get the requestdto is not send down to the “shared”
For this reason when the request fails , the code enters into HandleResponseException
with a null request.
For this reason WebRequestUtils.GetErrorResponseDtoType(request); fails to resolve HelloResponse as the response dto for Hello … and so ServiceStack.ErrorResopnse is returned
Hope I explained the situation better now.
best reagards
enrico
I’ve added but had to revert this as it was a breaking change that broke a lot of tests since passing a Request DTO re-extended the query string with additional params from the request DTO.
Any other refactored solution to support this is too disruptive at this time so I’m going to leave the current behavior.