How to integrate .NET web application project (API) with Apache Cordova Project? - asp.net

So this is the issue:
I have a .NET project that includes 5 Web Application Layers.
One of them is API.
I Recently added a Cordova project as well and I'd like it to communicate with the API Layer.
Is there anyone who knows what to do?
P.S.:
I use visual studio 2013.

You can use normal jQuery Ajax calls to make requests to the API. http://api.jquery.com/jquery.ajax/ or just normal JavaScript ajax https://stackoverflow.com/a/8567149/487940.
I hope that answers your question.

If you're talking about calling into Web API web services from a Cordova app, you may find the Breeze.JS framework useful to help you. You can either just used the client library or use some server side code in addition to client code to help get you up and running and exposing new web services as well.
Otherwise it is simply a matter of making web service calls to the server from your JavaScript code but the specifics will depend on exactly what you're trying to do and what client UI/utility framework you are using.

Related

How to add controller support in a Blazor WASM project

I want to have a server web app that serves the code for a Blazor WebAssembly app and also uses controllers to serve data.
So, in a single server app (and in a single executable file), I want to pack the Blazor code that ships to the browser and also have the controllers to respond to HTTP requests.
I was expecting this to be easy to do, but I am honestly lost trying to find how to do this.
The Blazor WASM templates in Visual Studio don't seem to allow this out-of-the-box (the hosting model and what you can do with it is completely different from what you have in web apps) and searching online did not provide any helpful samples on how to do this.
Has anyone done this before?
Note:
I have started with a Blazor app and tried adding controller support to it. Not sure if starting with a web app and trying to add Blazor WebAssembly functionality to it would be easier, but I doubt it...

Web.Api 2 and Asp.Net core in one solution

Currently we use ASP.NET core project for our UI. There is need to add an OData service to it. As far as I understand it is not supported well enough yet, so it was decided to implement it in a separate Web.Api 2 project.
Is there someone who has such an experience?
Is it a way to go?
May I encounter troubles with deployment to Azure?
Any ideas and thoughts would be appreciated.
If you hosted the web site on a different web application, then you have to enable CORS on the web API, and you have to test it during development to avoid any issues.
You can overcome this issue by deploying both the UI and API to the same Azure Web App. you can have the UI under the root and the API under a virtual directory, ex: apis

Using SocketScan SDK with C# Web Service

What I am trying to do is to call a web service using jquery (ajax json call) and use this SocketScan sdk in the web service (C# based web service).
As, my Mobile App uses only Jquery so I have to make use of this Socketscan sdk in the web service only.
I want to build a sample app for the same. How can I achieve this?
I have added the dll reference to my web service and can see all the methods used in dll but I am not able to understand the flow of dll.
Regards
Aman
Telerik AppBuilder is based on Cordova, so you can't call native code directly and the ScanAPI SDK doesn't support javascript. You will need a plugin which wraps the native SDK (C#, Java or Objective-C, depending on your target platform) and exposes the functionality you need to your app. You may have to develop a Cordova plugin, if there isn't already a plugin released under a suitable license for your app.

SQL Server and iPad app interaction

I have to write an app for iPad that would take data from SQL Server and post it to the iPad. I looked up on this over the Internet and found that i have to write a web service to expose the data from SQL server using ASP.NET. I did an app previously in android that would take data from my dropbox a/c and display it to the user. I made use of the drop-box api available. I was wondering if anything like that exists for SQL? Also, i have to code in Obj-C for the iPad, so how will
i write ASP.NET code? I have more doubts.
Thanks in advance.
There are many options for web services. If you are developing in ASP.NET and don't want to invest to much time in just accessing the data I would suggest some software that will help you generate the source code.
WSSF (Web Service Software Factory) is software that will assist you in creating a SOAP web service and it generates source code for you. I do recommend however working through a tutorial first before just jumping into using this. WSSF uses visual studio as well.
Once you have a web service that packages your SQL data for communication through http requests. You will need to parse the data communicated in Objective-C. For this you'll find SudzC to be very helpful.
SudzC generates all the source code for accessing your web service in Objective-C, given the WSDL.xml file of your web service (a file that lays out the design of your web service).
Although these software will save you a lot of coding, I wish I could tell you that this will be a short and easy process. However this is vary rarely the case, developing this will take you a couple of days.
I do know that people often use RESTful web services when dealing with the iOS enviroment, although I do not have the same kind of experience with them as I do SOAP web services. I hope that this information is helpful to you.
I've done this. The best way is to use .NET 3.5 or higher to create a WCF (Windows Communication Foundation) project. These projects will let you communicate with your mobile application using REST or SOAP. They also let you send data in XML or JSON format. You will then need to create a REST or SOAP client in your IPad application to communicate with the server.
Use OData. See Creating an OData API for StackOverflow including XML and JSON in 30 minutes for how to publish your SQL Server data as an OData service. See Consuming OData using Objective-C for how to consume the OData service from your iPhone app.

Good replacement of GWT for asp.net

I know Google Web Toolkit (GWT) is a development toolkit for building and optimizing complex browser-based applications. GWT is used by many products at Google, including Google Wave and Google AdWords. It's open source, completely free, and used by thousands of developers around the world.
It can be integrated in java based web applications....
Is there any suitable replacement of GWT for asp.net web application?
If so,what is it?
GWT is platform agnostic. It can be easily integrated with any web application, not just Java. You just tell it to inject widgets into elements on the host page - the host page could be static HTML.
The built in RPC mechanism makes it easy to do RPC with a Java on the server side, but you can certainly use JSON or XML to exchange data with your server. It's a little more work, but not impossible. Look up 'overlay types' - these make working with JSON data extremely easy.
Consider SmartGWT. It has a built-in REST connector that is easy to connect to REST services on the .NET platform, which Visual Studio can help you generate.
On the .NET platform, the free open source (LGPL) edition is all you need. If you need commercial license terms, those are available too.
Take a look at Script#, but I'm not sure if it's still in development. "Essentially the Script# compiler is a C# compiler that generates Javascript instead of IL."
http://www.nikhilk.net/Entry.aspx?id=121
If you're just looking to hook up an ASP.net web application with GWT, try
GWT and .NET

Resources