extract wsdl from c# winforms client - c#

I have a client that was successfully calling a webservice. the webservice was changed then the changes removed. but now the compiled c# winforms client cannot call the webservice.
Can I extract the wsdl the client is expecting to compare with the actual wsdl???

Yes. If you click the "show all files" button in your Solution Explorer, your web reference will then become expandable. The wsdl will then be viewable (expand the reference).

Related

How does one add the reference to use the SOAP API C#?

I want to make an application that automatically deploys reports made in SSRS to the reporting server. I found that the best way to do this is by using SOAP.
I have been searching on this topic for a little while now and I don't see anyone saying how to add the SOAP API reference to a Visual Studio project.
This page page seems like it is directed toward the complete beginner with this API (which I am), yet it does not cover step #1 in actually using the API, which would be to add the reference. What using statement should I use, and/or what is the name and location of the DLL which needs to be specified, in order to start using the API?
I have never done it before until just now but it looks like you just need to add a Service Reference in Visual Studio. Since SQL 2008 R2 the URL looks like this:
http://server/reportserver/ReportService2010.asmx?wsdl
For more information see this MSDN page.
As mentionned by SMM, you simply have to add a web service reference to your Visual Studio project.
Go to "Project" menu, and click on "Add a service reference...".
Then put your SSRS service address in the window that shows as explained in previous post, and... that's it !
A new folder "Web reference" is now present in your project, with an item inside, representing the reference to the SOAP web service you add.
Let me know if you have some trouble.
Regards,

Can't Added Service Reference from WFC

(In VS 2010)
I can't add a service reference to a WCF service in a Windows Forms Project. When I go to add a service reference I click the "Discover" button. It brings up the service I want to add (within the same solution). I click the "OK" button. A server port starts (according to a popup dialog). And I get a Meassage box that pops up and says "There was an error downloading metadata from the address. Please verify that you have entered a valid address." Rats! I don't know what to do :( Now I did mess around with the WCF service project's Web.Config file before I tried to do this. I don't know if that would affect anything. Any help would be much appreciated!!
I have discovered an answer to my own question. Apparently you can get this error if you rename your service but don't change the service name in your .svc file.

Can a Web Reference Be Exposed from another Class?

the question is simple..
we usually use web reference to consume the web services literally(visual studio). But, my problem is another way round. I need to call a particular web service from a c# class to make the web service available to be consumed by others.
First of all, if you have a choice, you should be using WCF on both the server and client. If you can't use it on the server for some reason, then at least use it on the client by using "Add Service Reference" instead of "Add Web Reference". "Add Web Reference" is part of the legacy ASMX technology, which should not be used for new development.
Secondly, of course you can create a separate class library, and use "Add Service Reference" in that library. You can then write a class that has public methods which call the service. The users of this class library will call your public methods, and will not directly call the service.
You can extract the C# code class of a Web Reference by unfolding the web reference in VS, (by showing hidden files if I remember well).
You should find a Reference.cs file which is the proxy client code for your web Service.
It contains everything you need to call your WS. You can copy it elsewhere, include it in another project, change its namespace/code etc. On the long run, maintainance of this file will be a pain if the corresponding WS evolves.
Anyway, if you have the choice, you should follow #JohnSaunders advice on WCF

Reference SharePoint dll from within a Silverlight Application?

I need to build an external upload utility to send files up to SharePoint 2010. However, I can't reference SharePoint to call all of the code needed to work with a document library.
Is there any way to make this happen inside Silverlight?
All answers are true and valid, however there IS a Client Object Model for SharePoint that you can use with Silverlight aswell. Here is a great tutorial to get you started.
This is rather not possible. Silverlight executes under a sandboxed environment with no direct access to server-side APIs.
Instead, create a WCF service at the server side, reference the Sharepoint DLL from within the service and call the service from Silverlight.
Silverlight runs on the client, not on the server, so you can't reference the SharePoint dlls. You would need to build a server-side service that uses the sharepoint dlls and then call that service from Silverlight.
There are built-in sharepoint developer entry points which I reference in my blog post here. You could probably use these instead of using the sharepoint dll.

Call web service over https

What do I need to call a web service over https in C#?
Do I need to get the certificate form the site? How do I use this to call the web service?
There's nothing special or different for calling a web service over https than over http. You generate a client proxy from the WSDL using either svcutil.exe (or Add Service Reference in VS) or wsdl.exe and invoke the method. The lower level classes HttpWebRequest and HttpWebResponse will eventually take care of the actual call and certificates but it should be transparent for your code. Of course the server hosting the web service needs to provide a valid certificate.
I take that you are using Visual Studio to create your projects, if you are it is pretty easy to do. I take that you have the url for the web service that you would like to connect to and it starts with HTTPS.
In your project in the solution explorer (assuming you using Visual Studio), you should see a node saying "References" and another one saying "Web References". Right click on the "Web Reference" and then basically follow the wizard. It is pretty straight forward. You can spec your own Namespace. I usually use the format SomethingAPI. Then use the API as you would like any other object in your project. You will get the intellisense and all.
There might occur known problems with some certificates though. See http://support.microsoft.com/kb/823177/en-us
Do you have a client certificate that has been supplied by the provider of the web service?
If so, there are various different ways of doing this depending upon which version of .NET you are using. What version are you using, and are you limited in how you can generate your client proxy classes?

Categories

Resources