Friday, January 14, 2011
Let netbeans edit bxml files
In NB 6.8, here's how to tell netbeans to treat bxml files as xml.
Go to tools -> options -> Miscellaneous -> Files.
Click 'New'
Set bxml as the file extension.
Under 'Associated File Type:' select 'XML Files (text/xml)
Click OK
Thursday, January 13, 2011
Monday, January 10, 2011
Accessing the ACE IMS via python
Using hashlib, and binascii we can use python to both generate a digest and grab an ace token for that digest.
While this example only sends one request in a call, you should batch your requests prior to requesting a token. Just send a 'list' of tokenRequest objects to requestTokensImmediate. The IMS will support up to 10,000 requests per call.
import hashlib import binascii from suds.client import Client filename='test2.py' digFile = open(filename,'rb') hashAlg = hashlib.sha256() hashAlg.update(digFile.read()) filedigest = binascii.b2a_hex(hashAlg.digest()) url='http://ims.umiacs.umd.edu:8080/ace-ims/IMSWebService?wsdl' client = Client(url) print filename, ' ', filedigest request = client.factory.create('tokenRequest') request.hashValue = filedigest request.name = filename result = client.service.requestTokensImmediate('SHA-256-0',request) print resultThe result spits back a token that you can use to validate a file.
[python] [toaster@loach ace-cli]$ python test2.py test2.py 164182eef9792e2e1c5005cd9240ff508aef042b8fa344597431eae39370c784 [(tokenResponse){ digestService = "SHA-256" name = "test2.py" proofElements[] = (proofElement){ hashes[] = "c5e82872eeee3dfa539202a9757f8a5364b6fded4dfcb40b66084158f2b5c627", index = 0 }, (proofElement){ hashes[] = "6e16a71847403f4e586625463160993bfab189c0bba771d81354c03d9c3591fd", index = 0 }, (proofElement){ hashes[] = "0879b385c366d07142446a18dfb6d19c468a733991e9685fc75ce6f4b929b659", index = 0 }, (proofElement){ hashes[] = "e19dd18bd9eabf79a074d72231a7117bd2319a859d31a429575b4657e85d0c95", index = 1 }, roundId = 2893078 statusCode = 100 timestamp = 2011-01-07 13:08:27.000253 tokenClassName = "SHA-256-0" }]
Subscribe to:
Posts (Atom)