• Auth and Import Files

  • Do you want to create a native client or integrate with third party applications: webservices are the solution.
Do you want to create a native client or integrate with third party applications: webservices are the solution.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #3226  by Primehaxor
 
Hi, im trying to write some code for auth and upload some files to the api...

I\'ve started trying the example above:

from SOAPpy import WSDL

wsdlAuth = \'http://localhost:8080/OpenKM/OKMAuth?wsdl\'
wsdlSearch = \'http://localhost:8080/OpenKM/OKMSearch?wsdl\'
sAuth = WSDL.Proxy(wsdlAuth)
sSearch = WSDL.Proxy(wsdlSearch)

token = sAuth.login(arg0=\'user\', arg1=\'pass\')
print \'Token: \'+token

xpath = \'/jcr:root/okm:root//element(*,okm:document)[jcr:contains(@okm:keywords,\\\'document\\\')]\'
findByStatementResponse = sSearch.findByStatement(arg0=token, arg1=xpath, arg2=\'xpath\');

sAuth.logout(arg0=token)

for queryResult in findByStatementResponse[\'value\']:
print queryResult



but after set the token var i\'m getting this error:

Traceback (most recent call last):
File \"code.py\", line 8, in <module>
token = sAuth.login(arg0=\'myuser\', arg1=\'mypass\')
File \"/usr/lib/python2.5/site-packages/SOAPpy/Client.py\", line 412, in __call__
return self.__r_call(*args, **kw)
File \"/usr/lib/python2.5/site-packages/SOAPpy/Client.py\", line 434, in __r_call
self.__hd, self.__ma)
File \"/usr/lib/python2.5/site-packages/SOAPpy/Client.py\", line 338, in __call
p, attrs = parseSOAPRPC(r, attrs = 1)
File \"/usr/lib/python2.5/site-packages/SOAPpy/Parser.py\", line 994, in parseSOAPRPC
t = _parseSOAP(xml_str, rules = rules)
File \"/usr/lib/python2.5/site-packages/SOAPpy/Parser.py\", line 976, in _parseSOAP
raise e
xml.sax._exceptions.SAXParseException: <unknown>:1:0: no element found



Regards
 #3230  by jllort
 
I can give to you some examples in python, hope it could help you ( i\'ve got other in php, perl and mono ) [file name=python.zip size=4042]http://www.openkm.com/images/fbfiles/files/python.zip[/file]
 #3231  by Primehaxor
 
ty for reply

im making some tests


no way :(

there\'s something wrong


look the code and the output....

Code: Select all
#!/usr/bin/env python
from SOAPpy import WSDL

wsdlFile = \'http://10.10.10.15:8080/OpenKM/OKMAuth?wsdl\'
wsdlSearch = \'http://10.10.10.15:8080/OpenKM/OKMSearch?wsdl\'
server = WSDL.Proxy(wsdlFile)
sSearch = WSDL.Proxy(wsdlSearch)


print server.methods.keys()
print server.soapproxy

callInfo = server.methods[\'login\']
print callInfo.inparams[0].name
print callInfo.inparams[0].type

print callInfo.inparams[1].name
print callInfo.inparams[1].type

print callInfo.outparams[0].name
print callInfo.outparams[0].type

token = server.login(arg0=\'admin\', arg1=\'admin\')

server.soapproxy.config.dumpSOAPOut = 1
server.soapproxy.config.dumpSOAPIn = 1

Output...
Code: Select all
[u\'getUsers\', u\'revokeUser\', u\'grantUser\', u\'getGrantedUsers\', u\'getRoles\', u\'revokeRole\', u\'grantRole\', u\'logout\', u\'login\', u\'getGrantedRoles\']
<SOAPpy.Client.__Method at 170825132>
arg0
(u\'http://www.w3.org/2001/XMLSchema\', u\'string\')
arg1
(u\'http://www.w3.org/2001/XMLSchema\', u\'string\')
return
(u\'http://www.w3.org/2001/XMLSchema\', u\'string\')
Traceback (most recent call last):
  File \"/home/sergio/Desktop/Python/Codes/OpenKM Integrator/debuggin.py\", line 23, in <module>
    token = server.login(arg0=\'admin\', arg1=\'admin\')
  File \"/usr/lib/pymodules/python2.6/SOAPpy/Client.py\", line 470, in __call__
    return self.__r_call(*args, **kw)
  File \"/usr/lib/pymodules/python2.6/SOAPpy/Client.py\", line 492, in __r_call
    self.__hd, self.__ma)
  File \"/usr/lib/pymodules/python2.6/SOAPpy/Client.py\", line 395, in __call
    p, attrs = parseSOAPRPC(r, attrs = 1)
  File \"/usr/lib/pymodules/python2.6/SOAPpy/Parser.py\", line 1049, in parseSOAPRPC
    t = _parseSOAP(xml_str, rules = rules)
  File \"/usr/lib/pymodules/python2.6/SOAPpy/Parser.py\", line 1032, in _parseSOAP
    raise e
xml.sax._exceptions.SAXParseException: <unknown>:1:0: no element found
i\'ve tried others users too... but no sucess!

Regards!
 #3234  by jllort
 
Ensure Webservices are deployed, because on jboss 4.2.2 sometimes - I don\'t know why - not deployes webservices. On jboss 4.2.3 this problem not appears, but on version 4.2.2 seems is not as stable as we\'d like.
 #3240  by jllort
 
No, sorry for it, but we\'ve only have implemented this minimal examples, you\'ll must do the rest of the job.
 #3243  by Primehaxor
 
yeah but, i\'ve tried so many ways to pass some param, and didn\'t sucess...

The documentation about webservices isn\'t clear for me about some utilities.
 #3245  by jllort
 
Which is the method that has problems to you ?
 #3246  by Primehaxor
 
OKMDocument

method create...


with this one can i upload files?

or can i use another one?
 #3263  by pavila
 
OKMDocument.create is the designed method used to create (also means upload) a new file in the OpenKM repository.
 #3310  by mbosch
 
Re:Auth and Import Files 2 Weeks, 4 Days ago Karma: 15
I can give to you some examples in python, hope it could help you ( i\'ve got other in php, perl and mono )
Could you please post the ones you have with mono? :silly:

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.