Firebug and AMF post - coldfusion

I have to debug a website that uses a swf to send amf posts to a flex2gateway.
In Firefox's "Firebug > Net" I see the POST url and when I click on it, the Post tab shows scrambled jiberish:
The response is also scrambled:
But the headers and cookies are not scrambled:
How can I unscramble the post so that I can create a curl with the proper post values. And how can I unscramble the response?

AMF is a binary format. As such Firebug and Chrome Dev Tools don't do a very good job of being able to read them. In the past, I have used a product called ServiceCapture to 'read' AMF messages. Charles is another product that can do this.

Related

How can I return hyperlinked text in a Lexresponse?

So I am building a lex chatbot and I am trying to return a response with hyperlinked text. I have the chatbot sitting on a front end but I cant seem to find a way to return responses with hyperlinks. Heres what I have so far
https://imgur.com/N6Bp2fX
https://imgur.com/zbnUsrH
Now Ive read that the responses from lex are formatted to where the chatbot is sitting. For example, in the chatbot test window on the Amazon site, returning hyperlinks is impossible, but skype automatically hyperlinks URLs. But I have mine sitting on a browser but I still cant get a hyperlinked response in the bot.
Would love if anyone could help me out! Thanks in advance!
The test console window of Lex does not support html rendering. You can instead deploy your chatbot to a channel like facebook or slack, and it will be rendered correctly.
You can use the custom markup option to send a response in the following json format to format it by your client.
{
"text": "Check out the following link",
"type":"hyperlink",
"links":[{
"linkText":"Google",
"url":"https://google.com"
}]
}
Lex can return any response that you want, but it's the responsibility of chat client to parse that response and show accordingly.
So you need to write your logic to parse hyperlink and show them.
In your case you can send response from Lex like : Please visit [link]www.google.com[\link].
Then you can write your logic to show the text in anchor tag <a> in your chat window so that it is parsed as hyperlink.
Hope it helps.

How to use the url that came in response

Help to understand and direct what needs to be done further. I use the robot framework version 3.1.1 and the Python 2.7 programming language to write the autotest script, and now there is a task to develop a test that will work with POST / GET requests. So, I make a POST request to the system to initiate a payment. The answer comes that the payment has been created, but for all actions it is necessary to follow the link inside the answer.
Request:
Create Session allias URL
&{params}= Create Dictionary params1=value1 params2=value2
${resp}= Post Request allias /init_payment.php params=${params}
Should Be Equal As Strings ${resp.status_code} 200
Reply post response:
<?xml version="1.0" encoding="utf-8"?>
<response><pg_status>ok</pg_status><pg_payment_id>3016695</pg_payment_id><pg_redirect_url>https://test.paybox.money/payment.html?customer=028c44bf25b6be251199221d04b570c2</pg_redirect_url><pg_redirect_url_type>need data</pg_redirect_url_type><pg_salt>8OYUsodtnaTWKbOD</pg_salt><pg_sig>a26e61d6eb710c430d67150498d1f555</pg_sig></response>
How to show the framework so that it can go through the redirect url? I would be very grateful for your help.
The RequestsKeywors from the Robot Framework use Requests HTTP Client. Reading the quickstart from this library you can find that the response's contents is available in the text field.
${body}= ${resp.text}
Then you'd most likely want to parse the XML. You can use the XML library for that.
It will be something like
${root} = Parse XML ${body}
${link} = Get Element Text ${root} response/pg_redirect_url

RestFB - Picture URL is not properly formatted

I'm trying to publish a post on my facebook page using RestFB.
My code is as follows:
FacebookType publishResponse = facebookClient.publish(pageId + "/feed", FacebookType.class,
Parameter.with("message", message),
Parameter.with("picture", picture),
Parameter.with("link", link),
Parameter.with("description", description));
And my parameters have the following values:
message: Test+test+test
picture: https%3A%2F%2Fcom-smallteaser-local-photo.s3.amazonaws.com%2Fskydivemag%25232fdefcfa-c7b2-4c0d-8504-9942ccd9a4b0%2523648%25230%25232592%25232592%2523292%2523292
link: http%3A%2F%2Flocalhost%3A9000%2Farticle%2F20130503-test-test-test
description: This+is+just+a+test
I am getting the exception:
FacebookOAuthException: Received Facebook error response of type OAuthException: (#100) picture URL is not properly formatted]
I read here that i can add a picture with just providing an URL and it specifically says that it is meant for 'App developers who host their images on Amazon S3 or a similar service'.
Any idea what i'm doing wrong?
I think it’s not actually the “formatting” of the picture URL, but the content it returns:
https://com-smallteaser-local-photo.s3.amazonaws.com/skydivemag%232fdefcfa-c7b2-4c0d-8504-9942ccd9a4b0%23648%230%232592%232592%23292%23292
is delivered with a Content-Type: application/octet-stream response header (as you can see here) – and that might make Facebooks scraper think that this is not really an image resource.
So you will have to figure out how configure your hosting space to deliver these images with a correct Content-Type, for example img/jpeg or img/png.
I got this problem, but only on older Android devices, not on a desktop. I could see in the server logs that there was a difference:
When accessing the URL on a desktop, Facebook does request the picture URL.
When accessing the URL on an older Android device, Facebook does not request the picture URL.
It turned out that I was using window.location.origin in constructing the absolute URL, which according to http://www.hyperink.com/blog/?p=18 only works on Webkit. It was solved by replacing, as the post suggests,
window.location.origin
by
window.location.protocol + “//” + window.location.hostname

Is there a debugging tool that echos back your HTTP request?

I swear I saw this once:
A website that just echoes back the request info (headers, url, method, params, etc) of all requests that come in.
Sort of like the opposite of hurl.it
Found it: httpbin is a webservice for testing http clients.
the response just tells you the request it received.
You could also try Fiddler if you want a desktop application for doing this!

api request returns json files and not html/xml browser content

I am sending get httpwebrequests to the facebook graph api and all was working fine till I deployed to production server and now module that expects html/xml response is not working and when tested url in internet explorer, the save file dialog pops up and the file needs to be saved.
Other modules also send requests to the facebook graph but just differ in the form of requests so not sure what is going on here.
Any ideas appreciated
Edit:
Let me try and rephrase this. On my production server the httpwebrequest was not returning the correct result. So to Test it I copied the url http://graph.facebook.com/pepsi which is an example, should return the profile info viewable in the browser. The server has internet explorer v8 and I am not sure why it tries to download the file instead of displaying it in the browser. this is what is happening in my code and when I make a request to a different part of the api, then it works in my app but not in the browser
Your question is not very clear. From what I gather, you want the display the JSON response in a browser. Instead, you are being asked to download a file by the browser.
Well, this is normal behaviour. The response you get from Facebook would most likely have a MIME type of application/json. Most newer web browsers display the text in the browser itself. Some browsers, however don't know how to handle this content type and just ask you to download the file.
You mentioned that your module expects an html/xml response. Try changing this to application/json.
You also said that it works in your app but not in your browser. I don't know what you're making, but generally you wouldn't show raw json to the user in a browser, right?