rosisr
-
Posts
6 -
Joined
-
Last visited
Content Type
Profiles
Forum
Events
Featured Visualizations
Knowledge Base
Documentation (PDF Downloads)
Blog
Documentation (Test Area)
Documentation
Dr. Jaspersoft Webinar Series
Security Advisories
Downloads
Posts posted by rosisr
-
-
If you try from a rails console you can get an authentication with:
JASPER_SERVER = "http://10.128.10.81/jasperserver/services/repository/"
driver = SOAP::RPC::Driver.new(JASPER_SERVER)
driver.options["protocol.http.basic_auth"] <<
[JASPER_SERVER, "jasperadmin", "jasperadmin"]
I've also had the same problems as you. I got the authentication with the code above in a rails console and then I got other error when I tried to use list method and what I get is:
ws.list('')
Wire dump:
= Request
POST /jasperserver/services/repository/ HTTP/1.1
! CONNECTION CLOSED
Errno::EPIPE: Broken pipe
from /usr/lib/ruby/gems/1.8/gems/rubyforge-0.3.1/lib/http-access2.rb:1135:in `write'
from /usr/lib/ruby/gems/1.8/gems/rubyforge-0.3.1/lib/http-access2.rb:1135:in `<<'
from /usr/lib/ruby/gems/1.8/gems/rubyforge-0.3.1/lib/http-access2/http.rb:185:in `dump'
from /usr/lib/ruby/gems/1.8/gems/rubyforge-0.3.1/lib/http-access2/http.rb:386:in `dump'
from /usr/lib/ruby/gems/1.8/gems/rubyforge-0.3.1/lib/http-access2.rb:1213:in `query'
from /usr/lib/ruby/1.8/timeout.rb:56:in `timeout'
from /usr/lib/ruby/1.8/timeout.rb:76:in `timeout'
from /usr/lib/ruby/gems/1.8/gems/rubyforge-0.3.1/lib/http-access2.rb:1211:in `query'
from /usr/lib/ruby/gems/1.8/gems/rubyforge-0.3.1/lib/http-access2.rb:892:in `query'
from /usr/lib/ruby/gems/1.8/gems/rubyforge-0.3.1/lib/http-access2.rb:434:in `do_get_block'
from /usr/lib/ruby/gems/1.8/gems/rubyforge-0.3.1/lib/http-access2.rb:370:in `conn_request'
from /usr/lib/ruby/gems/1.8/gems/rubyforge-0.3.1/lib/http-access2.rb:285:in `request'
from /usr/lib/ruby/gems/1.8/gems/rubyforge-0.3.1/lib/http-access2.rb:264:in `post'
from /usr/lib/ruby/1.8/soap/streamHandler.rb:199:in `send_post'
from /usr/lib/ruby/1.8/soap/streamHandler.rb:137:in `send'
from /usr/lib/ruby/1.8/soap/rpc/proxy.rb:170:in `route'
from /usr/lib/ruby/1.8/soap/rpc/proxy.rb:141:in `call'
from /usr/lib/ruby/1.8/soap/rpc/driver.rb:178:in `call'
-
Hi, I've got the same error as you and finally Ive got authentication but I cannot do anything more, with add_method I tried the list method and all I got was
Errno::ECONNREFUSED: Connection refused - connect(2) (, #0)
My class for a web service client:
class WsJasperClient < SOAP::RPC::Driver
JASPER_SERVER = "http://10.128.10.81/jasperserver/services/repository/"
# Authentication works!!!
def new(nameserver)
# nameserver => JASPER_SERVER
driver = SOAP::RPC::Driver.new(JASPER_SERVER)
driver.options["protocol.http.basic_auth"] <<
[JASPER_SERVER, "jasperadmin", "jasperadmin"]
end
# Create driver and set up methods
# It doesnt work yet :-(
def add_methods
# driver = SOAP::RPC::Driver.new("http://10.128.10.81/jasperserver/services/repository/" )
[ %w(login username password),
%w(list uri),
%w(get uri args),
%w(runReport reportUri map)].each do |signature|
self.add_method(*signature)
end
end
end
I hope this can help you though I havent been able to get it works.
Post edited by: rosisr, at: 2006/12/04 10:27
-
Thanks but though I've been checking it my Java knowledge is very low. What I need to do is a web service client in Ruby on Rails and I can understand I dont need to rewrite the code, do I? I mean in Ruby is supposed to be just:
JASPER_SERVER = "http://10.128.10.81/jasperserver/services/repository/"
driver = SOAP::RPC::Driver.new(JASPER_SERVER)
driver.add_method('login','username','password')
Thanks in advance for any suggestion.
-
Hi, you just have to add the right driver into lib directory. I've used jtds-driver, and I put the .jar file into /lib directory and it works for me. Good luck!!
-
Hi, I'm actually dealing with it. I just can tell you the url connection as I havent been able to get a "fully" authentication.
Url: "http://localhost/jasperserver/services/repository/"
I've tried to authenticate with this:
conn = Net::HTTP.start('10.128.10.81')
get = Net::HTTP::Get.new('/jasperserver/services/repository/')
get.basic_auth 'jasperadmin', 'jasperadmin'
conn.request(get)
print conn
but it answers ok, but when I try to use any other method, it says "SOAP::HTTPStreamError: 401: Full authentication is required to access this resource". Im still looking into it but I'd really appreciate any suggestion.
integrate jasperintelligence with ruby on rails
in Products
Posted
Thanks a lot, you've been a great help!! But I still have some problems, when I try to run this:
#!/bin/env ruby
require 'soap/rpc/driver'
strUser = 'jasperadmin'
strPWD = 'jasperadmin'
strServer = 'http://10.128.10.81/jasperserver/services/repository/'
strOutputFormat = 'HTML' #JRPRINT, RTF, PDF, etc?
strURI = '/reports/samples/Employees'
strRequest = %Q{<?xml version="1.0" encoding="UTF-8"?>
<request> <operation-name>runReport</operation-name>
<resource-descriptor
read-only="false" control-type="0" is-reference="false" is-new="false" strict-max="false" data-type="0" mandatory="false" has-data="false" strict-min="false" main-report="false" version="0">
<uri-string>#{strURI}</uri-string>
</resource-descriptor>
<arguments xmlnssi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="java:com.jaspersoft.jasperserver.api.metadata.xml.domain.impl.Argument">
<name>RUN_OUTPUT_FORMAT</name>
<value>#{strOutputFormat}</value>
</arguments>
</request>
}
driver = SOAP::RPC::Driver.new(strServer)
driver.wiredump_dev = STDERR
driver.options["protocol.http.basic_auth"] << [strServer, strUser, strPWD]
driver.add_method('runReport','request')
puts driver.runReport(strRequest)
What I get is:
<?xml version='1.0 'encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header />
<soapenv:Body><ns1:result xmlns:ns1="http://jasperserver/ws2/namespace1" xmlns:tns="http://ws.apache.org/axis2"><?xml version="1.0" encoding="UTF-8"?>
<operation-result return-code="1"><version>1.1.0</version><message>unable to instantiate java.util.List; </message></operation-result></ns1:result></soapenv:Body></soapenv:Envelope>
Any suggestion?