WCF Proxy class not generating - c#

I have a WCF service which is used by two client applications, one is a web application and the other is a Windows forms application.
When I add a service reference to the web application it works perfectly.
But, when I add a service reference to the Windows application it doesn't generate the proxy class.
Then I run selected the "Reuse types in referenced assemblies" in configure service reference section and it generates the reference with XML serialization. That is not what I needed because it gives me lot of errors since I'm using GUID everywhere.
Can anyone explain me how to generate the proxy class with runtime serialization? (both client application use same version of visual studio - Vs2010)
I'm really struggling with this and your help is highly appreciated.

You can use svcutil to generate proxy class. Add these proxy class in a DLL and then reference it in your Web and Windows application. In this way, you don't need to rely on Visual Studio and will have consistent proxy code for both Web and Windows app
More details - http://msdn.microsoft.com/en-us/library/aa702581(v=vs.110).aspx

Related

UWP VS2015 .Net 4.61 Add Web Reference Button Missing

Any help would be greatly appreciated!! I have scoured the web trying to find an answer. I am writing a UWP app that will be deployed to the Xbox platform. I need to access a web service written in .Net 2.0. In earlier versions of .Net / Visual Studio the Add Web Reference Button was hidden in a panel accessed through ->Add Service Reference ->Advanced ->Add Web Reference. With latest build of VS2015 the Add Web Reference Button is missing. Did this completely go away or is it hidden even deeper in the environment somewhere?
XML Web Services, also known as ASMX services, were the predecessor of Windows Communication Foundation (WCF). You can access Web Services by adding a service reference just as you would for any other WCF service.
A service reference enables a project to access one or more Windows Communication Foundation (WCF) services. Use the Add Service Reference dialog box to search for WCF services in the current solution, locally, on a local area network, or on the Internet.
For more info, please How to: Add, Update, or Remove a Service Reference.

Service reference works for windows form but doesn't work for class library

I have two applications. One of them is a windows forms application and other one is a web application which use a class library. I use a web service(WCF). When I give this web service as service reference to my windows form application everything is fine. But when I give it as service reference to class library, I have this error 'No connection could be made because the target machine actively refused it ...'
I give the reference as the same way to these two projects. What should I do?
By default, you cannot configure your WCF service through a configuration file coming from your class library.
Add a web.config with the proper WCF configuration (similar to the one in the app.config of your winforms project) in your web application assembly.

Secure WSDL for Metro Style Apps

I have some web services that I need to reference in a Windows 8 Metro style application, normally you can just add a reference to the service via VS2012, but the services are behind a security layer.
I have downloaded the .WSDL file to my local PC, and now I need to generate the class file for this service.
The WSDL.exe that I have found on my local PC is for .NET 4.0 and produces code that is not suitable for the .NETCore framework. Is there a WSDL.exe equivalent for Windows 8 apps?
Visual Studio 2012 can obviously add a reference to non-secure asmx WSDL web services, so the functionality must be somewhere.
As per little investigation, the original .NET 1.x asmx-based Web Reference proxies are not supported in Metro style apps.
Web Service with SOAP 1.1 end point is supported by Add Service Reference (right-click on a project and choose Add Service Reference) in Metro style apps.
A workaround should be remove the offending constructor that fails to build (unfortunately, you'll need to do that everytime you regenerate the code), and to pass an instance BasicHttpBinding and EndpointAddress to one of the constructors of the WSFTerminalsSoapClient.
Have a look at following references, which might help you in this regard:
Web Services from WinRT Metro
WCF in Windows 8 Metro styled apps? Absolutely supported
I found out how to do this if anyone is interested.
You simply download the XML WSDL file from the site via a normal browser.
Then in VS2012, you can add a service reference to that file directly (i.e. put in the full path to the file c:\tmp\mywsdl.xml) and it will be able to generate the proxy for you.

How do I consume an existing webservice in ASP.NET?

I need to consume an existing web service in ASP.net.
The documentation of the website that provides the web servicesays that I have to use WSDL.exe to generate a stub, but I can't find this tool.
I also tried the Add web reference wizard in Visual Studio 2010 (VS2010), but if I paste the URL in, VS2010 doesn't work anymore.
What am I missing?
As far as I remember there should be a choice between .net 2.0 and WCF services.
Try to select .net 2.0 web service type. We had to do it for using SOAP web services running on Python.
You might also try using the Add Service Reference Wizard instead - worked for me for WebServices the Web Reference Wizard did not like quite as much. Make sure to use the link to either the asmx (if it's one) or the .wsdl
As far as I know, you can't create SOAP webservice with .net 4. When you creating new project, you need to choos .net 3.5 or earlier first, and then create project.
As for creating stub from existing wsdl, I don't know how to do it.

consume gsoap webservice from .NET client

From a .NET application, how do I consume a Web Service developed using gSoap c/C++ library?
I can create a C/C++ client using gSoap library to consume the web service. But I need to consume it from within a .NET (C#) application. I tried Adding a Web Reference but that doesn't seem to work.
Would I need to work with raw Soap Packets?
You can try to call the Web Service dinamically (without adding the reference)
Call a webservice dynamically without webreference
Building Dynamic SOAP Requests with ASP.NET C#
You can also try to build a WCF client, and generate the managed source code file for a proxy using the ServiceModel Metadata Utility Tool (Svcutil.exe).
How to: Create a Windows Communication Foundation Client
Finally, the ProxyFactory project lets you build the proxy classes without WCF
The reason Web reference was not working was the hand crafted WSDL. It worked fine with gSoap library and gSoap C/C++ code generrator nut not with VS. With some changes in the way WSDL was written, I am now able to consume the gSoap C/C++ web service by adding a Web Reference in Visual Studio and also by using HTTP GET method.
Steps taken -
Instead of adding Web reference, use wsdl.exe in verbose mode to generate code using thee gSoap WSDL and XSD file
change the WSDL file to resolve any error and warnings reported by wsdl.exe
Once wsdl.exe can successfully generate code using the WSDL, you can now use VS add web / service reference wizard

Categories

Resources