Click here to Skip to main content
15,896,727 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I need to create and API to connect windows application and web application. From windows application form i like to a pass a value to web application and retrieves value from web application to windows application based on the passing value.
I check lot of pages in online but i didn't get a break through.

Please guide what ever the procedures that i need to do to achieve this.

Please help me on this.

Thanks in advance.

What I have tried:

I created one windows application and one web application. Both application database is different.
Posted
Updated 20-Feb-16 23:32pm
v2
Comments
Garth J Lancaster 21-Feb-16 2:45am    
why 'web application' ?
- you want to use a windows ?WinForms application to get some data from somewhere - is the somewhere a database or ?
- what connectivity is there between the WinForms application and the 'somewhere' you're calling a 'Web Application' ?
- how much data is going in either direction ?
Sascha Lefèvre 21-Feb-16 3:40am    
(Notification of OP response)
Kochathu Thomas Tinu 21-Feb-16 2:57am    
Thanks for your response.

I created one web application that already in online and the database is SQL.
Now we are planning to create one mobile application to show some details from the online application without providing sql connection of online application to the mobile application.
Both the database is SQL.
We need to pull some data from online to the mobile application
Afzaal Ahmad Zeeshan 21-Feb-16 3:48am    
You should reply to their comment in order to notify them of your response. Otherwise, they are not notified of any activity.
Garth J Lancaster 21-Feb-16 5:31am    
well, if you dont like anything Afzaal Ahmad Zeeshan has said, I would

Create a REST Server to retrieve data from the database - this depends on what skills/platform you are using, you could look at Sinatra (Ruby), NancyFX (C#) to do this

Then use a HTTP call from your client to the URI exposed by the REST server, get the data back as JSON for example.

This gives you some flexibility if you later want different data elements or such served by the REST Server, they are just different routes based on the URI

Start by removing the database on the client-side, you should maintain just one data source when you are using a web API for your application architecture. There is no use of having multiple data sources, unless your data sources and network (or CPU and hardware) latency causes a huge trouble in performance factor.

Now, the thing is, ASP.NET already supports Web API. I assume that you are having ASP.NET MVC as the pattern for development, if so, just include Web API to your project. Inclusion of ASP.NET Web API package would allow your application to have a separate portion, for API calls handling.

How to add Web API to an existing ASP.NET MVC 4 Web Application project? - Stack Overflow[^]

Once that is done, Web API uses the same pattern as ASP.NET MVC. You create Controllers, Model(s) — they can be the current ones — for data, and then you handle the requests. Each request can return the data in JSON or XML format. You can then use that data on the client-side to perform what-you-want-to!

I guess you would be interested in my article, ASP.NET 5 Web API RESTful CRUDs and Windows 10 native application[^]
 
Share this answer
 
Comments
Kochathu Thomas Tinu 21-Feb-16 3:56am    
Thanks for the answer. I am not using MVC
Afzaal Ahmad Zeeshan 21-Feb-16 3:57am    
What framework are you using? Web Forms?

If so, read this: Using Web API with ASP.NET Web Forms
well, if you dont like anything Afzaal Ahmad Zeeshan has said, I would

Create a REST Server to retrieve data from the database - this depends on what skills/platform you are using, you could look at Sinatra (Ruby), NancyFX (C#) to do this

Then use a HTTP call from your client to the URI exposed by the REST server, get the data back as JSON for example.

This gives you some flexibility if you later want different data elements or such served by the REST Server, they are just different routes based on the URI
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900