1

I'm using ReportExecution proxy class in my program. When I try to compile it, I get 58 ambiguity errors in generated file. This is the sample error output:

Error   1   The namespace '<global namespace>' already contains a definition for 'LogonUserCompletedEventHandler'   
Error   2   The namespace '<global namespace>' already contains a definition for 'LogoffCompletedEventHandler'  
Error   4   Ambiguity between 'ServerInfoHeader.reportServerVersionNumberField' and 'ServerInfoHeader.reportServerVersionNumberField'   
Error   5   Ambiguity between 'ServerInfoHeader.reportServerEditionField' and 'ServerInfoHeader.reportServerEditionField'   
Error   6   Ambiguity between 'ServerInfoHeader.reportServerEditionField' and 'ServerInfoHeader.reportServerEditionField'   

Should I change automatically generated file to fix that? Or maybe the error is somewhere else?

Thanks in advance.

EDIT: I have dealt with most of the ambiguity errors, they were because I unnecessarily added web references instead of only using the proxy classes. Now, however, I still get 2 errors:

Error   1   The namespace '<global namespace>' already contains a definition for 'LogonUserCompletedEventHandler'   
Error   2   The namespace '<global namespace>' already contains a definition for 'LogoffCompletedEventHandler'  
kyooryu
  • 1,469
  • 3
  • 23
  • 48
  • Which method are you using to generate the proxy class? The Service should be at: http:///reportserver/reportexecution2005.asmx for execution. If you are using more than one proxy, Execution and Service in the same class you will have issues. MSDN on proxy creation: http://msdn.microsoft.com/en-us/library/ms155134(v=sql.105).aspx Other thread similar to this: http://stackoverflow.com/questions/14479144/programmatically-export-ssrs-report-from-sharepoint-using-reportservice2010-asmx/14492191#14492191 – djangojazz May 09 '13 at 21:18
  • I am using 2 proxies, ReportExecution2005 and ReportService2010. I generated the classes using wsdl command. – kyooryu May 09 '13 at 21:21
  • You should try to remove one of the references and try only the ReportExecution2005 first. If you have a property or method like 'LogonUserCompletedEventHandler' being handled it does not know the explicit use so you would need something like (proxy2005ex).LogonUserCompletedEventHandler or (proxy2010).LogonUserCompletedEventhandler. That is my guess anyways. Unless you show more code of what you are doing, just an error message is hard to guess at. Most commonly it means the method exists in two places (namespaces) by the same name and the code does not know which one you want. – djangojazz May 09 '13 at 22:27
  • I know, but what is weird is that it exists in auto-generated file, and that is what bugs me... I have no reference to those methods in my own code. – kyooryu May 10 '13 at 12:00

2 Answers2

1

I also received the same '<global namespace>' error because I had included the proxy code generated by wsdl.exe in the visual studio project, but also had left the actual source WSDL file in the project's directory structure.

ASP.NET appears to auto-compile this WSDL file into another copy of proxy code the site when it's loaded.

This doesn't give a compile time error in VS, but will cause the site to fail with error's 1 and 2 described in the question.

Removing the WSDL file from the directory structure corrects the problem.

StingyJack
  • 19,041
  • 10
  • 63
  • 122
0

Well, it seems that wsdl proxies have to be generated with distinct namespaces if you use more than one. Adding /namespace parameter solved the problem.

kyooryu
  • 1,469
  • 3
  • 23
  • 48