HTTP Post with Json parameters

Hi All

Can you assist me(new to http) with this code.  I dont get a response.  What 
am I doing wrong.

procedure TForm1.Button1Click(Sender: TObject);
  HTTPClient : TIdHTTP;
  Params : TStringList;
  UrlStr, Response : String;
  JsonResponse : TStringStream;
  HTTPClient := TIdHTTP.Create(nil);
  Params := TStringList.Create;
  JsonResponse := TStringStream.Create();
   Params.Text := '{"TillNo":1,"OperatorCode":1234,"ReceiptType":"String"}';
   UrlStr := EditUrl.Text + 'AirtimeRequest';
   HTTPClient.Post(urlStr, params, JsonResponse);
   on E: EIdHTTPProtocolException do begin


7/3/2014 3:15:07 PM
embarcadero.delphi.webservices 976 articles. 0 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 3

Moved to winsock group
7/4/2014 2:42:43 PM

Similar Artilces:

HTTP post with json parameters
Hi All Can you assist me(new to http) with this code. I dont get a response. What am I doing wrong. Sorry for the double post I put this message in the wrong group. procedure TForm1.Button1Click(Sender: TObject); var HTTPClient : TIdHTTP; Params : TStringList; UrlStr, Response : String; JsonResponse : TStringStream; begin HTTPClient := TIdHTTP.Create(nil); Params := TStringList.Create; JsonResponse := TStringStream.Create; try Params.Text := '{"TillNo":1,"OperatorCode":1234,"ReceiptType":"String"}'; U...

How to make webservice (HTTP POST) but content parameter in XML format?
 Hi all, I'm now building a webservice using ASP.NET to receive data from SMPP server.My problem is the SMPP server post data via HTTP with content as following:POST /submitSM HTTP/1.1Host: text/xmlContent-Length: 135<smppvas>    <sms src="888" dest="08881234567">SMS Text 1</sms>    <sms src="888" dest="08881234568">SMS Text 2</sms></smppvas> The question is how to get body of those data in websevice, so i can parsing the XML data fo...

HTTP Post problem with webservice
I have added in an ISAPI filter for my website in IIS for all extensions (.*) with all verbs to go to ASP.NET 2.0 handler (aspnet_isapi.dll) so that i can use all incomming request in my url rewritter ( All works as a charm untill i try to connect to a webservice in my project. Once i try to invoke the webservice i get the following error message: The HTTP verb POST used to access path '/dashboard/webservices/webservice1.asmx/HelloWorld' is not allowed. Description: An unhandled exception occurred during the execution ...

Xml Webservice with http post
how to send a request to a web service that is http post enabled ? the web method looks like the following: [webmethod] public string GetStr(object o, string s, string str) Life is all about Mind and Matter. I dont Mind and you dont Matter. Do you want a form post, or posting using the microsoft xml object? I couldn't tell you how to do a form post with that "object o" parameter, but if you look at the asmx output that describes the soap envelop you can just copy the xml and insert your values, then post that to the service and it will work....

Posting using HTTP GET instead of HTTP POST from Textbox control
Hi I feel almost silly asking this question, but I want to use HTTP GET instead of the default HTTP POST that uses when a user enters some text in my textbox and clicks on the associated button. How do I do that? Regards, Egil. You can explicitly specify "get" for method attribute of your form. Like this: <form id="form1" runat="server" method="get"> I am not sure why you would want to do this. This causes _VIEWSTATE to show up in your URL and as a query string. And there is a length limitation on query string. The HTML specifications technically define the...

Error calling WebService with HTTP POST
 Hello Everyone!   I have a webservice published on the location http://desenv1/Autentica/Service.asmx with the method AutenticacaoUsuarioRetornSessionID working fine. I've created an html page to call the the method from the webservice with this code:   <form action="http://desenv1/Autentica/Service.asmx/AutenticacaoUsuarioRetornSessionID" target="_blank" id="form2" method="post" name="form1"> User: <br /> <input type="text" id="Text1" name="login" /> ...

Delphi 2010 WebService Array Parameter
Hi, I created a WebService that returns an array of a TRemotable object (Custom structure) with D2010. When the WS is consumed by a Delphi-Client everything works perfect. But when I try to consumed the WS from a I get errors telling me the xml structure is incorrect. Any help would be really appreciated. Cheers, Eduardo Hi Eduardo, > I created a WebService that returns an array of a TRemotable object (Custom > structure) with D2010. So do I ;-) > When the WS is consumed by a Delphi-Client everything works perfect. But > when I try to...

[svn:parrot-pdd] r22465
Author: tewk Date: Wed Oct 24 17:11:20 2007 New Revision: 22465 Modified: trunk/docs/pdds/pdd23_exceptions.pod Changes in other areas also in this revision: Added: trunk/t/op/exceptions.t Modified: trunk/DEPRECATED.pod trunk/compilers/json/JSON/ trunk/compilers/json/postalcodes.pir trunk/compilers/past-pm/POST/ trunk/compilers/pct/src/HLLCompiler.pir trunk/compilers/pct/src/POST/ trunk/compilers/pge/PGE/Exp.pir trunk/compilers/pirc/src/pirutil.c trunk/compilers/tge/TGE/Compiler.pir trunk/docs/compiler_faq.p...

