API: LOGINUSER response not proper

Mahendra shared this question 4 years ago
Answered

I am using Ruby on Rails to make request to Yellowfin server using below code.

wsdl_url = 'http://52.76.137.98:7075/services/AdministrationService?wsdl'

base_url = 'http://52.76.137.98:7075/'

userNameToLogin = 'xxxx@gmail.com'

userPasswordToLogin = 'xxxxx'

webserviceAdmin = 'xxxx@qest.com'

webserviceAdminPassword = '123456'

paramsse= Hash.new

userToLogin= Hash.new

userToLogin['userId']=userNameToLogin;

userToLogin['password']=userPasswordToLogin;

paramsse['function']='LOGINUSER'

paramsse['person']= userToLogin

paramsse['loginId']= webserviceAdmin

paramsse['password']= webserviceAdminPassword

paramsse['orgId']=1

paramsse['ntlm']=false


uri = URI(wsdl_url)

uri.query = URI.encode_www_form(paramsse)

res = Net::HTTP.get_response(uri)

puts res.body if res.is_a?(Net::HTTPSuccess)


The GET request is successfull but the body contains just


"<h1>AdministrationService</h1>\n<p>Hi there, this is an AXIS service!</p>\n<i>Perhaps there will be a form for invoking the service here...</i>\n"


No other details.


Please advise how to get the proper response.

Comments (2)

photo
1

Hi Mahendra,

I am not entirely familiar with Ruby on Rails, but it looks as though you are trying to use this as a REST API. Yellowfin's web-services are built around SOAP API calls, so you will need to instantiate a client and then pass any calls through that.

A brief google led me:

http://savonrb.com/


Please let me know your thoughts.

Nathan

photo
1

Hi Nathan,

Thanks for the help. I am using Savon for SOAP now.

I used following function to call service.

wsdl_url = 'http://52.76.137.98:7075/services/AdministrationService?wsdl'

client = Savon.client(wsdl: wsdl_url)


I used client.operations to list methods which returned [:remote_administration_call, :add_column_to_views]

when I tried to call service as per the PHP example code,

response = client.call(:remote_administration_call, message: {"function": "LOGINUSER", "person": { "userId": "xxxx@gmail.com", "password": "xxxx"}, "loginId": "xxxx", "password": "xxxx", "orgId": 1, "ntlm": false})

I got error Savon::SOAPFault: (Server.userException) No such operation 'remoteAdministrationCall'

but when tried using

response = client.call(:remote_administration_call, message: {"function": "LOGINUSER"})

it's providing some response which could be accessed using response.body

Please check what am I doing wrong.

photo
1

Hi Mahenda,

Again, I am not familiar with ruby on rails so I cannot say for certain, but in python, after loading the suds client, you can made administration calls with:

client.service.remoteAdministrationCall(call)

Is this function available to you?

It might be worth exploring exactly what methods are available through the client. In Python I typically will use dir() to achieve this...after a quick google it looks like the ruby equivalent is:

.methods.inspect
Nathan

photo
photo
1

Hi Mahendra,

I am going to close this ticket.

Cheers,

Nathan