Quantcast
Channel: Visual COBOL - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 4356

RE: Consuming WCF in NAtive Code via Managed Code in Visual COBOL

$
0
0

Because the project which is calling the WCF service is a Class library so that it can be registered for COM it does not pick up the app.config file which is generated by adding the service reference. Only main programs read and use app.config so it is ignored.

To get around this you can set the endpoint parameters dynamically within the COM program when it instantiates the service:

Example:

       class-id WcfCOMTest.Class1.
       
       working-storage section.
       method-id callWCFTest.
       local-storage section.
       01 wcfservice type ServiceReference1.Service1Client.
       01 remoteAddress type System.ServiceModel.EndpointAddress value new System.ServiceModel.EndpointAddress("http://localhost:62048/Service1.svc").
             
       procedure division using by value theValue as binary-long
                          returning theString as string.

           set wcfservice to new ServiceReference1.Service1Client(new type System.ServiceModel.BasicHttpBinding(), remoteAddress)
           set theString to wcfservice::GetData(theValue)
           
           goback.
       end method.

Viewing all articles
Browse latest Browse all 4356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>