R – asp.net web reference for reporting services

asp.netreporting-servicesweb services

I'm trying to access a reporting services site using the provided web services, from a basic asp.net website.

I've added the reference to reportservice2005.asmx on the reporting server, but I'm having problems getting intellisense working and for anything to run/compile.

From examples, I've seen people create an instance of the service with the following: "ReportingService rService = new ReportingService();" – where ReportingService is the name of the web reference, created in visual studio. I've amended this to vb.net code but get errors.. it's as if ReportingService is the namespace and I need to choose one of the classes inside.

So I tried "dim rService as ReportingService.ReportingService2005"

Is this correct? it seems to work with intellisense, however when I then try to run the code, I get the compilation error: "Type 'ReportingService.ReportingService2005' is not defined."

Any ideas?
Cheers! 😀

Best Answer

While adding the web reference you surely asked to enter the reference name.. first import the reference into your class file. And try creating the instacnes.. this should work..

Included Sample Code

using WindowsApplication1.ConfigWS;

ConfigWS is the webreference name i have created. And it has to imported to the project and it must be prefixed with current namespace name (if available).

check the below sample code used to instantiate the webmethod (CreateServer) defined in ConfigWS webservice.

private void Form1_Load(object sender, EventArgs e)
{
        WindowsApplication1.ConfigWS.CConfigurationManagerBCWS objWs = new CConfigurationManagerBCWS();
        CReqMsgCreateServer objCreateServer=new CReqMsgCreateServer();
        objCreateServer.objServerConfig =new CServerConfig();
        objCreateServer.objServerConfig.ServerName="****";
        objCreateServer.objServerConfigVOBC.LevelFlag ="---";
        CResMsgCreateServer objRes = objWs.CreateServer(objCreateServer);    
}