Consuming WCF in NAtive Code via Managed Code in Visual COBOL

Hi Chris,

The objective is to Consume the WCF Created in .NET 4.5 in Visual COBOL.(In Native Code VIA Managed Code)

To Do this I have followed following Steps:

1. Created an Managed Project in Visual COBOL, Added the Service Reference of .NET WCF. 

2. Selected the Property of Managed project as "Register for COM Interop". I am getting couple of Warning for the same. (Type Library exporter warning Generic Code may not exported to COM.)

3. Created an managed program to create an object of WCF Client Class and call the WCF methods.

3. Created an Native Project and added a Native Program.

4. Provide the Class Control section to point to the OLE object created by Managed Project.

5. Tried to Invoke the Managed Program of Managed Project from Native Program.

I am able to reach to the Managed Program (getting a display from there) But when managed program tries to call the WCF method , I am getting following error " Could not find the default endpoint element that references the contract "IService1". in the service model Client Configuration Section.

this might be because no configuration file was found for your application , or because no endpoint element matching this contract could be found in the client element".

Hope you are able to understand the problem, Let me know if you require any additional info. 

Let us know what can be possible problem in this approach.

Regards,

Charan

Parents
  • Our Service methods are accepting Value by Reference and Binary Long parameters.But I am getting error as "Wrong Parameter or Parameter not correct".

    Following is the scenario -

    When i tried to use the default Method of WCF GetData which accept Input parameter as (by value) Binary Long and returns string (By Ref). then it is working fine.

    But when i try to call other method Write it has 4 parameters :-

    1. 1stparm  pic 9(2). type - i/p

    2. 2ndparm pic 9(8) Comp-5. type -i/p

    3. 3rdparm pic x(150). type -i/p

    4. 4thparm pic 9. type -i/o

    This is method is defined in .NET WCF as iWrite - int32(By Ref String, Binary Long, By Ref String,By Ref String) it returns an int32 value.

    When i am trying to call this via Native --> Managed Class --> Class Method -->WCF

    My Managed class is register for Interop COM.

    when I am invoking it in Native code as after referring it using Class Control and then invoking it as

    invoke obj "Class method" using

                                                        1st parm

                                           by value 2ndparm  

                                                        3rdparm

                                                        4thparm

                                         returning  retrun-int (Defined as pic 9(8))

    Now in Managed Class Library, in the Method of Class Program

    i am calling the WCF like

    Procedure Division using

                                           1st parm as string

                              by value 2ndparm  as binary-long

                                           3rdparm  as string

                                           4thparm  as string

                              returning return-int as binary-long

    I am getting the Parameter mismatch/not found error , when i am trying to call it from native code.

    Let me know how we can solve it.

    Regards,

    Charan

Reply
  • Our Service methods are accepting Value by Reference and Binary Long parameters.But I am getting error as "Wrong Parameter or Parameter not correct".

    Following is the scenario -

    When i tried to use the default Method of WCF GetData which accept Input parameter as (by value) Binary Long and returns string (By Ref). then it is working fine.

    But when i try to call other method Write it has 4 parameters :-

    1. 1stparm  pic 9(2). type - i/p

    2. 2ndparm pic 9(8) Comp-5. type -i/p

    3. 3rdparm pic x(150). type -i/p

    4. 4thparm pic 9. type -i/o

    This is method is defined in .NET WCF as iWrite - int32(By Ref String, Binary Long, By Ref String,By Ref String) it returns an int32 value.

    When i am trying to call this via Native --> Managed Class --> Class Method -->WCF

    My Managed class is register for Interop COM.

    when I am invoking it in Native code as after referring it using Class Control and then invoking it as

    invoke obj "Class method" using

                                                        1st parm

                                           by value 2ndparm  

                                                        3rdparm

                                                        4thparm

                                         returning  retrun-int (Defined as pic 9(8))

    Now in Managed Class Library, in the Method of Class Program

    i am calling the WCF like

    Procedure Division using

                                           1st parm as string

                              by value 2ndparm  as binary-long

                                           3rdparm  as string

                                           4thparm  as string

                              returning return-int as binary-long

    I am getting the Parameter mismatch/not found error , when i am trying to call it from native code.

    Let me know how we can solve it.

    Regards,

    Charan

Children
No Data