I have a VB6 application that I want to communicate with a WCF Windows Service that I have written which imports Security Certificates. The only function in the service takes two string arguments. I have been having a lot of difficulty getting the two programs to communicate however.
In VB.NET, it is easy, just make a reference to the service as you would a web service. In VB6, however, it is not so simple it seems. Searching only seems to pull up examples of how to WRITE a Windows service in VB6.
Anyone know how this is done?
The easyest way I have found to access a WCF service from VB6 is to create a .Net ComObject wrapper for the service client. Then in VB6 all your are doing is a create object and calling some methods on the object. All the WCF work takes place in the .Net com object.
Related
I've gone through some tutorials on creating a WCF service. I'm using Visual Studio 2012. I got a very simple WCF Service Library (vb.net) and Windows Application (vb.net) communicating via WCF. That's a start.
However, my project requires I do the following:
My Windows Service - This is already an application that has it's tasks.
My Application - This is an application that is already developed as well.
I need the service to talk to the application. The service will need to send the following information to the windows application:
Status Updates
Metric Information (mostly integers for counts)
I need the application to send information to the service. It would need to send:
Reload Configuration command
Should be relatively simple, but I've never worked with WCF until today. So I have some questions...
Do I need to re-work my current windows service into a WCF Service?
Since it won't be in IIS, do I also create a WCF Service Library or do I roll this into the windows service somehow?
What is the best way to set up the different types of communication? (i.e., sending over specific metrics and reload commands)
Probably the main question is what components, in addition to my current windows service and application, will I need to make this work?
I hope that was clear :( I think I'm confusing it all... but I hope not
Your Windows service can host the WCF service. Similarly, if you want, your application can host a WCF service. The application could talk to the WCF service in the Windows Service, and the Windows Service's WCF could talk to the one in the application. Depending on the nature of the communication, you could also just use a callback channel to permit the Windows Service's WCF to call back to the application.
I suppose you should configure your WCF windows service to use named pipes. If your windows service is already built then the easiest way to do it would be to build another one as a WCF windows service and wrap the already existing functionality.
Hope I helped!
I'd like to create a document in SharePoint 2013 using a call to a WCF (or any other web service) from my console application.
I've been told that WCF access is deprecated in SP13 and will be removed in future versions. Instead, CSOM is to be used (whatever that is).
My question is about the recommended approach. Is it smart to build a solution based on WCF connection (which I know very well how to do) or should I start reading up on the other approach?
CSOM stands for Client-side Object Model. It comes in three flavors; .NET. JavaScript, and Silverlight. Using CSOM abstracts some of the plumbing that you have to do when using WCF directly but ultimately, CSOM talks to a WCF service called client.svc.
If you know WCF already, you can make RESTful calls using OData to that service from your app.
Here's more info about the different API's, http://msdn.microsoft.com/en-us/library/jj164060.aspx.
Here's more info about REST access: http://msdn.microsoft.com/en-us/library/jj164022.aspx.
I am very basic in VB6 so sorry if I am asking an obvious question!
We have an old VB6 application and currently we need to do some re-enhancements in it. I want to somehow connect it to a WCF webservice to send and get files (WCF will take care of loading and storing them in DB).
Based on my researches, it is possible based on This article and some others, Now I am wondering if is it required to have .NetFramework installed on systems to do this?
You can use RESTFUL WCF Service and set the UriTemplate attribute for the method(OperationContract).
Full article for creating REST service
The article you have linked suggests that the VB6 code should call a .Net wrapper for the WCF service.
If you do that, then yes, certainly you will require the .Net framework to be installed on the machine that runs the VB6, because that machine will also have to run the .Net wrapper.
I have an application service layer (which all return serializable viewmodels). Some of these app services need to be callable via AJAX by client code in the Web UI. I'm currently wrapping them in ASMX files that do nothing but dictate the response format as JSON delegate each call to the application service class with the same signature.
Is it advisable to try to save a few lines of code by exposing the appropriate application service classes as WCF services? Can someone point me to an example? Any potential pitfalls for usage in WebForms client code?
Microsoft now considers ASMX services to be "legacy technology". You should not use them for any new development. They have been completely replaced by WCF. For instance, see the top of this article: http://msdn.microsoft.com/en-us/library/bb885203.aspx:
This topic is specific to a legacy
technology. XML Web services and XML
Web service clients should now be
created using Windows Communication
Foundation .
I have a WCF deployed on IIS. Now by adding web reference of it i am using it on my app.
So I have two questions:
Is it the best method of consuming WCF.
If the answer of first question is yes then what is the role of svcutil.exc, I mean what is the use of creating wcf proxy class. and if the answer is "No" then why?
It is the easiest solution if you develop with visual studio and have access the remote WCF service.
If you are developing using another IDE, you might want to use SvcUtil to generate your proxies.
If you prefer to have a simple CS file containing the generated client, you might also choose to generate it using SvcUtil.
You may also completely ignore SvcUtil and the Service Reference wizard and use the ChannelFactory class to generate proxies dynamically.
You should use "Add Service Reference" in Visual Studio (not Add Web Reference) for WCF.
It is the easiest way - since you can do it right in Visual Studio. What it does under the covers is basically call svcutil.exe (or you can do that manually, from the command line yourself), and create a service proxy class for use on the client side.
The use of svcutil.exe is many fold - you can create a client proxy class from a running service (or from an existing WSDL/XSD file), you can verify services, you can export metadata from a service for clients to consume, and a great many more options. It's the "Swiss Army Knife" of WCF tools.
WCF uses a concept that all calls to your service must go through a client proxy - this is the place where the entire WCF runtime lives, and where all the WCF extensibility points are located. This proxy converts your call to a method on the client into a serialized message that gets sent across the network to the server for processing, and it also handles "unpacking" the response from the call back into classes and objects on your client side for your use.
Adding a service reference is the quickest and easiest way but not always the best way. If you want performance then using ChannelFactory<T> is the way to go. You should know different ways to create a client side proxy and customisations that you can do.
An excellent resource is WcfGuidanceForWpf. Don't let the WPF in it scare you as it is really an excellent guidance for general WCF as well.