I am trying to generate code verifier and code challenges in jMeter - encryption

I am trying to generate code verifier and code challenges in JMeter for that I written a code
But it is not working. please help me to fix this
I want to generate a string for code verifier and code challenge and pass it too as a variable in my http request.

The code you "wrote" is working fine, double check your dc_verifier value using Debug Sampler and you will see it's there
More information:
Authorization Request
The Groovy Templates Cheat Sheet for JMeter

Related

How would I receive a client ID from a response with requests library? - Python

I'm using the requests library in python and here is my code, my goal is trying to get a soundcloud client ID
r = requests.get("https://soundcloud.com/search?q=a")
This URL is that I'm trying to get:
https://api-v2.soundcloud.com/me?client_id=[REDACTED]
Using print(r.url) I tried to get that URL but it shows the same one which is in the request. How could I make this not happen and make it actually give the last response url similar to loading a webpage and getting the last request with just the requests library? I've also tried r.json() which is just printing out the webpage HTML and is still on the same "url". Please help - I'm stuck at this.

Sending HTTP Requests in Swift

I have tried all the methods I came across on Google but none work. So my question is how would I get the contents of a web page using Swift? Like send an HTTP Request to a website and get the source of the page.
Any help or references welcome :D.
I have tried Alamofire and a bunch of other projects on Github as well.
This code will get you the source code of a website in text form:
let source = NSString(contentsOfURL: NSURL(string: "http://www.google.com"), encoding: NSASCIIStringEncoding, error: nil)
Edit: If the website contains non-ascii characters, you can of course use 'NSUTF8StringEncoding'. If you don't want to block the main thread you should of course use an async_dispatch call.
How about NSURLConnection and NSURLRequest?
sendAsynchronousRequest:... passes an NSData object into the completion handler alongside the NSURLRequest. sendSynchronousRequest:... (please avoid) returns an NSData object. Starting a request with start requires you to have hooked up a delegate to that request that implements NSURLConnectionDelegate where various methods are called as data comes in or the request fails. I'd recommend sendAsynchronousRequest:....

webservice is throwing 400 Bad request when sending certain characters in post body?

I currently have a webservice running on a server somewhere, and if i access the webservice locally i can type in anything and it takes the inputs without any problem.
However, when trying to make a http-post to the webservice from the outside with inputs containing chars such as '&' in this scenario, i run into http error 400 -Bad request.
The below screenshot is a screenshot of the google-chrome addon/in poster, which allows me to make posts to my server.
So, what i'm trying to figure out is why the server doesnt like the request when special characters are part of the inputs.
Any ideas/tips and/or pointers will be highly appreciated.
Thanks in advance.
Edit: Please assume that i have a function in the webservice that recieves a string as input.
Probably the text is not properly urlencoded. If you are using GET protocol, the query becomes:
?bar1=12345&&bar2=something
Try sanitizing (urlencode) string before negotiating with your webservice.

eSendex SMS API

i'm trying to setup a script using classic .asp/vbscript to send an SMS using the eSendex "HTTP Form Post" service.
So far the script is working... here's what it does
Takes the form field values for the calling page
Sends an email
Saves the values into my database
The final thing that I want the script to do is send an SMS by communicating with the eSendex "HTTP Form Post" service, but their API documentation is not very helpful. An example script would have been nice!
If anyone has any experience with eSendex, maybe you could advises me!
Thanks in advance
There are two approaches you can take to communicate with the Esendex Form Post API from ASP.
You can either form an HTTP POST Request yourself and try POSTing the data directly to it, or you could use the EsendexSdk2.dll they provide as part of the ASP SMS SDK: http://www.esendex.co.uk/Developers/Downloads/ASP-SMS-SDK-Download
You can see examples of how to use the EsendexSdk2.dll with ASP here: http://www.esendex.co.uk/Developers/SDKs/ASP-SMS-SDK
In that zip download you'll find a SendMessage.asp example which takes values from fields on a form and calls SendMessage on the SendService.
The alternative HTTP POST Request approach would require you to do something like this SO question: Form post asp classic xmlhttp or this Microsoft support article: http://support.microsoft.com/kb/290591 using ServerXMLHttp from MSXML but I've not tried that method myself so it's just an alternative suggestion to using the DLL.
Your form data that you'd 'Send' in the ServerXMLHttp case would be a form encoded list of the variables like
username=YOURUSERNAME&password=YOURPASSWORD&account=EX000000&recipient=44770000000&body=hello
Feel free to give further examples of how you want to call the Esendex API from your code if it'll help and you can get excellent support from Esendex by emailing support#esendex.com.

how to create JSON webservice, can Anyone refer any tutorial for this

I Cant Able to find out correct soltion . Our client is Android and Iphone. now i need to create a webservice for these two client. I dont know even a single step about this. please any one refer any tutorial website or guide to me.I am using .asmx form.And i use C#
At a high level, its very simple. Instead of returning HTML code in response to an HTTP GET or POST, you will now return a JSON string. The real question is how do you create a JSON string from the object that you want to send.
There are several libraries that can take an object and return a JSON string. In python you can use
return simplejson.dumps(<<object name>>)
in php,
echo json_encode(<<object name>>);
Which language are you using?
I'd recommend to do a REST service.
I've accomplished that by using an HTTP Handler (.ashx) and NewntonSoft.Json (just returning the literal string and changing the content type to "application/json".
If you want to be more fancy WCF supports json as well but I found the handler approach to work very well. Also the Json serializer that Newton uses worked better for me than the Microsoft one.
You can get his Json library using Nuget as well as downloading from the site.
Some resources:
http://www.dotnetperls.com/ashx and
http://james.newtonking.com/pages/json-net.aspx

Resources