How to retrieve data using Web services in .NET - asp.net

How to retrieve data from database using Web services on VB?

Does it have to be a web service? Have you considered WCF? (Windows Communication Foundation)
http://msdn.microsoft.com/en-us/netframework/aa663324.aspx

If I understand you correctly, you are asking how to setup a web service using vb.net to communicate with the database and return the results.
If that is correct, then there are 2 parts:
How to write a web service
How to communicate with a database
Here are three pages that will help you create a web service:
vbdotnetheaven
codeguru
techrepublic
As for the database, if you are talking about SQL Server, then see this page here and this page here

Your question isn't clear enough. Are you trying to access a web service run by ASP.NET using VB? If yes, you can make SOAP request to your web service easily using VB, your web service will then fetch the data from database and return to you. You can have a look at this tutorial on how to make a SOAP request using VB -
http://www.aspfree.com/c/a/VB.NET/Calling-a-Web-Service-using-VB6-with-SOAP-30/1/
Hope that helps.

Create a proxy class from the web service's WSDL, using Visual Studio's "Add Web Reference" feature
Configure the proxy, such as for security, if needed (the details depend on the API)
Call the proxy from your code

Related

Exchange of information between the server and client to WCF

I have a desktop application built with WPF and a asp.net mvc web application which is located on IIs.
They should exchange information between themselves. Both also have a sql server database.
My question is: What is the best way to create the relationship between the two programs together?
Can WCF a reliable method?
WCF has a class called CallbackContract which can be specified in the ServiceContract attributes. For details you can go to MSDN: https://msdn.microsoft.com/en-us/library/ms731064%28v=vs.110%29.aspx

Calling WCF service from jsp page

I have created a WCF Service and published it to a Windows Server running IIS. In an asp.net web application, I can add a Service Reference to the WCF Service which exposes its methods which I can call. This all works fine.
I need someone who is running a jsp site to be able to call a method in my WCF Service. How can they do that? (I know absolutely nothing about jsp). Presumably they cannot reference my WCF Service within their application in the same way you can within a .net application.
The web services are totally platform independent. Therefore, someone writing in Java should have no problem calling a web service server, regardless if it was written using WCF or another platform. For example, here, here and here you could find some tutorials on how to build web service clients using java. This java code could be called from JSP pages.
If you want to quickly test your web service from the client side, you could use SoapUI. It's a web service client tool developed in java. I am sure you will find it useful.
Hope I helped!

How to add wcf functionality to an existing asp.net website project

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

connect to a WCF web service using asp.net

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

ASP.NET and Remoting

I have a .net application running on server. Now I want to comunicate between my ASp.NET website and the server application.
Currently I use database, server writes info to the db and site uses it etc. However adding new fields to echange and exchanging complex object is a pain.
Is remoting the way out? If yes, what are the common things to keep in mind while doing this.
both server and asp.net site is on the same server
both is under my control
is there any other better way than using remoting?
It is .NET 2.0
The purists will say that remoting is an old, dead technology, and the way to do it now is to use WCF.
If you're attempting to have some SOA thing, the best thing is to a web service for your server application and access it from your ASP.net website application. It's the best way to do.
However I don't really understand what the purpose of the "server" is? Couldn't your ASP.net website - as you say - be your front-end of the server application?? Your "server" would then simply be the business and data layer and there would be no need to use remoting or WCF.
I would say webservices if want to stay .net 2.0, otherwise it think you should take a look at WCF.
If you need direct interaction between assemblies (ASP.NET and some server application or service) you should use Application Domains and cross-domain calls (some good example here) or using WCF, which is better. Also you can use web services if your server application can be accessed via web without major resulting drawbacks (security issues, server deployment change, etc.).
Actually, u can deploy a WebService on that server. WebService is base on SOAP, it can exchange data object with your website.
If you can update to .Net Framwwork 3.5, you can try to use WCF instead.

Resources