http-post

jQuery posts null instead of JSON to ASP.NET Web API

匆匆过客 提交于 2019-12-17 16:09:15
问题 I can't seem to get this to work... I have some jQuery like this on the client: $.ajax({ type: "POST", url: "api/report/reportexists/", data: JSON.stringify({ "report":reportpath }), success: function(exists) { if (exists) { fileExists = true; } else { fileExists = false; } } }); And in my Web.API controller I have a method like this: [HttpPost] public bool ReportExists( [FromBody]string report ) { bool exists = File.Exists(report); return exists; } I'm just checking to see if a file lives on

Launch default browser with intent and post parameters [duplicate]

你说的曾经没有我的故事 提交于 2019-12-17 15:46:25
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: How can I open android browser with specified POST parameters? I would like to do something like this: startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.somepage.com?par1=val1&par2=val2")); But I dont want to send the parameters with get but with post. How can I do this as described above? Many thanks in advance, navajo 回答1: It can be done, but in a tricky way. You can create a little html file

Rails 3 get raw post data and write it to tmp file

落花浮王杯 提交于 2019-12-17 15:46:24
问题 I'm working on implementing Ajax-Upload for uploading photos in my Rails 3 app. The documentation says: For IE6-8, Opera, older versions of other browsers you get the file as you normally do with regular form-base uploads. For browsers which upload file with progress bar, you will need to get the raw post data and write it to the file. So, how can I receive the raw post data in my controller and write it to a tmp file so my controller can then process it? (In my case the controller is doing

Android: Sending a byte[] array via Http POST

删除回忆录丶 提交于 2019-12-17 10:59:53
问题 I am able to do a POST of a parameters string. I use the following code: String parameters = "firstname=john&lastname=doe"; URL url = new URL("http://www.mywebsite.com"); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoOutput(true); connection.setRequestProperty("Content-Type","application/x-www-form-urlencoded"); connection.setRequestMethod("POST"); OutputStreamWriter out = new OutputStreamWriter(connection.getOutputStream()); out.write(parameters);

How to send a POST request with JSON body using Volley?

此生再无相见时 提交于 2019-12-17 10:55:10
问题 How to pass these parameter into POST method using Volley library. API link: http://api.wego.com/flights/api/k/2/searches?api_key=12345&ts_code=123 Screenshot of JSON structure I tried this but again facing error. StringEntity params= new StringEntity ("{\"trip\":\"[\"{\"departure_code\":\"," +departure,"arrival_code\":\"+"+arrival+","+"outbound_date\":\"," +outbound,"inbound_date\":\","+inbound+"}\"]\"}"); request.addHeader("content-type", "application/json"); request.addHeader("Accept",

On Android, make a POST request with URL Encoded Form data without using UrlEncodedFormEntity

主宰稳场 提交于 2019-12-17 10:46:34
问题 I have a string that is already in the proper URLEncoded Form format and would like to send it through a POST request on Android to a PHP server. I know the method for sending URL encoded forms on Android uses the UrlEncodedFormEntity and I know how to use it. The problem with that is that the data comes into the function already URL encoded and joined by ampersands, so using UrlEncodedFormEntity would involve a lot of extra work to turn it into a List of NameValuePairs and I'd rather not. So

Android- POST multipart form data

自古美人都是妖i 提交于 2019-12-17 10:33:41
问题 I would like to send multipart form with video and data such as Email and name. The following is my code and it does not work ,there is no response from the server File file =new File(VideoPath); HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(url); try { // Add your data List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2); nameValuePairs.add(new BasicNameValuePair("Name", "LDGHT")); nameValuePairs.add(new BasicNameValuePair("Email", "hhh

IIS 7.5, Web Service and HTTP 405 error

我是研究僧i 提交于 2019-12-17 09:55:17
问题 I have a web service which I host on my machine. I use Windows 7 and IIS 7.5. Problem : When the client tries to consume the web service, he/she gets a HTTP 405 error. In the log file of IIS, I can see that this is refused because POST verb is not allowed. Question : How can I allow POST verb for those requests? Do I have to add mapping of the WSDL file? And if I do, how do I have to configure this mapping? I have checked, and in existing mappings I have nothing for WSDL extension. Is there

How to take a photo and send to HTTP POST request with Android?

天大地大妈咪最大 提交于 2019-12-17 09:52:31
问题 I know this has answers here and there, but I couldn't make any of them work. Does anybody know a good reference, or a tutorial for this, maybe also post here? What I need to do is : 1) provide a button, that opens the camera application. I have done this by a startResultActivity() 2) user takes the photo, and returns to the application, with the photo saved, preferably with a preview in an ImageView. I tried something, but I cannot test in an emulated device. 3) presses a "send" button, and

HttpPost works in Java project, not in Android

自古美人都是妖i 提交于 2019-12-17 09:46:52
问题 I've written some code for my Android device to login to a web site over https and parse some data out of the resulting pages. An HttpGet happens first to get some info needed for login, then an HttpPost to do the actual login process. The code below works great in a Java project within Eclipse which has the following Jar files on the build path: httpcore-4.1-beta2.jar , httpclient-4.1-alpha2.jar , httpmime-4.1-alpha2.jar , commons-logging-1.1.1.jar . public static MyBean gatherData(String