Jasper server integration in rails 2 - ruby-on-rails

I want to configure jasperserver-client gem in order to receive reports from Jasper server through SOAP.
The error I get is JasperServer::Error: JasperServer replied with an error: exception getting data strategy
after running the following from console:
client = JasperServer::Client.new("http://example.com/jasperserver-pro/services/repository", "jasperadmin", "jasperadmin")
request = JasperServer::ReportRequest.new("/public/test2", "PDF", { 'last_login_at' => '2013-01-15 00:00:00'})
pdf_data = client.request_report(request)
Any idea what might be the cause. I think that it's able to find the server and the report but it might be something wrong with the optional parameters.
I also tried generating the request without the option hash

I've solved my problem with this tutorial
http://jonif.blogspot.com.br/2012/07/

Related

Yelp Place API returning "Invalid Signature" Error only from Nginx on EC2

Problem: I am getting an "Invalid Signature" error from Yelp API only from production (running on nginx server in AWS) When I run locally on my localhost:3000, there is no signature error, and everything works fine.
I am using the yelp gem in rails. Here's some code in ruby.:
$client = Yelp::Client.new({
consumer_key: $SL_CONSUMER_KEY,
consumer_secret: $SL_CONSUMER_SECRET,
token: $SL_TOKEN,
token_secret: $SL_TOKEN_SECRET
})
begin
$client.search("Los Angeles")
rescue => error
puts error.message
puts error.inspect
end
error.message prints out: "Signature was invalid"
error.inspect prints out: < Yelp::Error::InvalidSignature: Signature was invalid >
Everything works when I run locally on rails' Webrick server but when I run it in production, I get an "Invalid Signature" error.
Has anyone seen this? I've looked at some relevant posts, but this seems different. Thanks!
This will probably not pertain to most people, but the off chance it could help someone, here it is:
My "time" was effed up on my EC2 instance. So for example, in ruby, Time.now was not printing the actual time. (I think it was off by a few minutes or so).
Anyway, Yelp API requires a oauth_timestamp when you send a request. Of course, then, my request was timing out b/c the time was off.
How did I found this error out?
I just pinged the URL on my browser with the oauth, token, oauth_timestamp, etc. (few more) as query params. The browser spits out the error response in JSON, and it was saying that my request was timing out. When you use the ruby Yelp Client and catch the exception in code, it doesn't spit out the error response in terminal, so it's a bit more difficult to locate the exact root of the error.
How I solved it:
I re-calibrated the time in my ec2 instance by following the directions here: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-time.html
Problem is solved. Peace.
Invalid signature error in Yelp API occurs due to two reasons .
First , Either of your four keys i.e consumer_key , consumer_secret_key , Token & Token Secret is invalid . Secondly Parameters passed to Yelp API Function are either invalid or any of those are nil .

Possible Attack autoshell.txt

I got this error reported to me recently from my Rails app.
mycontroller#update (ArgumentError) "invalid %-encoding (<%MYTEST)
An ArgumentError occurred in mycontroller#update:
invalid %-encoding (<%MYTEST)
These are the parameters that were passed.
Parameters : {"controller"=>"mycontroller", "action"=>"update", "id"=>"autoshell", "format"=>"txt"}
Should I be worried? I recently upgraded to Rails 4.1 and ruby 2.1.3. What is autoshell.txt?
This seems to be somebody scanning for websites vulnerable to JCE Joomla Extension Auto Shell Upload Exploit. Really nothing to worry about.
I've been seeing this error in our logs as well. I'm not concerned about it personally, but if it becomes annoying you can add this to your routes.rb file:
put '/autoshell', to: proc { [404, {}, ['']] }
That will return an empty 404 response.

Ruby Asana Gem - Get all tasks with particular tag

Im using the Ruby Asana gem https://github.com/rbright/asana.
As per the documentation, in my controller I have:
tag = Asana::Tag.find(6498432136675)
#waiting_tasks = tag.tasks
However, this returns:
Failed. Response code = 400. Response message = Bad Request.
I have confirmed that the id is correct. If i use:
puts tag.inspect
I get the following:
#<Asana::Tag:0x007f94432af498 #attributes={"id"=>6498432136675, "created_at"=>"2013-07-14T10:05:13.070Z", "name"=>"Waiting for", "notes"=>"", "workspace"=>#<Asana::Workspace:0x007f94432aea98 #attributes={"id"=>6399696678844, "name"=>"Ministry of Crazy Ideas"}, #prefix_options={}, #persisted=false>, "color"=>"light-teal", "followers"=>[]}, #prefix_options={}, #persisted=true>
I dont understand why this is not returning the tasks as documented in the read me. If anyone can shed any light on this I would be hugely grateful.
Sounds like it's most likely a bug in the ruby gem. However, it could be an underlying API issue. Try curl -u <YOUR API KEY>: https://app.asana.com/api/1.0/tags/6498432136675/tasks - if that works, the gem isn't constructing the right URL (aka, that one). If it still returns a 400, the issue may be with the API.

ServiceStack request giving 500 for large request

I am using ServiceStack with MVC4 and getting 500 error when request parameters are long. I am posting ProductIds seperated by commas to controller via AJAX. In controller I have following call to servicestack API to retrieve data.
ResponseDTO res = restClient.Get(new RequestDTO { ProductIDs = ids});
//ResponseDTO res = restClient.Get(new RequestDTO { ProductIDs = "1234,1235,1236"});
If i submit small parameters in above, it works fine with no error. But when parameter string is in range of 1800 characters, it simply fails on above line and gives 500 Internal Server Error:
NetworkError: 500 Internal Server Error - http://localhost/Products/GetProducts
Exception Details: ServiceStack.ServiceClient.Web.WebServiceException: Not Found
is there a limit on GET method for posting large parameter request? Why does it fail for large request when for small parameters it successfully calls API, retrieves data via SQL procedure and sends to view correctly. What can I look into to solve this? Thank you!
p.s. when i debug via VS2012, i see exception details I see Message:Not Found and StatusCode: 404.
As Scott mentioned above, we tried POST for all methods and it fixed issue. I knew GET had limit on browser URL length but didnt think it matters as we had ServiceStack framework and all of their examples were using GET. Thanks again Scott.

Adobe Flex 3 : Fault Event doesnt return XML Feed sent from Server

I am working on a flex application which communicates with a Rails backened.
When i request for some data, It sends back xml feed.
In some cases, if given parameters are not valid, then rails return an error feed with status code = 422 as following
email is wrong
But I dont get this feed in FaultEvent of Flex, How could i read error feed?
Thanks
Are you getting the result in ResultEvent in such cases? I am not sure for what all HTTP error codes FaultEvent will get invoke(I know only it goes for 404 and 500). May be its still going to ResultEvent as a valid result!
You can use HTTPService instead of URLLoader.
Flex HTTP results will not include the actual underlying HTTP response codes. It just doesn't work. (TM)

Resources