http-post

RESTful WCF web service POST problem

不想你离开。 提交于 2019-12-06 04:38:51
问题 I can't pass over parameters to wcf web service. My web method: [OperationContract] [WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json, UriTemplate = "playersJson2")] List<Person> GetPlayers(string name1, string name2); When I make http post request, I got 200 OK response with correct json form but web service seems to fail to get paramters (name1, name2). Wireshark shows following: Do you see anything wrong? Update: Not sure it matters but my service is using "webHttpBinding"

Dealing with complex models in ASP.NET MVC

无人久伴 提交于 2019-12-06 03:52:11
I have a model that looks like this: Business - Branch - Phone(*) - Phone Type - Number - Opening hours (*) - Days in week - Working period (*) - From time - To time - Custom field (*) - Name - Value - Address - Address line - City - State - Zip - Yada yada I created Editor Template s for each of the class types above. I want to have a common Business editor template with a submit form that posts the entire structure to a single action and saves it, both for an existing or new entity. Is Editor Template s the right approach? How do I submit the form along its entire downline? How do I make Add

Send AJAX-like post request using PHP only

眉间皱痕 提交于 2019-12-06 03:46:24
I'm currently working on some automatization script in PHP (No HTML!). I have two PHP files. One is executing the script, and another one receive $_POST data and returns information. The question is how from one PHP script to send POST to another PHP script, get return variables and continue working on that first script without HTML form and no redirects. I need to make requests a couple of times from first PHP file to another under different conditions and return different type of data, depending on request. I have something like this: <?php // action.php (first PHP script) /* doing some

Get data from an internet link in Android

青春壹個敷衍的年華 提交于 2019-12-06 03:12:54
问题 I am making an application which takes a URL with. *.asp extension and we pass it the required parameters and get some string result using POST method. Any suggestions on how to achieve this? UPDATED: Actually I have a .net link which takes some POST Parameters and gives me a Result. How can I do that in Android? 回答1: HTTPResponse should do the trick: DefaultHttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://www.yoururl.com"); List<NameValuePair>

How to set downtime for any specific nagios host for certain time from commandline through curl?

落爺英雄遲暮 提交于 2019-12-06 02:51:27
问题 I need to set a schedule downtime for specific nagios host from the commandline by curl..how do I do that? here is something I am already using for service/host notification enable/disable from commandline. curl -d "some input here" url "user:pass" Like way I need to do the thing for schedule downtime.Now the problem is that downtime option takes more options i.e starttime,endtime,comment etc. So how do I get it done by curl from the commandline? curl -d " some key value pair(hostname

TypeError: Cannot read property 'post' of undefined

心不动则不痛 提交于 2019-12-06 02:26:33
Hi i just want to use a simple function, http post to post my date to a page.I want the server be able to fetch the date i post. import { Component, OnInit } from '@angular/core'; import { MarginServcies } from '../../services/MarginService'; import { Response } from '@angular/http'; import { Http} from '@angular/http'; //import { Ng2SmartTableModule, LocalDataSource } from 'ng2-smart-table'; @Component({ selector: 'margin', template: require('./margin.component.html') }) export class MarginComponent implements OnInit { public http: Http; public MarginList = []; public date: string; public

AFNetworking 3 x-www-form-urlencoded post data

China☆狼群 提交于 2019-12-05 23:35:54
问题 I'm trying to post data with x-www-form-urlencoded body. Posting via postman, it is ok But i cant do it via afnetworking 3. Here is my code NSDictionary *parameters = @{@"login" : email, @"password": password}; NSError *error; NSData *jsonData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:&error]; NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; self.requestSerializer = [AFJSONRequestSerializer serializer]; NSString

Android gson serialization issue

杀马特。学长 韩版系。学妹 提交于 2019-12-05 22:53:09
I have HttpPost request on my Android application to my .NET Web Api. I am using json data type and gson class in order to serialize my object. Here is my code about serialization: HttpPost post = new HttpPost(); post.setURI(new URI("my url goes here")); HashMap<String, String> hashMap = new HashMap<String, String>(); hashMap.put("username", username); hashMap.put("userCredentials", new Gson().toJson(credentials, UCredentials.class)); // username and credentials are parameters. post.setHeader("Content-Type", "application/json; charset=utf-8"); post.setEntity(new StringEntity(new Gson().toJson

How can I pass a moderately large volume of data to my Web API app?

♀尐吖头ヾ 提交于 2019-12-05 20:55:19
I've got this code in a Web API Controller: [Route("{unit}/{begindate}/{enddate}")] [HttpPost] public void Post(string unit, string begindate, string enddate, [FromBody] string stringifiedjsondata) { List<ProduceUsageSPResults> _produceUsageList = JsonConvert.DeserializeObject<List<ProduceUsageSPResults>>(stringifiedjsondata); string _unit = unit; string _begindate = String.Format("{0}01", HyphenizeYYYYMM(begindate)); string _enddate = GetEndOfMonthFor(enddate); string appDataFolder = HttpContext.Current.Server.MapPath("~/App_Data/"); string htmlStr = ConvertProduceUsageListToHtml(

Java + jackson parsing error Unrecognized character escape

删除回忆录丶 提交于 2019-12-05 20:21:56
I need to do a POST json string , using HttpClient. Following will be the code i have. From the other end the Json is mapped to an object. HttpClient client = HttpClientBuilder.create().build(); HttpPost post = new HttpPost(url); String jsonData = "{ \"provider\" : null , \"password\" : \"a\", \"userid\" : \"mlpdemo\\mlpdemoins\" }"; post.setEntity(new ByteArrayEntity( jsonData.toString().getBytes("UTF8"))); HttpResponse response = client.execute(post); Here all others are correctly mapping expect the userId. Here the problem is with the backward slash( mlpdemo\mlpdemins ). I guess. If I send