Calling a web service in a windows application form - c#

EDIT. I was adding it as a service reference instead of a web service reference (found by when adding a service refererence, go into advanced and down the bottom it should say "add web reference") , I didn't know that option existed as it's hidden away.
I made a web service in c# .net. Initially it wasn't calling because I thought that the web form didn't like the codebehind for the web form that is created in VS2012, so I took that out and just included the web service file itself.
I'm pretty sure the libraries were included when I visit the url of the service with wsdl, but it still won't seem to call the service to the form.
It displays some XML data and shows TestCypher as a workable service, so it should be working? I'm not entirely sure where the wsdl file should be hosted if I take the web service out of the solution

Please see the below link
http://www.codeproject.com/Articles/26941/Consuming-Webservice-In-A-Windows-Application
you can use this method in your application. I just post this example in your requirement.
please note : i have no guarantee about the perfomrnce area in this method.
So please consider this element when your application is use a wide number of users.
Hope it help.

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,

Add Web Api project to existing project

I'm developing a project that based on columns from a database tables as to present a dashboard.
I've been told to create a Web Api project (added to a windows form project) to obtain the columns data and work it to present the charts.
My windows form project is project1 and the web api is project2.
The idea is when I click a form button, I'll present a html file with the charts. My line of thought is when I press the button project2 will start, with the data already collected in project1, to present a dashboard.
If I'm thinking correctly, my questions are:
How can I call the web api when clicking a button
How can I pass the information already collected to project2
May be you not explaining something right or I don't understand something.
Looks like you adding a Web Api project as part of the solution. Looks like you have some data at Windows application, which then being posted via Web Api to database. If this is correct then:
Web Api is .NET web-centric framework for REST, in which HTTP stack is at the center. In REST you have stateless application running on the web server and you making calls to it. The beauty of REST is that the client can be practically anything - any device, any application, another REST service - anything!
The answer:
So, your Windows App can make a call to your REST layer and post data. In your Windows app you will need to reference System.Net.Http to use HttpClient class. Using this namespace you can compile Http messages and make Http Requests and receive Http Responses.
I think, this is exactly what happening in your solution. Please let me know it it is not what I think.

how to check webservices on a production server

On the ASP.NET server (production), I am told to use the web service that is written by some other person.
Question is how do I find out what webservices were deployed on the production server. All I am told is to make a call using "CheckFile" (which I believe is a part of the web service). I went to the Inetpub folder to see if there is any folder that has these webservices but there is none?
Sorry I am doing this first time and hence many questions,
My end goal is to use these webservices in my ASP.NET application and call those functions such as "CheckFile" and others from this webservice.
Thanks.
I agree ask your co-worker if you have one.Else if you have access to old asp.net app then right clik on project and click on service reference tab it will show web services in that .net app.

Problem connecting to java ws

I've created EJB Stateless Bean and have added #WebService, #WebMethod
annotations to be able to access it as web service. I am using
NetBeans and GlassFish. When I tested web services with server console
they worked as expected. Next I've created .net application which is
supposed to be client for my web service. The problem is when I have
more than one method in the web service it does not work. When I
remove all method except one it works ok.
I also created for test purpose not EJB based web service - web
application project with added web service. This version works ok. So
am I suppose to do something at client side or server side to make the
EJB version works?
Unless explicitly told to, the web service libraries in Glassfish produce SOAP11 WSDL's, and most .NET-tools expect SOAP12.
If you cannot make your .NET-tool understand SOAP11, it appears you must adapt your sun-javaws.xml file. I have not tried this myself.
See https://metro.dev.java.net/1.4/docs/soap12.html

Calling ASP.net Web Service from C# Application

I have a question. How can i invoke a web service and get the result from a C# desktop application. I am making a desktop app and I want it to be able to connect to my online ASP.net web services. How is this possible?
In Solution Explorer, right-click your project node and select Add Service Reference.
Enter the URL where your service WSDL is located. This is usually the URL of the service itself.
This generates a strongly-typed proxy class in a new Services References folder in your project.
Write code in your desktop app to instantiate the proxy class and invoke methods on it. The rest works like magic. :)
AB Kolan was also correct, but Add Web Reference uses the old-style web services framework whereas Add Service References uses the new WCF stack. Important note: It is not required that the service itself use WCF for you to use WCF on the client side. WCF on the client is typically the best choice for any service, provided you can take a dependency on .NET 3.0 and above.
Add a Web Reference to the webservice in your Desktop App project reference. Doing so would generate a Proxy for the Webservice called Reference.cs
You can access your webservice using the proxy.
This is possible the same way that you access web services from any other type of application, be it an ASP.NET page, a class library or windows service.
For an explanatory tutorial on the subject, see Accessing a Web Service from a Desktop Application.
Will get help how to create a webservice and consume that service:
http://www.c-sharpcorner.com/UploadFile/0c1bb2/consuming-web-service-in-Asp-Net-web-application/
Thanks

Categories

Resources