How to use a WSDL for using webservice in c# project - c#

most of the time i add web reference of web service and give the path of asmx file but now i am using a UPS web service and may be this web service was developed by another technology. there is no any asmx file concept. they provide wsdl file and i just add the web reference and paste the file path of wsdl file there. i compile my project and got no error. my apps is running fine but when i create a setup project of that apps and install on another machine then i am getting object reference error. so i just do not understand why it is not running on another machine when i install it from setup but it is running fine when i run it from my machine IDE. so please guide me what i am missing. what i need to do when i will be working with wsdl and that will run fine on remote machine where wsdl file not exist.

Check if there is an App.config in your Setup project included where the link to your WSDL is set and check if you have that if the link to your WSDL exists on the PC where you are installing.
And if that does not work you can always try to convert the WSDL to a DLL with the help of this site.

Related

Unable to consume web service

I published a simple Hello World web service in an ASP.Net web service project.I closed this project and opened another console based project to consume this web service. The problem is I cannot discover this web service to add reference.When I paste the url, I get the following error
There was an error downloading 'http://localhost:65436/Service1.asmx/_vti_bin/ListData.svc/$metadata'.
Unable to connect to the remote server
No connection could be made because the target machine actively refused it 127.0.0.1:65436
I am using Visual Studio Ultimate 2013, I don't have IIS server installed.
UPDATE- : I created a new Console based project in the existing solution and it works fine.But the problem is how do I run this console project,when I click the debug button, it deploys it on browser.I simply printed the string output returned by web method,I need to see this output on console.
I closed this project and opened another console based project to consume this web service. The problem is I cannot discover this web service to add reference.
Because the web service is not running. Web service references can only be generated when the metadata is available.
You can either:
Run two instances of Visual Studio, one for the web service and one for the client
Put a service and client project in one solution.
Also, you shouldn't use ASMX for new development. Take a look at WCF and WebAPI.
Sometimes it happens to me too. I press F5 to start debugging the web service, immediately stop debugging, and then try to update the web reference again. Usually it helps.
you can deploy the web service on IIS then consume it in console application.

change version of web services

my problem is I want to install the copy of the web service which is currently running on the server. I built the copy of the web service again and got a setup file. But if we tried to install that service on the server, it shows an error, saying a version is already installed in the system. I changed the name of the service, but doesn't work

"Assembly Missing" when using a class library within a RESTful WCF web service

I've spent the past three days looking for a solution but nothing seems to fit the bill. Firstly, I'm new to WCF - I'm currently learning IIS, WCF and the REST architecture style for my final year project of my undergraduates degree.
I'm currently working on a simple read-only web service to get me started, my web service is hosted on IIS7 on Windows Server 2008 R2 inside my LAN on a remote server. I'm connecting to my server through FTP inside of Visual Studio 2010; my Visual Studio solution consists of a WCF web service project and a class library. When I reference my classes in Service.svc inline to my service description, everything works fine, but I would prefer my service contract and classes to be kept separate for clarity. When I move my classes into a class library, reference the project in Visual Studio and build the web site, everything appears in place, I can see the .dll being copied to my web server (verified through Remote Connection) and Visual Studio shows no errors. However when I navigate to an endpoint, i get a Compilation Error with code CS0246: The type or namespace name 'XXX' could not be found.
Am I missing something here?
To reiterate here is what I am doing when referencing a .dll:
Adding a reference to the web service solution (I've tried both referencing the Project and Browsing to the .dll file - both to no avail).
Adding a using statement to Service.svc where my custom classes are instantiated and used.
Saving the solution.
Build -> Build Web Site (Success with no errors, I can see the .dll being uploaded to the server at the bottom of the window.)
Any help would be appreciated, if further details are required please ask, I feel like I'm missing something in the process.
Thanks in advance, Andy

Web service vs. Office Automation

I have ASP.NET Web Service, that works under IIS.
I use Microsoft.Interop DLL to convert file from XML Table format to Excel 2003.
In my code I have reference to Microsoft.Interop DLL version 12. When I try to use this web service from VS, everything working correct.
But when I move my web service to 64-bit Windows Server 2008 I have problem with this convertion.
I place my Microsoft.Interop DLL into bin folder of my web service.
I also tried to make build for 86x and 64x platforms, but nothing changed.
Without converting my web service working correct.
What may cause this problem?
You cannot use Office Automation in a server process like a web service. It's designed to automate the Office desktop applications. In a service, it doesn't work, or causes bugs that are difficult to reproduce, is unsupported, and may even be a violation of your license with Microsoft.

Connect to AXIS Web Service Issues

So here's the deal.
I'm attempting to use Visual Studio to connect to an AXIS web service. Unfortunately, the Web Service does not have a public WSDL file available on the server. I know the location of the Web Service, but it will not let me open the WSDL file from a browser.
Luckily, I do have a local copy of the WSDL file that the server is using. Now I know I can use SVCUTIL.EXE to build a class of the local WSDL file that can be accessed with Visual Studio. However, I need to know how to use the generated class to run services with the server.
Normally, I can use Visual Studio's "Data Source" tool to point it to the right web address and have it take care of the hard stuff, but because the server is trying to hide the web service, how do I connect Visual Studio to the server?
Specific examples in C# would be greatly appreciated.
Thank you very much.
I'd just host the wsdl on your local IIS... point the "Add Service Reference..." wizard at the WSDL hosted locally, then use the application's ".config" file to re-direct the service reference to the actual URL.

Categories