views:

656

answers:

2

Hi there,

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! :D

A: 

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);    
}

Cheers

Ramesh Vel

Ramesh Vel
Thanks Ramesh, sorry to be a pain but can you be more specific? I add the web reference with VS by right-clicking my project, and choosing 'add web reference' - then I provide the url and give it a name. That name appears in the project tree.Following this, should I require an 'imports' statement at the top of my .aspx.vb file? Intellisense is happy for me to do this, although it requires my project name prefixed (i.e. imports project.reportingservice' - this still failed at runtime with type not defined. :(
Tabloo Quijico
yes, you need to import manually that particular namespace in your app.. And its not mandatory that your project name to be prefixed. On typing imports itself, VS will fetch that webreference name in the list. And pls clarify me, its only throwing exception in run time or compile time..??
Ramesh Vel
Thanks, yes it's at runtime, the intellisense seems to work fine but I get the type not defined error when running. I tried using wsdl.exe to create a .vb proxy class - inserting that into App_Code seems to fix the issue - but if you can give any pointers on why I might have the problems I do using the direct web reference I would appreciate them. :)
Tabloo Quijico
I have included the sample code in my answer, pls check out
Ramesh Vel
Hi Ramesh, still the same problem.. I'm not sure if it's part of a wider issue with my freshly installed VS2008 that won't even compile the default aspx page with no changes! (all my old sites work fine though) I might just stick with using wsdl.exe :(
Tabloo Quijico
Fixed it! It just seems to have been yet another security issue involving UNC paths.. (though I'm not sure exactly how or why).I moved the project to a local folder in my VS environment and things are running as expected. Thank you for all the help though!
Tabloo Quijico
A: 

Have you added the assembly in your config?

I have the following in my assemblies section :

<add assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/ And in the httpHandlers I have this :

<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false" />

Jon Spokes
Thanks Jon, but I'm not using the report viewer control
Tabloo Quijico