This is a migrated thread and some comments may be shown as answers.

LightSwitch Report Viewer- error while trying to serialize parameter

3 Answers 97 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Cliff McManus
Top achievements
Rank 1
Cliff McManus asked on 17 Apr 2015, 03:41 AM

Hey smart folks I need your help again.

I have a LightSwitch Application (in browser Silverlight app) that has a Telerik Silverlight report viewer implemented.

I also have a second solution that implements the Reports and WCF Service.  I have successfully deployed both the LightSwitch application and the WCF service to two separate websites on Azure.

The application works fine but when I attempt to display the reports in the report viewer I get the following error.

The error occurs after I have set all of the report parameters on the LightSwitch side in the report’s renderbegin event handler.

Exception message
System.ServiceModel.CommunicationException :

There was an error while trying to serialize parameter Telerik.ReportService:parameters.

The InnerException message was 'Type 'System.Int32[]' with data contract name
'ArrayOfint:http://schemas.microsoft.com/2003/10/Serialization/Arrays' is not expected.


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.'.  Please see InnerException for more details.

   at System.ServiceModel.Channels.Remoting.RealProxy.Invoke(Object[] args)
   at proxy_3.BeginRenderAndCache(String , String , NameValueDictionary , NameValueDictionary , AsyncCallback , Object )
   at Telerik.Reporting.Service.SilverlightClient.ReportServiceClient.OnBeginRenderAndCache(Object[] invalues, AsyncCallback asyncCallback, Object state)
   at System.ServiceModel.ClientBase`1.InvokeAsync(BeginOperationDelegate beginOperationDelegate, Object[] inValues, EndOperationDelegate endOperationDelegate, SendOrPostCallback operationCompletedCallback, Object
userState)

 
The report needs the following parameters which are set in the LightSwitch application
     StudioId         Int32
     StudentIds     Int32[] //* Note this is an Int array*
     SortCriteria1  string
     SortCriteria2  string
     SortCriteria3  string
     DisplayName string

What is this telling me and what do I need to do to correct the problem.

Thanks again
Cliff
Code Follows

 The WCF service is basically an empty shell
IReportService like this
namespace WcfReportingService1
{
    [ServiceContract]
    public interface IReportService
    { 
    }
}

ReportService.svc like this
namespace WcfReportingService1
{
    public class ReportService :  IReportService
    { 
    }
}

WebConfig like this
<?xml version="1.0"?>
 
<configuration>
 
  <connectionStrings>
    <!--Connection String for Production - Azure-->
    <add name="Studio_Manager_ConnectionString"
        connectionString="Data Source=xxxxxxx.database.windows.net; Initial Catalog=xxxxxxxxxxx; User Id=xxxxxx;Password=xxxxxxxxx "
        providerName="System.Data.SqlClient" />
  </connectionStrings>
 
  <system.web>
    <compilation debug="true" strict="false" explicit="true" targetFramework="4.5" />
    <customErrors mode="Off"/>
  </system.web>
 
  <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
    <services>
      <service
              name="Telerik.Reporting.Service.ReportService"
              behaviorConfiguration="ReportServiceBehavior">
        <endpoint
               address=""
               binding="basicHttpBinding"
               contract="Telerik.Reporting.Service.IReportService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint
                address="resources"
                binding="webHttpBinding"
                behaviorConfiguration="WebBehavior"
                contract="Telerik.Reporting.Service.IResourceService"/>
        <endpoint
                address="mex"
                binding="mexHttpBinding"
                contract="IMetadataExchange" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="ReportServiceBehavior">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="WebBehavior">
          <webHttp />
        </behavior>
      </endpointBehaviors>
    </behaviors>
  </system.serviceModel>
 
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
 
</configuration>// Any help at all will be greatly appreciated.

// Any help at all will be greatly appreciated.

 

3 Answers, 1 is accepted

Sort by
0
Cliff McManus
Top achievements
Rank 1
answered on 20 Apr 2015, 07:17 PM

I checked using fiddler and it appears I am not getting anything back from telerik Reporting.

Do I need to add int array data type to the service?

0
Accepted
Stef
Telerik team
answered on 21 Apr 2015, 08:17 AM
Hello Cliff,

Please test if the deployed application works in general by testing with a simple report pulling data directly from the database via SqlDataSource (without parameters).

If the report is displayed correctly, check the problematic report's settings. The used data retrieval method and its arguments. Each argument must be linked to a report parameter of the corresponding type. In the case of the StudentIds argument use a multivalue report parameter, where the parameters processing value will be evaluated as an array of objects and you will need to cast this value in the data retrieval method.
Details how to use parameterized data retrieval methods are available in Using Parameters with the ObjectDataSource Component and ObjectDataSource Wizard.


I hope the provided information is helpful.

Regards,
Stef
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Cliff McManus
Top achievements
Rank 1
answered on 26 Apr 2015, 08:48 PM

I figured it out.

Telerik and WCF communicate expecting standard data types, Int, string etc. Passing an array of Int was something that the sterilizer did not know about.  To save my sanity I changed to pass a comma delimited string to the report with the Ints that I needed. This worked like a charm.
Thanks for pointing me in the right direction.Cliff

Tags
General Discussions
Asked by
Cliff McManus
Top achievements
Rank 1
Answers by
Cliff McManus
Top achievements
Rank 1
Stef
Telerik team
Share this question
or