wcf-rest

Jquery unable to get the response from WCF REST service

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 03:29:13
问题 I have developed WCF rest service and deployed it on a link that can be accessed via the browser because its action is "GET". I want to get that data using jQuery. I tried my best to get WCf get response using jQuery but in vain. I also tried $.Ajax with 'jsonp' with no luck. Can any one help me? The url is: http://www.lonestarus.com/AndroidApp/AndroidLocation.svc/RestService/getLatestLocation You can check that url response by pasting url in browser. 回答1: You need to set Access-Control-Allow

Accessing HTTP status code while using WCF client for accessing RESTful services

六眼飞鱼酱① 提交于 2019-12-12 01:15:49
问题 Thanks to this answer, I am now able to successfully call a JSON RESTful service using a WCF client. But that service uses HTTP status codes to notify the result. I am not sure how I can access those status codes since I just receive an exception on client side while calling the service. Even the exception doesn't have HTTP status code property. It is just buried in the exception message itself. So the question is, how to check/access the HTTP status code of response when the service is

Array filter is returning data very slowly

南楼画角 提交于 2019-12-11 23:56:44
问题 I am using knockout arrayfilter to filter items. But if there are more than 1000 records then it returns data very slowly. What should i do for it? Here is my method viewModel.filteredData = ko.computed(function () { var str = "<temp>"; if (viewModel.selection() == "All") return viewModel.dataOne(); return ko.utils.arrayFilter(viewModel.dataOne(), function (data) { stringFromArray = data.display; if (stringFromArray.indexOf(str) == 0) { return true; } }); }); Here is my fiddle When i select

upload image using PhoneGap to .NET WCF Rest Service

笑着哭i 提交于 2019-12-11 18:59:50
问题 I am facing problem upload file from camera and gallery. When selecting few images from gallery I am able to successfully upload the image to WCF service. Thus WCF service is working fine and so is the code to upload file and also same code works with emulated web camera also. However when selecting a few images from gallery I am getting * error code * java.io.FileNotFoundException: http://www.foobar.com/sasas JavaScript Code function selectImageFromCamera(){ var popover = new

How to create a file in WCF service application in windows

一曲冷凌霜 提交于 2019-12-11 14:16:35
问题 I'm working on WCF services application. I want to create a file in one of my function so now this time I'm doing like this. First I go to directory creates a file then i do read/write. string path = AppDomain.CurrentDomain.BaseDirectory; path += "Emp_data\\json_data.json"; StreamReader reader = new StreamReader(path); StreamWriter writer = new StreamWriter(path); I know I'm doing this in wrong way. Please suggest me a better way so that if there in no file and folder It will create

Handle Json Request data in WCF REST Service POST method

被刻印的时光 ゝ 提交于 2019-12-11 12:56:32
问题 i am creating the REST service with POST method and OBJECT as input param. while client request am unable to get the actual JSON data client have posted. Is there any way to dig the JSON code from the C# WCF service. My code: namespace ACTService { public class AssortmentService : IAssortmentService { public void DeleteColor(DeleteColorContarct objdelcolor) { new Methods.ColorUI().DeleteColorDetails(objdelcolor); } } } and my interface as namespace ACTService { [ServiceContract] public

WCF REST Basic Authentication - not able to set authorization header

纵然是瞬间 提交于 2019-12-11 12:44:36
问题 I have created a WCF REST service and I am trying to do custom authentication (as it should work on http and https). I am using custome service authorization manager to check and validate authorization header. When I call the service using Fiddler and pass Authorization header with request, I am receiving it correctly in the service authorization manager. But when I am setting credentials on WCFChannelFactory, I am not receiving Authorization header in the service. I expect that authorization

Ajax call restful WS is always getting error (fiddler gets the good response)

与世无争的帅哥 提交于 2019-12-11 11:27:31
问题 I have made Restfull WS in VS 2010 with two simple method (one GET, another POST). They look like: [ServiceContract] public interface IService1 { [OperationContract] [WebInvoke(Method = "POST", UriTemplate = "createUser")] string createUser(); [OperationContract] [WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Xml, UriTemplate = "loginUser/{email}/{password}")] string loginUser(string email, string password); } Definition of these methods is simple: public class Service1 :

How do I return a list of objects from a restful WCF service

故事扮演 提交于 2019-12-11 07:40:33
问题 I am trying to return a list of objects from my restful WCF service. I am using Entity Framework. The problem is that when the WCF service runs and if I put a debugger on that then the debugger is visited twice and I get a 404 server not found error. Why is this happening.? If I return a return a single class(db table) which is not having relation with other class(DB table) then it is returning the list but if I have to return a class(DB table) then I get a 404 error. Interface :

Passing a cookie to a wcf service

烈酒焚心 提交于 2019-12-11 07:35:32
问题 I have a bunch of wcf webhttp (rest) services that expect an auth cookie. Question is - How do I pass the formsauth ticket to the wcf service? Flowing authentication works for get requests through the browsers just fine (as it should) but I am not sure how to set the cookie during my calls using httpclient or webchannelfactory. At this point the authentication is done and the cookie is available. I am not sure of where to insert the cookies while invoking the service through a HttpClient.