I have a solution (asp.net) that already contains a reference to a web service, now i want to add this web service in a new solution, but the web service now is protected and i cant add it by the normal way. I want to take the code of the web service from the old solution and add it to the new solution. The service is wsdl.
Related
We have web application written in ASP.NET webforms with some asmx web services. Now we want to add some toher web services, which will serve different purpose than the old ones. We decided to use WCF framework.
My colleague created a new project in our solution, where he implemented the web service. Unfortunatelly he did not use the WCF* project templates, but normal console application with the following method for starting the WS:
public static void StartWS() {
if (_selfHost!=null)
StopWS();
Uri baseAdress = new Uri(WSIntegrationService.ServerUrl);
_selfHost = new ServiceHost(typeof(WSIntegrationService), baseAdress);
_selfHost.AddServiceEndpoint(typeof(IWSIntegrationService), new WSHttpBinding(SecurityMode.None), WSIntegrationService.EndPointName);
_selfHost.Description.Behaviors.Add(new ServiceMetadataBehavior { HttpGetEnabled = true });
_selfHost.Open();
logger.Info("Integration WS started on adress " + baseAdress);
}
Now I have to integrate the project to our web application (another project in solution).
What is the easiest way to do it?
How can I ensure that both - the old asmx service as well as the new WCF service is operational?
In the end the solution was not that hard:
In web app project choose Add New Item -> WCF Service. This should create Service.svc, Service.svc.cs and IService.cs. It also modifies your web config. Now you can try if it works, with the auto generated method DoWork. Simply use something like SoapUI app to do that. ALso you can try to browse to the svc file and check the wsdl (e.g.http://localhost:2753/WSIntegration/Service1.svc?wsdl)
Delete the files IService.cs and Service.csv.cs. Modify the Service.svc file, so it contains just the reference to the class implementing the WS, e.g. like this:
That's all. I haven't deploy the solution to the IIS yet, but I don't expect any problems there. As soon as I will do that. I will update the unswer if any additional steps will be needed.
I am developing an Web application using WCF. I have added Web Reference in Web Application. I am adding methods in WCF as per my need then updating Web Reference in Web Application and it is updating successfully but can't access the newly added methods of WCF in Web Application.
Please Help me...
Do your new methods exist in the contract interface, and do they have the OperationContract attribute?
When you update the web reference, is it looking at a test service or your newly-modified service?
Are you running the modified service when you update the web reference, or is it that the old version of the service is running under an ASP.NET process (check your taskbar) and that is what you are updating from?
Have you rebuilt the client after updating the web reference (I know, I know, but easily missed)?
Yes I did it.
I just deleted Web Reference from Web Application and then cleaned the solution of WCF and Web Application. After that Build Solution of WCF. Then added WCF Reference through "Add Service Refeence" then Build Solution of Web Application. In this way solved my problem.
I have several asp.net website projects for various sites.
Currently I want to add REST API's to these projects so I can start developing mobile apps (using HTML5/JavaScript/CSS3 and PhoneGap) that make use of these webservices.
Since WCF is far more powerful than regular asp.net webservices (among others with control over the service and authentication/authorization), I'd love to add these to my existing website project.
I did a Google search but cant find anywhere a step-by-step tutorial how this can be done. And also if there's any functionality I'd possibly loose when adding WCF functionality
I was also thinking of creating a new project specifically for WCF, but think I'd rather add it to an existing website project.
Can anyone help me with this?
Depending on exactly what your needs are and how your current web site is configured, there are two approaches.
If you are using a Web Site Project, then you should create your WCF service in a different application:
1) Create a new ASP.Net Web Application Project.
2) Add a new item to the project and select the type of WCF Service or WCF Data Service.
When you deploy this project, you will deploy it to your web server, but not as part of your web site since configuring the web.config will be a large manual effort.
If you are using a Web Application Project, then you could add the WCF Service directly to your existing project. However, I only recommend this approach if you are Silverlight applets within the web site that rely on the user's authenticated credentials.
WCF can be configured with a lot of bindings and it can be configured to return xml or json(.net 4.0). Try to create a wcf service configured to use basichttpbinding or wsHttpBinding and to format the response as json and use jquery to interact with the wcf service. This article might help you http://www.codeproject.com/KB/aspnet/Cross_Domain_Call.aspx
I have my own web service application with more then one .asmx file.
Now i am not getting how can i reference web service with my web application as "Add Web Reference".
I want to connect with both asmx files at once.
Means once i connect web service as add web reference and i can call both .asmx file from my code behind page.
Doesn't work that way. You have to reference each web service or consolidate them.
You could do this:
Invoking Web Service dynamically using HttpWebRequest
When you add a web reference to your application, Visual Studio creates a proxy class that you use to connect to the web service. You will not connect to the web service directly. The proxy class name is set when you add the reference. It suggests a name for you that you can change.
As long as you are using the proxy classes that are generated, you should be able to connect to as many web services as you desire.
I hope that helps.
I'm new to WCF web services never done anything with them before and I'm being asked to create a page to connect to a WCF web service
I have no idea where to start and I've searched the internet with no success.
Does anybody have an example of an asp.net page connecting to a WCF web service?
I've set up the WCF web service on my server but do not have a clue on how to actually connect or query it to get my XML data back.
The WCF web service is set up as it's own URL and only has 2 files within the root one being the web.config.
I somehow need to query this URL and get some XML data back from it.
Any ideas?
You need to create a service reference from your asp.net project to your WCF project. Right-click on the ASP.NET and click on "add service reference", set the URL of the service and VS will generate a proxy class for you.
Asking your favorite search engine for "asp.net add service reference" should give you a good selection of starting points.
Look into WCF connections and web.config. This link should provide you some direction: http://msdn.microsoft.com/en-us/library/bb332338.aspx#msdnwcfhc_topic5