Calling C# WebService to Javascript for Android - javascript

I have a wsdl service and as I generate it with svcutil.exe, it gave me a .cs file. Now my question is how can I call the service with javascript for android. Where do I go from here? Any suggestions or any reference/step-by-step tutorial or a sample demo would be a great help for me. I am developing an application for android with phonegap 1.4.1, Many thanks.

The .cs file you have is just a DTO. You would need to code you Operations and Data contracts in the WCF service to make anything happen.
With javascript in mind, I would just use JQuery and the .Ajax() method for making the calls from the client side. There are tons of articles on how to accomplish that.
http://www.codeproject.com/Articles/128478/Consuming-WCF-REST-Services-Using-jQuery-AJAX-Call
http://forums.asp.net/t/1513059.aspx/1
JQuery/WCF without ASP.NET AJAX:

Related

Spring Boot, Demo project and Ajax call

I new to web development. I have a lot of question to ask.
I using spring boot for server side
How to use HTML & JS in front
How to make a AJAX call to connect JS and spring boot controller
My plan is to create a Single page application
This is an extremely open ended question, and breaks some of the rules of Stackoverflow. Questions should be specific, relating to a problem that your encountering, with any solutions you've tried provided.
That being said, I would recommend going through some tutorials on building a REST API with Spring Boot and doing AJAX in JavaScript.
REST API with Spring
AJAX with JS

Real Time Background Service

I am now developing a mobile app using ionic framework and it's using larvel 4 REST API to do CRUD operations with MySql database. Based on the app requirement, the mobile app needs to call backend service everytime in order to complete certain process.
I am using Angular Resource to call those APIs and i am calling them every 3 secs using Javascript setinterval function. However, the app is working, I don't really feel that it's a good practice to do because it's a heavy task for both server and client.
Could you guys please guide me how I should solve this kind of situation and i really appreciate your help. Especially, which kind of tools I should setup and what are they? Thank you.
setInterval isn't a best practice to receive new data from your API server/DB because the server could get flooded when too many users access your web site. However there is a prettier solution: WebSockets. With websockets you receive notifications realtime. I am not a PHP developer so I don't know what WebSocket libraries are used for Laravel/PHP development. But on the AngularJS part I can recommend this: https://github.com/gdi2290/angular-websocket
A WebSocket example (non-related): http://jsfiddle.net/EAVvQ/24/
Hope this helped.
Cheers!

consuming Wcf polling duplex service with non-silverlight client?

i have been working on a online game of TicTacToe and to achive it i am using WCF polling duplex service.
But after thorough searching for the whole week, i think it is possible for only silverlight clients.
If anyone knows that polling duplex service can be used with non Silverlight client like mvc3,asp.net or likewise javascript and so ,,,, then please give me idea, link or sample code snipet.
Thanks in Advance...
you should build your wcf with a REST endpoint. That could be the way to go to consume with javascript.
You can start learning how to do that here: http://msdn.microsoft.com/en-us/magazine/dd315413.aspx
Don't forget about very cool and useful (auto json serialization/deserialization, easy debugging) WebMethods/PageMethods
To use server WebMethods from some external (outside page) wcf service you can add script reference to asmx "JS" endpoint. For ex. "/_vti_bin/PageService.asmx/JS" and you are good to go:
{WCFNamespace}.{WebMethodName}({arguments}) in javascript. Very handy.
By the way Ascx controls for ex. doesn't allow to use PageMethods! And Sharepoint visual webparts based on ascx.

Call SOAP webservice(Made in .NET) through Javascript

I am developing one mobile web application.
In this, i want to call a Web Service and fetch data from their using Java Script only.
I searched a lot and try to implement some code also but it didn't help me out.
One thing is that the Web Service was made in .NET using SOAP.
So, please help me to solve it immediately.
One easy would be to create an ASP.NET Web API Http service wrapper around your current webservice and use jQuery to access it. This will be much simpler than using JS to access a SOAP service.
More on ASP.NET Web API: http://www.asp.net/web-api

is it possible to do SOAP Xml parsing through jQuery?

Lot of SO Answers are saying that SOAP webservice is not good using javascript.but the following URL tells that it is possible.butis it possible through jquery using cross domain policy in for SOAP? any help please? I am working on HTML5 with javascript for mobiles,not in server side.
jQuery does have a SOAP project you can use, if you are interested.
http://plugins.jquery.com/project/jqSOAPClient
It is currently in beta, but it will get the job done.

Categories