Forum Discussion

payam's avatar
payam
Contributor
12 years ago

[Resolved]LDAP Data Connection and Data Source

Our tries to use groovy libraries to connect to LDAP data source were unsuccessful:
http://directory.apache.org/api/groovy-ldap.html

It would be a great feature to have LDAP along with other data connections because one of the most high volume uses of web services is for directory and subscription based services that utilize LDAP as the primary or secondary data source.
  • nmrao's avatar
    nmrao
    Champion Level 3
    Thank you for the link.
    It would be great to know the details of how it is tried & what problem being faced.
  • Actually it is fixed now, we found the missing library files same day but I was too lazy to update the thread (however having the real LDAP support implementation would be great).
    You just need to include library files in to your bin/ext. then if you add following two lines in the script and didn't see the infamous "can not be resolved" error, you're set to go
    import org.apache.directory.groovyldap.LDAP
    import org.apache.directory.groovyldap.SearchScope


    Unfortunately the provided jar files are incomplete so you'll need to add 2-3 more jars, I tried to attach the zipped file here but I have limitation of only 2mb upload while the compressed file is around 5mb. Please let me know if I can upload it somewhere.

    The rest can be found in the provided link.
  • rktella6's avatar
    rktella6
    Occasional Contributor

    I am unable to connect to LDAP through groovy in ReadyAPI. I have added all ldap jar files under lib  folder and re-started ReadyAPI. I tried same in ReadyAPI 1.3.1 and 1.9 version, but getting below error.

     

    In the groovy script I called like this

     

    import org.apache.directory.groovyldap.LDAP
    import org.apache.directory.groovyldap.SearchScope

     

    LDAP connection = LDAP.newInstance("ldap://devldapwt.xxxx.com:389","cn=iwsusercontextuser,ou=usercontextusers,ou=people,o=xxxx.com", "2qy80bd")

     

    It is failing at the first line itself.

     

     

    org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script11.groovy: 2: unable to resolve class org.apache.directory.groovyldap.SearchScope @ line 2, column 1. import org.apache.directory.groovyldap.SearchScope ^ org.codehaus.groovy.syntax.SyntaxException: unable to resolve class org.apache.directory.groovyldap.SearchScope @ line 2, column 1. at org.codehaus.groovy.ast.ClassCodeVisitorSupport.addError(ClassCodeVisitorSupport.java:146) at org.codehaus.groovy.control.ResolveVisitor.visitClass(ResolveVisitor.java:1222) at org.codehaus.groovy.control.ResolveVisitor.startResolving(ResolveVisitor.java:175) at org.codehaus.groovy.control.CompilationUnit$11.call(CompilationUnit.java:648) at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:928) at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:590) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:539) at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:297) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:267) at groovy.lang.GroovyShell.parseClass(GroovyShell.java:692) at groovy.lang.GroovyShell.parse(GroovyShell.java:704) at groovy.lang.GroovyShell.parse(GroovyShell.java:740) at groovy.lang.GroovyShell.parse(GroovyShell.java:731) at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.compile(SoapUIGroovyScriptEngine.java:138) at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:89) at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SoapUIProGroovyScriptEngineFactory.java:76) at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:155) at com.eviware.soapui.impl.wsdl.panels.teststeps.GroovyScriptStepDesktopPanel$RunAction$1.run(GroovyScriptStepDesktopPanel.java:263) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Script11.groovy: 1: unable to resolve class org.apache.directory.groovyldap.LDAP @ line 1, column 1. import org.apache.directory.groovyldap.LDAP ^ org.codehaus.groovy.syntax.SyntaxException: unable to resolve class org.apache.directory.groovyldap.LDAP @ line 1, column 1. at org.codehaus.groovy.ast.ClassCodeVisitorSupport.addError(ClassCodeVisitorSupport.java:146) at org.codehaus.groovy.control.ResolveVisitor.visitClass(ResolveVisitor.java:1222) at org.codehaus.groovy.control.ResolveVisitor.startResolving(ResolveVisitor.java:175) at org.codehaus.groovy.control.CompilationUnit$11.call(CompilationUnit.java:648) at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:928) at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:590) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:539) at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:297) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:267) at groovy.lang.GroovyShell.parseClass(GroovyShell.java:692) at groovy.lang.GroovyShell.parse(GroovyShell.java:704) at groovy.lang.GroovyShell.parse(GroovyShell.java:740) at groovy.lang.GroovyShell.parse(GroovyShell.java:731) at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.compile(SoapUIGroovyScriptEngine.java:138) at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:89) at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SoapUIProGroovyScriptEngineFactory.java:76) at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:155) at com.eviware.soapui.impl.wsdl.panels.teststeps.GroovyScriptStepDesktopPanel$RunAction$1.run(GroovyScriptStepDesktopPanel.java:263) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) 2 errors

     

     

    Any help would be appreciate.

     

    Thanks

    Ravi