Page 1 of 1

Jiwa 7.184 API Compile Error

PostPosted: Mon Aug 07, 2017 3:55 pm
by SBarnes
Hi Mike,

The following section of the API generated code is producing an error, it's the HttpResult that the compiler doesn't like, for the time being I have simply commented it out.


Code: Select all
    [Route("/Reports/{ReportID}/PDF/Download", "POST")]
    [ApiResponse(Description = "Not authenticated", StatusCode = 401)]
    [ApiResponse(Description = "No report with the ReportID. provided was found", StatusCode = 404)]
    [ApiResponse(Description = "Not authorised", StatusCode = 403)]
    [ApiResponse(Description = "OK", StatusCode = 200)]
    public partial class ReportsPDFPOSTRequest
        : IReturn<HttpResult>
    {
        public ReportsPDFPOSTRequest()
        {
            ReportParameters = new List<ReportParameter> { };
        }

        public virtual string ReportID { get; set; }
        public virtual List<ReportParameter> ReportParameters { get; set; }
    }

Re: Jiwa 7.184 API Compile Error  Topic is solved

PostPosted: Mon Aug 07, 2017 4:19 pm
by Mike.Sheen
Thanks - it needs a reference to the ServiceStack.Server because that's where HttpResult is defined - which is silly because clients should not need a reference to anything other than the ServiceStack.Client.

I thought I was doing something wrong, but apparently returning HttpResult is the recommended way to return files with ServiceStack... I'll look a bit more closely at it and ask the question on the ServiceStack forums.

Re: Jiwa 7.184 API Compile Error

PostPosted: Mon Aug 07, 2017 5:07 pm
by SBarnes
Hi Mike,

Yes that fixes it, I have used a Get call returning an object with the request DTO having no IReturn and then using System.Net.HttpWebResponse and GetResponseStream to pull through a pdf and it works in the client in another project.

But I do agree with your comment on what's in what package, you need ServiceStack.Server for the app settings as well in a client.

Thanks.

Re: Jiwa 7.184 API Compile Error

PostPosted: Fri Aug 11, 2017 3:26 pm
by Mike.Sheen
Fixed in 7.00.185.00 - DEV-6180 - turns out just needed to define the return result as IHttpResult, instead of HttpResult. IHttpResult is defined in ServiceStack.Interfaces assembly - so no need for clients to reference the ServiceStack nuget package anymore.