COM interop to unmanaged OO COBOL component returns 0x8002003

I am receiving 0x8002003 COM exception when I try to access a public property in an unmanaged COM component written in OO COBOL (Fujitsu NetCOBOL - not their DotNET product. NetCOBOL is a full OO implementation and creates COM components that function correctly. I have dropped them on ASP pages as well as used them on the Windows desktop)

The component has a property defined as 8192 bytes (for compatibility with COM BString). I need to set this property, invoke a method called "FIB" (Fill in the blanks), then access the property to see what happened.

I'm using C# Express so I don't have the SDK tools like TLBIMP.exe.

Fortunately, I don't seem to need them as the IDE has generated an interop Assembly for me and when I look at this with the Object Browser I can see that it has the interfaces and property I require.

I think I am missing something fairly obvious, probably due to my inexperience with C#. I would therefore be extremely grateful if someone could have a look at what I've done and suggest improvements...:-)

For example... am I instantiating the COM object correctly (It returns a reference OK but maybe it's the wrong reference )

When I pass the 8192 bytes to the set_INTERFACEBLOCK method The IDE shows the parameter list for the method as (ref string __p1).

Can anyone explain what this __P1 means, and do I have to do anything about it (I tried everything I can think of and have spent 4 full days on this before posting here...)

Here's my C# code:

private void AccessNZPOCOMSvr()

{

try

{

NZPOCOMSVR.NZPOCOMSVRClass objAVS = new NZPOCOMSVR.NZPOCOMSVRClass();

string inIB = "59 Felton Mathew Ave Mt Wellington ";

inIB = inIB.PadRight(8192);

objAVS.set_INTERFACEBLOCK(ref inIB); //<-- it fails here

objAVS.FIB();

inIB = objAVS.get_INTERFACEBLOCK();

}

catch (COMException ex)

{

MessageBox.Show("Error: Problem with COM interfacing \n" +

ex.Message, "Interfacing to AVS engine code");

this.Close();

return;

}

The exception occurs on the set_INTERFACEBLOCK(ref inIB) statement. It says there is a Member not found, but the Object Browser shows that the interop Assembly generated from the TLB DOES have all the members referenced.

Here's a link to a screen shot of the Object Browser, showing the Namespace in question:

http://homepages.ihug.co.nz/~dashwood/dashwood/AVSProject.jpg

Any and all observations, suggestions, and, especially, solutions, will be very much appreciated

Pete.




Answer this question

COM interop to unmanaged OO COBOL component returns 0x8002003

  • Ruprect8696

    This problem has been resolved by the actions in my post above (However, I now have serious problems with the Interop layer and I'm posting those to another thread.)

    Note to anyone using Fujitsu NETCobol to build COM servers: DON'T USE FACTORY properties or methods.

    Pete.



  • yjm

    Thanks very much for your response (It's nice to know we are not alone when trying to resolve problems )

    I tried your suggestion (which seemed very reasonable to me), but it won't compile. I received the following error:

    "Property, indexer, or event 'INTERFACEBLOCK' is not supported by the language;
    try directly calling accessor methods 'NZPOCOMSVR.NZPOCOMSVRClass.get_INTERFACEBLOCK()' or
    'NZPOCOMSVR.NZPOCOMSVRClass.set_INTERFACEBLOCK(ref string)' "

    Sorry about the misquoted reference; you are correct and thanks.

    I went through the COBOL source of the COM component last night and noticed that the INTERFACEBLOCK property is in the Factory. I'm wondering if the accessor methods (which I didn't code; they are generated by COBOL...) may be outside the factory scope or something like that, rendering them invisible...(Although I thought the whole point of "factory" is to give GLOBAL scope and implement the "new" method which inherits from a Base class....again I may be misunderstanding here; the documentation is obtuse to say the least.)

    As I'm now getting pretty desperate to have this working, I'm going to try moving the block out of the factory as a property, and passing it instead as a parameter to each of the methods. I'll post to this thread if it succeeds.

    Meantime, can anyone shed any light on the mysterious __p1 that shows in the parameter string for the get_INTERFACEBLOCK method (see the screenshot at the link in the original mail above)

    Pete.



  • pblecha

    Your error code is missing a zero, I'm guessing it is really 0x80020003 (DISP_E_MEMBERNOTFOUND). That's probably caused by trying to use the property accessors (get_, set_) directly rather than by using the property directly. Try dropping "set_" and "get_", just INTERFACEBLOCK. And be careful with the capitalization.


  • COM interop to unmanaged OO COBOL component returns 0x8002003