Navision - COM - Web Service
kdw001
Member Posts: 7
Hello everybody,
I have created a proof of concept where a NAV (version 4.0) CodeUnit calls a COM enabled .NET DLL (written in C#).
The DLL in turns uses a web services to retrieve and update data from an external (non-NAV) application in an external database.
Both concepts individually work fine.
- NAV activating a COM enabled DLL does not cause any difficulties.
- The C# (after converting it to an application) also works fine.
When I merge both features, things go bad...
It seems that I loose web service functionality when I activate the DLL for COM interop.
I receive the following message in NAV:
When I register the COM DLL, I also receive a warning:
Any help would be appreciated.
Regards,
Kurt
I have created a proof of concept where a NAV (version 4.0) CodeUnit calls a COM enabled .NET DLL (written in C#).
The DLL in turns uses a web services to retrieve and update data from an external (non-NAV) application in an external database.
Both concepts individually work fine.
- NAV activating a COM enabled DLL does not cause any difficulties.
- The C# (after converting it to an application) also works fine.
When I merge both features, things go bad...
It seems that I loose web service functionality when I activate the DLL for COM interop.
I receive the following message in NAV:
It seems some kind of configuration is missing for the webservice in the COM-enabled DLL. Does anyone have any experience with this?Could not find default endpoint element that references contract '' in the ServiceModel 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.
When I register the COM DLL, I also receive a warning:
Type library exporter warning processing ''.
Warning: Type library exporter encountered a type that derives from a generic class and is not marked as ClassInterface(ClassInterfaceType.None)]. Class interfaces cannot be exposed for such types. Consider marking the type with [ClassInterface(ClassInterfaceType.None)] and exposing an explicit interface as the default interface to COM using the ComDefaultInterface attribute.
Any help would be appreciated.
Regards,
Kurt
0
Comments
-
Hello,
I got a little closer to the solution. The problem is caused by the app.config file.
Since a COM enabled DLL is not executable, the CLR cannot find the app.config file...
Regards,
Kurt0 -
Hi there,
I found the solution. \:D/
As mentionned earlier, the problem is caused by the configuration file (app.config).
Instead of using the default constructor for your web service client like below:WebService.TestServiceClient service = new WebserviceFormTest.WebService.TestServiceClient()
you should use the following code:EndpointAddress address = new EndpointAddress("http://[servername]/[path_to_wsdl]"); WebService.TestServiceClient service = new WebserviceFormTest.WebService.TestServiceClient(new BasicHttpBinding(), address);
Hopefully, this short topic ends the ](*,)
Regards,
Kurt0 -
The other option is to use the app.config file with Navigator. If your application is called myapp.exe, then the config file that goes with it will probably be called myapp.exe.config, and should be in the same directory as myapp.exe. Take that config file, move it to the folder where you have your Navigator exe, such as finsql.exe, and change the name of the config file to finsql.exe.config. Then start finsql.exe and it should pick up on the configuration file and the error should go away.
However, the solution you outline should work just as well, and not require as much mucking around on the client filesystem.
Tim Larson0 -
tlarson wrote:The other option is to use the app.config file with Navigator. If your application is called myapp.exe, then the config file that goes with it will probably be called myapp.exe.config, and should be in the same directory as myapp.exe. Take that config file, move it to the folder where you have your Navigator exe, such as finsql.exe, and change the name of the config file to finsql.exe.config. Then start finsql.exe and it should pick up on the configuration file and the error should go away.
However, the solution you outline should work just as well, and not require as much mucking around on the client filesystem.
Tim Larson
I Know the post is pretty old but i have a little problem.
What do i do if i have more then one app.config file?
I cant use the EndpointAddress because i have a https link and not like expected a http.
So does anybody have an idea how i can solve that problem? i cant use the finsql.exe.config because i use more then one config file and EndpointAddress don't work because i have https.
hope somebody could help me.0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions