none
WCF Service Method Return Type Error RRS feed

  • Question

  • Hi,

    I have a WCF service. I am calling it from the client as follows:

    ServiceReference1.SSRSServiceClient ssrsClient = new ServiceReference1.SSRSServiceClient();
                SSRSResponse ssrsReportResponse = ssrsClient.RunReport(DateTime.Parse("2016/01/01"));

    However, I get this error:

    Cannot implicitly convert type 'WindowsFormsApplication2.ServiceReference1.SSRSResponse' to 'MyTest.SSRSResponse'

    SSRSResponse is the return type in MyTest

    It is also the return type in the WCF service as below...

    public SSRSResponse RunReport(DateTime period)
            {
                return SSRSFactory.GetInstance().BuildReport(period);
            }

    Any idea what I am missing?

    Thanks

    Friday, August 5, 2016 3:47 PM

Answers

  • Hi obrienkev,

    >> Cannot implicitly convert type 'WindowsFormsApplication2.ServiceReference1.SSRSResponse' to 'MyTest.SSRSResponse'

    Based on this error message, it seems you define a new SSRSResponse in your client, am I right? For types to communicate between client and service, we could use data contract, and there is no need to define SSRSResponse in your client side. You could delete definition of MyTest.SSRSResponse in client or use WindowsFormsApplication2.ServiceReference1.SSRSResponse explicit in your client side.
    Something like below:

    ServiceReference1.SSRSServiceClient ssrsClient = new ServiceReference1.SSRSServiceClient();
    ServiceReference1.SSRSResponse ssrsReportResponse = ssrsClient.RunReport(DateTime.Parse("2016/01/01"));

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Monday, August 8, 2016 11:13 AM