Skip to Content (Press Enter)
OutSystems.com
Personal Edition
Community
Support
Training
Training
Online Training
Developer Schools
Boot Camps
Certifications
Tech Talks
Documentation
Documentation
Overview
ODC
O11
Forums
Forge
Get Involved
Get Involved
Jobs
Ideas
Members
Mentorship
User Groups
Platform
Platform
ODC
O11
Search in OutSystems
Log in
Get Started
Back to Forums
Ali Ahsan
158
Views
5
Comments
[ardoHTTP] HTTPPost Data
Question
Forge
ardoHTTP (O11)
Forge asset by
João Barata
Hi Ricardo,
Thanks for your components. I am using ardoJSON in one of my projects.
Now I needed to use ardoHTTP. I have to post some data to a server which accepts only JSON input. It also requires HTTP Basic Authentication.
I have tested my data using Google Chrome Extension "Advance REST Client Application". But when using ardoHTTP's HTTPPost method, the server returns error "Input string was not in a correct format."
Authentication seems to be working. I am using ardoJSON's OutSystems2JSON action to convert an object to JSON which seems to working fine.
I have tried with/without header 'NoAutoCompression', with/without setting Content Type as input parameter. All combinations of Content Type i.e. 'application/json', 'application/json;' and 'application/json; charset=UTF-8' has been tried.
I am using .NET stack.
Can you help?
Ricardo Silva
With that particular error I'd look at the URL you are building instead. It may be creating a wrongly constructed URL.
Without more information than this I'm afraid I can't venture much of a guess as to what may be going wrong. Can you provide an eSpace that reproduces this issue? If you prefer, you can provided it to me via private message.
Ali Ahsan
Thanks for your prompt reply.
I can share an espace with you, but the server I am talking to has some constraints. It is a payment processing server and accepts requests only from within USA. Also, I will have to share my test account's secret key.
But as far as url is concerned, I am not building it. It is a static value i.e.
"
https://api.chargeio.com/v1/charges
"
Plz let me know if you have any other thoughts. Could it be something with the content length value that you are passing as header. I was looking at java code in your extension.
Ricardo Silva
Why are you looking at the Java implementation if you're using the .NET version ?
Content-Length of the POST request is automatically filled in by the .NET framework, so this value will be as much as it takes to utf-8 encode the string.
The only thing I can think of is that the request is somehow malformed, meaning that there is something wrong with the format of the JSON that you are passing to the request. You can debug the issue and catch the JSON string being used and test it using another tool. If you are still having problems figuring out, perhaps you can contact the service provider's support in order to better understand why their service is throwing that error.
If you are using version 9 of the OutSystems Platform, perhaps an alternative would be to leverage the REST API consumption capabilities of the OutSystems Platform instead of using this component. This way you can have access to the network traces of the requests and look more deeply into the matter.
Ali Ahsan
Thanks for your reply and pointers.
My project uses .NET stack but I myself am a java dev. Hence, just to understand what headers you are manipulating, I was looking at Java code.
As mentioned earlier, I have successfully used Advance REST Client Application and have looked into JSON which is correctly formatted.
I will look into REST API and will also try if I can get an answer from the service provider.
Thanks again for your help.
Ali Ahsan
Ricardo,
A colleague of mine debugged the code which I had written using ardoHTTP and found out another issue in my logic. Your code was working correctly.
Sorry for the inconvenience and thanks for your support.
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
See the full guidelines
Loading...