how can I post http parameters into internet explorer.
I need to hack an http post for testing purposes. Page one.asp has a seried of dropdowns for criteria. Page two.asp lists results based on the criteria selected in page one. The pages use form post to pass parameters between themselves. No querystring params. Is there any way I can make a custom http message that posts directly to page two.asp and renders in IE? I've been using fiddler to monitor the http between the 2 pages but I don't know how to take what's createrd in fiddler and post it to internet explorer. Any help would be appreciated. Thanks Eric ...

Need some help on receiving a http post and decoding the parameters!?
Hi  I have a problem with a site I am currently working on. My site is to receive text (an sms message actually) from an http post. This post is from an external site and I have no control over when it is sent. The company have told me that i need to set up a handler that will receive the post and in turn decode the parameters within it. Is there some kind of page or service that will accept this post and then somehow save the message into a database.  Could somebody help me understand how to do this as I dont really know where to start and i am struggling...

Posting JSON object to WebService that excepts a Class Instance
Hi all,I have a question about deserializing json objects with web services. Specifically sending an JSON to a webservice that excepts a specific object type. I'm using webservices that supports JSON serialization via the attribute [System.Web.Script.Services.ScriptService]. Getting JSON serialized object from the service works fine, but I'm running into an issue of sending JSON object for the webservice to dynamically deserialize. Consider the following scenario:Server-side there exist A person classA webservice that uses Person for the methods GetPerson() and IsPerson21(Person p_pe...

[VB.NET][WebService]Content-type and Post HTTP
hi, i developped a webservice which one our client use with POST HTTP but we ask to our client to set the content-type on "application/x-www-form-urlencoded" to match with our webservice. now the problem is that the message we receive from them are missing somme character like "é", "à", etc... our client told us that is because of the "application/x-www-form-urlencoded" and if we set the content-type of the webservice on "text/xml" maybe it will be the solution but we don't know how to change this on our webservice or maybe it's a problem of "encoding" because i read some artic...

Parsing response from HTTP Post (serialized array) in Delphi?
Hi All, I'm new to using Indy and am not sure of the best way to parse the response I am getting. It is a serialized PHP array. I need to get the data out of this array and into a record or an object. I know I can search for specific strings and work my way through to the data, but I was wondering is there was a better way iterate through the response in case they change the layout, data, names, etc. I'd just like to put it into a format where I can use name of the data to get the corresponding value. I'm using Indy 10 and Delphi 5. TIA. Here is the URL for the test ca...

Help in sending http post form parameters to worldpay! [:'(]
Hi guys, i really need help in the integration with worldpay payment gateway.  In order to integrate, have to send them some parameters in http post. But how to pass sessions from the previous billing.aspx to html form? I need to pass Session("amount") to the input type amount value, but have no idea how to pass the session to html input.This is my first time dealing with payment gateway, hope you guys can guide me with the code. I had stuck for serveal days. Thanks in advance. Below is a example data that required to send to worldpay.<form action="https://se...

Web resources about - HTTP Post with Json parameters - embarcadero.delphi.webservices

Parameter - Wikipedia, the free encyclopedia
A parameter (from the Ancient Greek παρά , "para", meaning "beside, subsidiary" and μέτρον , "metron", meaning "measure"), in its common meaning, ...

fb_source Parameter - Facebook-Entwickler
This document lists the complete list of values for the fb_source parameter that is returned with th...

Google Webmaster Tools Parameter Handling - Flickr - Photo Sharing!
You aren't signed in Sign In Help Home The Tour Sign Up Explore Explore Home Last 7 Days Interesting Popular Tags Calendar Most Recent Uploads ...

Cat 8: TIA performance standards committee chairman previews parameters of forthcoming twisted-pair cable ...
Category 8, the next-generation twisted-pair cabling specification, is still in development, but the outlook looks quite positive that it will ...

Philippine president asks for 'parameters' of Mayon Volcano tours
Philippine president asks for 'parameters' of Mayon Volcano tours People's Daily Online ... 26, 27, 28, 29, 30, 31. Jan, Feb, Mar, Apr, May, ...

Alternatives to boolean parameters
... ) { PrintLine ( item . Name ); if ( printDetails ) { PrintLine ( item . Description ); } } } Aha! Now can see that the boolean parameter ...

Exporting Error (Error in Parameter...: Apple Support Communities
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability ...

Apple tech monitors device aging, adjusts operating parameters to ensure optimal performance
... describing a method of monitoring the aging of a device's electronics, comparing the data with a global average and modifying operating parameters ...

Is it poor programming practice to pass parameters as objects?
... a free, community-powered network of 100+ Q&A sites . Risser asked: So, we've got a guy who likes to write methods that take Objects as parameters, ...

Parameter Short Film Competition sponsored by Grolsch
Grolsch presents Parameter The A.V. Club Short Film Competition Please Enter Your Date of Birth Ineligible entry Enter For people over the age ...

Resources last updated: 12/2/2015 10:53:05 AM