I want to send a HTTPS Post Request to a server. The content should be a JSON Expression.
For LotusScript I have not found a solution. A code snippet which solves the problem is highly welcome.
One way to solve this is through LS2J or if your client runs on windows, you could use the xmlhttp object an example is here
Related
I have a problem with the x-csrf-token validation with regard to a HTTPS-Post-Request. The request comes from a Lambda function triggered by an Amazon Alexa skill and is sent to a XSO Data file running on the SAP Cloud Platform in an SAP HANA Database. I use Javascript/Node.js.
A valid token is set in the request header (see code in the first picture below) but the response header shows for the x-csrf-token "required" (see code in the second picture below). So there is an error with the validation. The same post request with POSTMAN works correctly, but when I try it via a JS File as a Lambda function (in the first picture) there it comes this error with HTTP status code 403 (see code in the second picture below). The POST request itself does work, but the token validation not. GET requests work fine.
Does anybody know a possible solution?
Thank you very much!
1.picture: request
2.picture: response
Please try to get the csrf token first before setting it to the request body. CSRF token changes from device to device as well as the timeframe. I also had a similar issue, and upon implementing the above solution, it started working perfectly.
I am writing this as a separate answer as I had an issue in Spring Boot RestTemplate call. I could arrive at a solution after going through this article.
SAP CSRF Issue
Basically the "set-cookie" header is instructing the browser to set the "Cookie" header. All one has to do (apart from x-csrf-token) is to replace the comma in the string of the cookie with a semicolon. Then set the header "Cookie" to this replaced value;
When I make a multipart request using the POST method to my server, the request works fine.
Below is how I've set up my JMeter:
POST REQUEST
However, when I try to make a PUT request to the same URL, the request does not work.
PUT REQUEST
And the error on the server is
org.springframework.web.multipart.MultipartException: Current request is not a multipart request
This seems to be an issue on the JMeter, since that when I try to do the same request using Postman, the request using POST or PUT works correctly.
However, I want to use JMeter to test my application performance.
The question is: How to make PUT multipart request using JMeter?
As of JMeter 3.0 multipart/form is only available for POST method, while it appears to be possible for other http methods.
So it's a bug:
https://bz.apache.org/bugzilla/show_bug.cgi?id=60015
See also:
http://mail-archives.apache.org/mod_mbox/jmeter-dev/201609.mbox/%3cCAH9fUpbN5jVSNmJUWTFOQUoRM64LNdKY=j8ZjGWzRt6gDuNzdg#mail.gmail.com%3e
It should be fixed in next releases.
I am writing a webserver. I implemented GET and POST (application/x-www-form-urlencoded, multipart/form-data) and that works fine.
I am thinking of adding a RESTful module to the server. So had a look at some stuff that's out there and got opinions about when to PUT, POST, and GET.
My question is: what encoding (application/x-www-form-urlencoded, multipart/form-data) does PUT support (per the HTTP specifications), or can it handle both?
I am trying to make the webserver as standard specific as I can without shooting myself in the foot.
The limitation to application/x-www-form-urlencoded and multipart/form-data is not in the HTTP standard but in HTML. It's the only formats that can be created by an HTML form. From HTTP point of view, you can use any format, as long as you specify it to the server (Content-Type header) and obviously that the server can understand it. If not, it reply with a 415 Unsupported Media Type status code.
See:
http://www.w3.org/TR/1999/REC-html401-19991224/interact/forms.html#h-17.13.4
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.16
http://www.w3.org/Protocols/rfc2616/rfc2616-sec7.html#sec7
HTTP PUT can have whatever content-type the user wishes (the same as for all other HTTP methods).
In how many ways can an HTTP request be generated?
There are endless ways how you can create and from where you can send HTTP requests to a server. Actually your server has no idea, what the origin of such a request is (if it's AJAX or "regular" request, or sent from a console application or ...)
But there are HTTP methods (HTTP verbs) that (can) tell the server about the intent of the request: http://en.wikipedia.org/wiki/HTTP_Verbs#Request_methods
Also you can set headers in a request, for example the content-type or the accepted encoding: http://en.wikipedia.org/wiki/List_of_HTTP_header_fields
Most JavaScript libraries for example set the (non-standard) HTTP header X-Requested-With, so your application can differentiate between regular and ajax requests.
You see, it's even possible to set your own, non-standard headers. There are endless possible combinations...
HttpRequest is a C# class that wraps a petition sent by a client during a Web request.
There are many ways to generate it. The most usual one happens when your browser connects to an ASP.NET website.
You can, for example, create your own custom HttpRequest to petition a specific web page from a C# console application.
Are you trying to achieve something more specific?
I have an ASP.NET web service running that accepts both HTTP POST and SOAP requests. Are there any disadvantages to using a simple HTTP POST to get the data from the WS instead of using SOAP over HTTP?
I can't think of anything else other than the support for transmission of complex data types, and I don't think I'll need that in this project.
Thanks,
Teja.
The clue is in the question...
using a simple HTTP POST to get the data
A POST is not a GET, a GET is a GET.
If you're the only person operating on the WS then it's not a problem as long as you are handling your incoming connections properly. If it is open to outsiders then I would recommend sticking to conventions, they are there to save us from ourselves :)