3

I have a C# class library project in Visual Studio 2010 to which I have added a Web Reference to the WSDL pointing it to my web service.

I can see that the proxies created in Visual Studio are fine. (see below screenshot)

enter image description here

Goal: My final goal is to be able to package and take these proxies to VBA (Excel 2010) and be able to call Web methods there.

I generated a TLB out of this DLL by enabling 'Make COM visible' and 'Register for COM Interop'.

Problem: When I open the TLB in Oleviewer, I see that the properties and methods are getting lost on the way (see below screenshots)

enter image description here

enter image description here

Environment:

  • Visual Studio 2010 Professional (Target platform set to x86)
  • Windows 7 x64
  • Office 2010 32-bit
  • .NET 4.0

Can someone help me know if I am missing something in generating a valid TLB from a DLL?

peakit
  • 28,597
  • 27
  • 63
  • 80
  • The is the normal outcome of having the interface attributed as [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]. You'd need InterfaceIsDual instead. How this could work for a web service is mysterious to me. – Hans Passant May 16 '12 at 08:49
  • @HansPassant, I changed it to InterfaceIsDual but still I am seeing that the properties and methods are missing in TLB and it still shows IDispatch in the inherited interface in OleViewer. Please note that the stub 'auditInfo' shown in screenshots in not written by me in VS 2010, rather it is generated automatically on adding a web reference to the WSDL. So, not sure if I could change the behavior of a generated stub. – peakit May 16 '12 at 09:10
  • It is completely unclear to me how you got from WSDL to the screen shot. Are you editing the auto-generated proxy code by hand to add the attributes? You don't want to do that of course. Given the likelihood of this just not working, why don't you give it a try to see if it works at all? Write a little VBA to test it, making late bound calls isn't a problem in VBA. – Hans Passant May 16 '12 at 09:32
  • @HansPassant, I added `Web Reference` to the WSDL by right-clicking on the project -> Add Service Reference -> Add Web Reference and entering the URL to the wsdl. And also I am able to call web methods accepting primitive types but facing issues while calling methods accepting the complex types (as the stubs have those properties missing) – peakit May 16 '12 at 10:39
  • @HansPassant, would appreciate if you could help me know the right approach in consuming a SOAP based web service in `Excel 2010`. – peakit May 16 '12 at 18:04
  • I am still looking for an answer to this question. Anyone? – peakit Jun 09 '12 at 02:35

0 Answers0