I'm attempting to create my first WCF service.
I've created the service and now I'm trying to call it from a asp.net (vb) web site and I've tried adding a web reference to it and using the scvutil.exe to consume the service.
So far neither have worked. It's not letting me declare the service in my code. If someone could point me to a good tutorial on how to consume a WCF service in an ASP.Net web site that would be great.
I've found numerous on how to use them with AJAX or silverlight or windows apps but nothing on using it in just a plain old website.
Please see Beginner's Guide to Windows Communication Foundation. It's part of the WCF Developer Center on MSDN, which is full of good resources.
The link above is broken. Some other links I've found while searching for it:
Developing Service-Oriented Applications
Windows Communication Foundation
Conceptual Overview
Getting Started Tutorial
How to: Create a Windows Communication Foundation Client
Basic WCF Programming
Just add service reference, use the service reference as using "reference1.xxxx" and then use the client code.
That's all after the initialization. It works for me. Let me know if you require any help.
Related
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 want a good tutorial with WCF on VS2010. This service will be consumed in an ASP.Net Mvc 2/3.
The development will be done in VS2010.
This is a good start, but still not exactly what I need.
Can anyone recommend a good tutorial?
The link you have provided is very good, it has shown all the steps of creating and consuming WCF service. The only difference in your case is, the client. You want consume WCF service in ASP.Net MVC, and in the tutorial the client is console app.
Following are some of the links which might help you
Scott Guthrie's Nerd Dinner walkthrough to get a really good understanding of MVC basics.
How to Configure wcf service programatically
Blogs on how to write a Layered ASP.NET MVC Applicaiton with a WCF Service
Part I (General Concepts)
Part II (Building a Repository)
Part III (Building The Service)
Part IV (Using The Service)
Hope this helps you.
I have not worked on Web Services, but now I am planning to work on WCF Services in my next web application project. Do we need to have prior working experience on Web Services to work on WCF ?
can we start learning/working on WCF directly with out working experience in Web Services ?
You do not need any prior experience in web services to use WCF, though it would of course help in some situations. Having said that, WCF does have a learning curve (like everything), so you should consider going through some training, like the excellent Pluralsight training.
In addition to some sort of training, a must have resource for WCF in my opinion is Juval Lowy's book, Programming WCF Services.
Good luck!
What do you mean by Web Services? Do you mean ASP.NET Web Services (ASMX)? If so, you don't need experience with them to learn WCF.
WCF is API for creating web services (and remote services generally) so once you start learning WCF you will start learning how to create and work with web services.
I think yes. It should not be a problem to write a WCF service even if you do not have web service development background. At least, I did not have this experience at the beginning :). I have posted a link to good WCF book at:
Recommended beginner's learning resources for WCF
I am new to both Silverlight and WF (both 4.0 version), i was wondering if we can integrate WF4.0 with Silverlight 4.0 in such a way that, when we click on some button in sliverlight UI the workflow should be executed and the output from the final activity of the workflow is displayed in the Silverlight screen. If it can be done then please provide me with some link or any tutorial where i can learn about this and start implementing.
Thanks in advance.
In WF 4.0 you can have workflows started (or progressed) by WCF endpoints. Therefore, if you can call the WCF endpoint from your Silverlight application you should be able to do this quite easily. Lots of information on Microsoft's WF Developer Centre.
Assuming you are using Visual Studio 2010, you can get up and running with a very simple Silverlight -> WF example very quickly...
Create a new project (and new solution) from the 'WCF Workflow Service Application' template. The project will be named DeclarativeServiceLibraryX. This should give you a very simple WorkflowService definition using SequentialService that simply receives the request from a client (with a single integer argument) and sends a response (with the same value). This project is created as a web project so includes a Web.config.
Create a new Silverlight 4 application. You will be asked if you want to host the Silverlight app in the existing web project (created in step #1). Probably a good idea to say yes.
In the Silverlight application, select 'Add Service Reference...', then 'Discover/ Services in Solution'. Service1.xamlx will appear as an option, select it and click Ok.
VS will then generate a WCF service reference client. You could then add a TextBox & Button to capture some data, create the client and send the service call across the wire to the WCF Workflow Service. This Workflow Service could then be modified as necessary (or use these steps to add a WCF Workflow Service to your own web project).
One area that might be challenging is modifying the WCF service bindings to be compatible with Silverlight; perhaps create a Silverlight-compatible WCF service in your server-side project first, then create a WF WCF endpoint and look at the generated code & config to see how to put things together.
The MSDN Endpoint blog is also a useful resource for learning more about WF and WCF (especially with the new style lightweight REST-style 'WCF Web HTTP' bindings, which might be more suitable for consumption by a Silverlight client.
I am assuming that you don't want to host the workflow inside the Silverlight app itself, as WF is a full .Net framework component rather than being Silverlight compatible. I'm sure you could write your own lightweight workflow framework that runs inside Silverlight, but given workflow is generally a multi-user, server-side concern this probably wouldn't be very useful concern.
I found an example with WPF here for these samples. Hope they will help you a bit or at least give a general look at this topic.
Workflow Foundation is not included in the Silverlight 4.0 runtime and thus cannot be used within a Silverlight app. So Silx answer do not relate at all to Silverlight. And James Websters answer is the only solution to make use of WF from Silverlight.
You cant use WF with silverlight.... the only way is , You can call WCF service to access WF as explained by James Webster.
One of our C# ASP.Net projects has some dependencies on the Microsoft WSE 3.0 library, in order to consume a WSE3.0 web service. However, we're migrating the project to Windows Server 2008, which does not support WSE3.0.
So I need to refactor the code to remove the dependency to WSE 3.0 but still maintain its functionality. The code is simply adding a username security token to the SOAP context and then invoking the web service. I'm not sure where to start though. I suspect I switch to WCF, and if so, is there any tutorial available online to help?
I'd start by creating a simple application, maybe a Console application, to be a test consumer of the existing web service. Create client proxy classes for this application by using "Add Service Reference", and pointing it to the existing WSE service. That should take care of most of the problems.
Once the simple console application works, you can do the same for your ASP.NET project.
Needless to say, it's way past time to update that WSE service to WCF, which is supported, and which will continue to be supported for a long time to come.
This article is a pretty good rundown of the differences between WSE 3.0 & WCF and migration recommendations. I'd start by getting the migrated service to run under the basicHttpBinding configuration (without user name/password authentication).
Once the service is running as expected and look at this article to see how to get the migrated service configured for user name/password authentication. The article is written for Silverlight use but there should be enough in it to get you going.