11/28/2010 7:27:45 PM
 Russell F Posts: 16
|
HI folks
I am currently writing a Ruby class to interface to SS. I have nearly everything going now but I am having problems with the AddSecret method.
I am using the http GET method and the docs are clear for the other method but I am not sure I have the right interpretation for Add:
here is the url I am using (slightly sanitised): <a href="https://ss.auckland.ac.nz/webservices/SSWebService.asmx/?AddSecret&Token=2fe4e154....65d&secretTypeId=6004&secretName=testpw&secretFieldIds=93&secretFieldIds=94&secretFieldIds=91&secretItemValues=test&secretItemValues=root&secretItemValues=tickle.insec">https://ss.auckland.ac.nz/webservices/SSWebService.asmx/?AddSecret&Token=2fe4e154....65d&secretTypeId=6004&secretName=testpw&secretFieldIds=93&secretFieldIds=94&secretFieldIds=91&secretItemValues=test&secretItemValues=root&secretItemValues=tickle.insec</a>
i.e. a list of secretTypeId's followed by a list of secretItemValues. Is this the way it is supposed to work?
The ruby xml stuff is barfing on what comes back from the web server and I can not easily get at the raw output
/home/rful011/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rexml/parsers/baseparser.rb:341:in `pull': Missing end tag for 'br' (got "td") (REXML::ParseException) Line: 82 Position: 5393
Any idea as to what is wrong.
BTW I intend to post this on Github when it is done.
Russell
|
|
|
0
• link
|
11/29/2010 7:38:27 AM
 Kevin Administrator Posts: 219
|
Hi Russell,
Thanks for taking the time to write a Ruby script! I'd be very interested in seeing your results.
Regarding your issue, the missing end tag from "br" and got "td" makes me think that the server is responding with HTML, not XML/SOAP. An HTML response typically means a server-side exception occurred. You'd need to be able to access the raw results to see why.
Working with XML SOAP can be tricky - have you considered using a gem that makes working with SOAP easier? soap4r is a popular gem for that. There are a few reasons why using SOAP with an HTTP POST have benefits.
1. Currently an HTTP GET will log the query string into the IIS logs. If you call AddSecret with a password in the query string, that password is now stuck in an IIS log file somewhere.
2. I've had limited success with query strings, posting an XML SOAP chunk seems to offer better results.
I'll see if I can make any headway on this myself.
|
|
|
0
• link
|
11/29/2010 1:05:22 PM
 Russell F Posts: 16
|
Thanks Kevin!
yes, the apparent html puzzled me too. All the other call return xml as expected.
And thanks for pointing out the issues with GET -- I knew there was a reason I should be using POST. Doh!
I've not used SOAP before but will certainly look at soap4r in the longer term. In the meantime I have a short term project that we need the script for..
|
|
|
0
• link
|
11/30/2010 12:01:56 PM
 Russell F Posts: 16
|
making progress 
I found the problem that was causing grief yesterday. an extraneous '?' in the url.
I've also moved from get to post - that was when I spotted the problem in the url.
Now I am getting a "500" response from IIS:
url: <a href="https://secretserver.auckland.ac.nz/secretserver/webservices/SSWebService.asmx/AddSecret">https://secretserver.auckland.ac.nz/secretserver/webservices/SSWebService.asmx/AddSecret</a>
body of post: Token=3af74a6737ee7ecfa8eb5eebc42bb26a0ba8e1d72c5e162a6b460fd089eb3f8e9186007ff9b578d7a7b5e7de912b0bd01491e7fddc8d43b748701e63f26699466fdbb95f9a23cbbc1a1f54da6f88ea5d59727ac5d221e651c3931b06a8747ab73fe8300c455c5ca94b5e8f0f97aab67d&secretTypeId=6004&secretName=testpw&secretFieldIds=93&secretFieldIds=94&secretFieldIds=91&secretItemValues=test&secretItemValues=root&secretItemValues=tickle.insec&folderId=
Server Response:
#, @headers={"cache-control"=>["private"], "content-length"=>["103"], "content-type"=>["text/plain; charset=utf-8"], "server"=>["Microsoft-IIS/7.5"], "x-aspnet-version"=>["2.0.50727"], "x-powered-by"=>["ASP.NET"], "date"=>["Tue, 30 Nov 2010 01:20:23 GMT"], "connection"=>["close"]}>
clearly something is not kosher with my addsecret request.
I have also has a look at SOAP -- it is anything but simple I notice that soap4r has been dropped from the Ruby distro and I am having issues with savon. Isn't IT wonderful, but it keeps us in a job
|
|
|
0
• link
|
11/30/2010 12:53:51 PM
 Russell F Posts: 16
|
I am getting a error return from soap -- about two pages of html, sigh...
I think this is the crucial bit:
User: UOA\svc-secretserver" /> Application Error InvalidOperationExceptionRequest format is unrecognized for URL unexpectedly ending in '/'. See technical details System.InvalidOperationException: Request format is unrecognized for URL unexpectedly ending in '/'.
and here is my little test program:
require 'rubygems' require 'savon' require 'pp'
#"secretserver.auckland.ac.nz", "secretserver", 'rful011', password, '', 'EC'
client = Savon::Client.new "<a href="https://secretserver.auckland.ac.nz/secretserver/webservices/SSWebService.asmx/?wsdl"">https://secretserver.auckland.ac.nz/secretserver/webservices/SSWebService.asmx/?wsdl"</a>
resp = client.authenticate! { |soap| soap.input = [ "Authenticate", {"xmlns" => "urn:thesecretserver.com"} ] soap.body = {:username=>'rful011', :password=> 'xxxx'} }
pp resp
|
|
|
0
• link
|
12/23/2010 1:27:15 PM
 Jonathan J Posts: 4
|
"<a href="https://secretserver.auckland.ac.nz/secretserver/webservices/SSWebService.asmx/?wsdl"">https://secretserver.auckland.ac.nz/secretserver/webservices/SSWebService.asmx/?wsdl"</a>
You have a forward slash between .asmx and ?. That shouldn't be there.
<a href="https://secretserver.auckland.ac.nz/secretserver/webservices/SSWebService.asmx?wsdl">https://secretserver.auckland.ac.nz/secretserver/webservices/SSWebService.asmx?wsdl</a>
|
|
|
0
• link
|
1/16/2011 7:02:04 PM
 Russell F Posts: 16
|
THanks!
Doh! I'd spent hours peering at that!
now getting very close with my program sending what appears to be the correct XML for the AddSecret SOAP:
root 6BMg2lcuC$qO test.insec 075aef4f3a257bc2f398cf.... 6007 Test pw 111 110 108
but SS comes back with the error: "Secret Template is out of date."
What exactly is it trying to tell me?
|
|
|
0
• link
|
1/16/2011 7:04:21 PM
 Russell F Posts: 16
|
mumble -- stripped all the tags even though I put it in ''
Is there a way to post "code" ?
|
|
|
0
• link
|
1/16/2011 7:25:15 PM
 Russell F Posts: 16
|
Hmp!...
Just done what I should have done before posting and googled on the error message and found: <a href="http://www.thycotic.com/products_secretserver_forums.html?postid=1732">http://www.thycotic.com/products_secretserver_forums.html?postid=1732</a>
Answer is that you need to provide entries for *all* fields in the template.
I now have a Ruby class that does most of the basic SS operations via SOAP. It need a bit of polishing and some more work to add the rest of the Actions but the difficult stuff is done.
I'll put it up on github and post a note here when I do.
Russell
|
|
|
0
• link
|