Hello,
At the moment, I'm setting up a reporting WCF service. I'll be using it for generating invoices. Right now, I can pass an invoicenumber as report parameter and it generates the correct invoice.
This problem is however, I'd like to generate one document with multiple invoices. For this, I think I need to pass multiple values for the reportparameter "OrderNumbers".
The first thing I came up with was the following:
reportService is a ReportServiceClient.
When I try this, I receive the following error message:
"Type 'System.String[]' with data contract name 'ArrayOfstring:http://schemas.microsoft.com/2003/10/Serialization/Arrays' is not expected. Consider using a DataContractResolver or add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer."
My question is, is it possible to add a known type to the default datacontractserializer and how can this be done?
I suppose I have to create an instance of the ReportServiceBase class, so I can add a known type here somehow.
Or is there any other way to pass multiple values for this parameter?
With kind regards.
At the moment, I'm setting up a reporting WCF service. I'll be using it for generating invoices. Right now, I can pass an invoicenumber as report parameter and it generates the correct invoice.
This problem is however, I'd like to generate one document with multiple invoices. For this, I think I need to pass multiple values for the reportparameter "OrderNumbers".
The first thing I came up with was the following:
var ordernumbers = new [] { "0123456", "9876543" }; var parameters = new Dictionary<string, object>(){{"OrderNumbers",ordernumbers}}; var docxReport = reportService.Render("DOCX", "FULL name of report", new Dictionary<string, object>(),parameters);
reportService is a ReportServiceClient.
When I try this, I receive the following error message:
"Type 'System.String[]' with data contract name 'ArrayOfstring:http://schemas.microsoft.com/2003/10/Serialization/Arrays' is not expected. Consider using a DataContractResolver or add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer."
My question is, is it possible to add a known type to the default datacontractserializer and how can this be done?
I suppose I have to create an instance of the ReportServiceBase class, so I can add a known type here somehow.
Or is there any other way to pass multiple values for this parameter?
With kind regards.