I am trying to see if I can build a COM component in C# (.NET 4) which I can use from a VB5 program (cue derisive remarks) to access a web service. Following all the instructions I have been able to find on MSDN and CodeProject as follows:
I have written the following:
[Guid("7A715F02-D349-45DC-B0AE-9925FD3B943C")]
public interface ARCOM_Interface
{
[DispId(1)]
string GetServiceResponse();
}
[Guid("5130F041-619E-41F9-84B6-8332642228F6")
, InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface ARCOM_Events
{
}
[Guid("0A77754F-34CF-4E0E-AAC2-85FD686758E0")
, ClassInterface(ClassInterfaceType.None)
, ComSourceInterfaces(typeof(ARCOM_Events))]
[ComVisible(true)]
public class ARCOM_Class : ARCOM_Interface
{
public string GetServiceResponse()
{
string response = string.Empty;
ARWebService.ARWebService svc = new ARWebService.ARWebService();
response = svc.PingMeBack();
return response;
}
}
The Assembly in question is signed with a strong name and the output is registered for COM Interop. After building, I have applied RegAsm to it and generated a type library with tlbexp.exe.
In VB6, when I open the list of references from the Project properties, I can find the assembly in the list, and I can check it. I can even do the following in the VB6 code:
Private Sub HitWebService()
Dim arcom As ARCOMObject.ARCOM_Class
arcom. <== Intellisense doesn't sense anything!
End Sub
The Intellisense sees the ARCOMObject and the class, but nothing that is within the ARCOM_Class itself (except for the usual "GetType", "Equals" and other generic Object methods/properties). Most specifically, it does not seem to see the GetServiceResponse() method, so I can't call it.
What am I leaving out?