Page 1 of 1

Auth and Import Files

PostPosted:Wed Oct 21, 2009 5:25 pm
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

Re:Auth and Import Files

PostPosted:Thu Oct 22, 2009 8:41 am
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]

Re:Auth and Import Files

PostPosted:Thu Oct 22, 2009 7:42 pm
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!

Re:Auth and Import Files

PostPosted:Fri Oct 23, 2009 9:07 am
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.

Re:Auth and Import Files

PostPosted:Fri Oct 23, 2009 3:28 pm
by Primehaxor
:D u right!

4.2.3 working whithout problems


ty =]

Re:Auth and Import Files

PostPosted:Fri Oct 23, 2009 4:22 pm
by Primehaxor
Have some example to create/upload files wrote in python too?


regards,

Re:Auth and Import Files

PostPosted:Sat Oct 24, 2009 8:03 pm
by jllort
No, sorry for it, but we\'ve only have implemented this minimal examples, you\'ll must do the rest of the job.

Re:Auth and Import Files

PostPosted:Sun Oct 25, 2009 6:35 pm
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.

Re:Auth and Import Files

PostPosted:Mon Oct 26, 2009 7:54 am
by jllort
Which is the method that has problems to you ?

Re:Auth and Import Files

PostPosted:Mon Oct 26, 2009 11:16 am
by Primehaxor
OKMDocument

method create...


with this one can i upload files?

or can i use another one?

Re:Auth and Import Files

PostPosted:Mon Nov 02, 2009 12:47 pm
by pavila
OKMDocument.create is the designed method used to create (also means upload) a new file in the OpenKM repository.

Re:Auth and Import Files

PostPosted:Mon Nov 09, 2009 10:55 am
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:

Re:Auth and Import Files

PostPosted:Mon Nov 16, 2009 10:08 am
by nicolaijorgensen
How do I ensure that Webservices are deployed?

I\'m using OpenKM 3.0 with JBoss 4.2.2 on XP...