Return NamingEnumeration object from the webservice method.

I am developing a webservice for creating a connection with LDAP and get user first name from LDAP. For this I developed the following webservice in netbeans 6.0 by using Glass Fish V2 server.
package san.exam;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.naming.*;
import javax.naming.directory.*;
import java.util.*;
@WebService()
public class LDAP {
@WebMethod
public NamingEnumeration getUser(@WebParam(name = "firstName") String firstName) throws Exception {
// TODO implement operation
Hashtable env = new Hashtable();
     env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
     env.put(Context.PROVIDER_URL, "ldap://chdsez89674d:389/");
env.put(Context.SECURITY_AUTHENTICATION,"simple");
     env.put(Context.SECURITY_PRINCIPAL,"cn=root"); // specify the username
env.put(Context.SECURITY_CREDENTIALS,"vicky123");
     // Create the initial context
     DirContext ctx = new InitialDirContext(env);     
     Attributes matchAttrs = new BasicAttributes(true); // ignore attribute name case
     matchAttrs.put(new BasicAttribute("uid", firstName));
NamingEnumeration answer = ctx.search("ou=white pages,dc=ibm",matchAttrs);
     ctx.close();
return answer;
We are not able deploy this webservice. I don�t know what the problem is. But we are able to make web service where we returned int or string or float and able to use this webservice by making webservice client.
I think in this case we are trying to return NamingEnumeration object so the problem has come. Has anyone solve this problem or tell me how to return the NamingEnumeration object in the webservice?
Any pointer regarding this problem is helpful for me.

If you want to transfer an object through RMI it should be Serializable. Add 'implements Serializable' to your class. That's it
import java.io.Serializable;
class TransferObject implements Serializable {
}

Similar Messages

  • How to return a object from a method in a java program to a C++ call (JNI )

    Sir,
    I am new to java and i have been assigned a task to be done using JNI.
    My question is,
    How can i return an object from a method in a java program to a call for the same method in a C++program using JNI.
    Any help or suggesstions in this regard would be very useful.
    Thanking you,
    Anjan Kumar

    Hello
    I would like to suggest that JNI should be your last choice and not your first choice. JNI is hard to get right. Since the JNI code is executing in the same address space as the JVM, any problems (on either side) will take down the entire process. It dilutes the Write Once Run Anywhere (WORA) value proposition because you need to provide the JNI component for all hardware/OS platforms. If you can keep your legacy code(or whatever you feel you need to do in JNI) in a separate address space and communicate via some inter-process channel, you end up with a system that is more flexible, portable, and scalable.
    Having said all that, head over to the Java Native Interface: Programmer's Guide and Specification web page:
    http://java.sun.com/docs/books/jni/
    Scroll down to the Download the example code in this book in ZIP or tar.gz formats. links and download the example source. Study and run the example sources. The jniexamples/chap5/MyNewString demo creates a java.lang.String object in native code and returns it to the Java Language program.

  • Sending files from the remote method

    hi,
    I would like to know if we can send a File object, i.e. a file as the return value from the remote method on the server side accessed by the client.
    Actually, i want to make the files stored at the server system accessible to the client system. how to achieve it?

    java.io.File implements java.io.Serializable so the previous answer is formally incorrect. However you need to be aware that that would only send the File object, which is essentially the filename, not its contents. I'm sure that what the poster meant to say.
    You can send the contents as well in a number of ways but you have to write it by hand. There's no easy way out of the box.

  • Problem in getting the function template object from the repository.

    Hi all,
    I have created a par file. I have a JCO connection in that. I am facing problems in getting the function template object from the repository. This thing is running successfully when i try to deploy it in Tomcat. But i am facing problems when i try to deploy it in SAP EP 6.0.
    Below is statement which is giving error after being deployed to SAP EP6.
    This is executing fine when executed in Tomcat Server.
    // getting the object of function template
    IFunctionTemplate functionTemplate =
    aRepository.getFunctionTemplate("YADDNEWUSER");
    Note : YADDNEWUSER is the name of the RFC which I am calling from my JAVA Code.
    Thanks in advance,
    Divija

    This sounds like a bug in the smart upload code. I have used this stuff before, but it's probably an older version, so maybe they broke something. Enumerations aren't usually guaranteed to keep things in any particular order. I would say for now, make a method to take the enumeration and a param name to find the value. And write to the JSPSmart people.

  • How to remove the recursion from the following method

    Hi All,
    Can u plz help me to remove the recursion from the following method.
    The problem here is that recursion cann't be removed easily here as there is no any end condition.
    hopefully waiting for the help....
    Reema.
    private FilterStatement processCustomExpressions(FilterStatement statement,
              DistinguishedName tenant, LdapDao ldapDao)
              throws NameNotFoundException,
              LDAPServerException, NamingException {
         HashMap relMap = new HashMap();
         HashMap replaceMap = new HashMap();
         Vector relVec = null;
              FilterSubExpressions expressions = statement.getExpressions();
              FilterPartIterator it = (FilterPartIterator)expressions.iterator();
              while (it.hasNext()) {
                   FilterExpression e = (FilterExpression)it.next();
                   if (e instanceof CustomExpression) {
                        CustomExpression ce = (CustomExpression)e;
                        try {
                             FilterExpression fe = ce.createExpression();
                             if (fe instanceof RelationshipExpression) {
                                  RelationshipExpression re = (RelationshipExpression)fe;
                                  it.replace(re);
                                  relVec = (Vector) relMap.get(re.name);
                                  if(relVec == null) {
                                       relVec = new Vector();
                                       relVec.add(re);
                                  }else {
                                       relVec.add(re);
                                       it.remove();
                                  relMap.put(re.name, relVec);
                             } else if (fe instanceof SystemExpression) {
         SystemExpression se = (SystemExpression)fe;
         it.replace(se);
                        } catch (FilterEvaluationException fe) {
                             traceLogger.exception(Level.DEBUG_MIN, this,
                                  "processCustomExpressions(" + statement.toString() + ")", fe);
                             SystemLog.getInstance().logError(this,
                                  "processCustomExpressions(" + statement.toString() + ")", fe.getMessage());
              replaceRelationshipExpressions(statement, tenant, ldapDao, relMap);
              processContainerBasedExpressions(tenant, ldapDao, relMap, replaceMap);
              FilterSubStatements statements = statement.getStatements();
              FilterStatement temp = null;
              if (statements.size() != 0) {          
                   FilterPartIterator iter = (FilterPartIterator)statements.iterator();
                   while (iter.hasNext()) {
                        temp = (FilterStatement)iter.next();
                        temp = processCustomExpressions(temp, tenant, ldapDao);
                        iter.replace(temp);
              if(!replaceMap.isEmpty())
                   return replaceContainerBasedExpressions(statement, replaceMap);
              return statement;
         }

    I think one of the reasons that noone will reply to your posting is that you take it a bit too easy. First of all, please use the "code" button to format your code listings. Then it will look like this (see below) and everybody can at least read it!
    private FilterStatement processCustomExpressions(FilterStatement statement,
                                                    DistinguishedName tenant,
                                                    LdapDao ldapDao)
            throws NameNotFoundException, LDAPServerException, NamingException {
        HashMap relMap = new HashMap();
        HashMap replaceMap = new HashMap();
        Vector relVec = null;
        FilterSubExpressions expressions = statement.getExpressions();
        FilterPartIterator it = (FilterPartIterator) expressions.iterator();
        while (it.hasNext()) {
            FilterExpression e = (FilterExpression) it.next();
            if (e instanceof CustomExpression) {
                CustomExpression ce = (CustomExpression) e;
                try {
                    FilterExpression fe = ce.createExpression();
                    if (fe instanceof RelationshipExpression) {
                        RelationshipExpression re = (RelationshipExpression) fe;
                        it.replace(re);
                        relVec = (Vector) relMap.get(re.name);
                        if (relVec == null) {
                            relVec = new Vector();
                            relVec.add(re);
                        else {
                            relVec.add(re);
                            it.remove();
                        relMap.put(re.name, relVec);
                    else if (fe instanceof SystemExpression) {
                        SystemExpression se = (SystemExpression) fe;
                        it.replace(se);
                catch (FilterEvaluationException fe) {
                    traceLogger.exception(Level.DEBUG_MIN, this,
                                "processCustomExpressions("
                                + statement.toString()
                                + ")",
                            fe);
                    SystemLog.getInstance().logError(this,
                                "processCustomExpressions("
                                + statement.toString()
                                + ")",
                            fe.getMessage());
        replaceRelationshipExpressions(statement, tenant, ldapDao, relMap);
        processContainerBasedExpressions(tenant, ldapDao, relMap, replaceMap);
        FilterSubStatements statements = statement.getStatements();
        FilterStatement temp = null;
        if (statements.size() != 0) {
            FilterPartIterator iter = (FilterPartIterator) statements.iterator();
            while (iter.hasNext()) {
                temp = (FilterStatement) iter.next();
                temp = processCustomExpressions(temp, tenant, ldapDao);
                iter.replace(temp);
        if (!replaceMap.isEmpty())
            return replaceContainerBasedExpressions(statement, replaceMap);
        return statement;
    }Second, when you cannot understand your own code anymore, simplify it! As far as I can see, there are two "main" processes (i.e. loops) in your method, where the second one calls the method recursively. Split the method into two. Furthermore, write a third method that processes the iterated elements and call that method from out of the loops.
    I did'nt analyse your method and have no idea what it does at all. I'm merely telling my first impression.
    Good luck.

  • How to remove unused objects from the webcatalog In OBIEE11g

    Hi,
    I want to delete unused objects from obiee11g catalog, i know in obiee10g it's working fine (i.e: we can do it via manage catalog then delete the unused objects) is there any way to do it automatically like RPD utility --->removing unused objects from Physical layer in RPD
    fyi: I don't want to delete manualy. i need somethink like button/link to find unused objects(report,filter,folder..etc) from my obiee11g catalog.
    Thanks
    Deva
    Edited by: Devarasu on Nov 29, 2011 12:06 PM
    Edited by: Devarasu on Nov 29, 2011 3:15 PM

    Hi,
    Checked with Oracle Support team and confirmed below points
    --> incorporated into the Current product and consider as BUG it may resolve future release
    --> Currently there isnt any automatic method to remove the unused objects like reports, filters,folder etc from catalog.
    Treated as Bug
    Bug 13440888 - AUTOMATICALLY REMOVE OF UNUSED CATALOG OBJECTS FROM WEBCATALOG
    FYI:
    SR 3-4984291131: How to remove unused objects from the webcatalog in obiee11g
    Thanks
    Deva

  • Pass an object from a static method

    Hi,
    I'm trying to pass a reference to an object from a static method, but I get an error when compiling.
    Say for example I have this:
    public class obj1 {
    public void myMethod (int i, Object ob, etc...) {
    ...and I want to call this method from a method that looks like this:
    public class obj2 {
    public static int anotherMethod(...) {
    obj1.myMethod(1,this,...);
    ...Can I pass a reference from obj2 to obj1 any other way?
    Thanks alot.

    how can I get a reference to obj2 then?Pay no attention to zdude's answer - it's nonsense.
    You're confused about basic Java concepts. obj2 is a class, not an object. References point to objects, not classes. There is no obj2 object in the code you show, so you cannot have a reference to an obj2 object.
    Maybe if you post some more code, we can get an idea of what you're trying to do. You might want to try the New to Java forum.

  • Deleting objects from the stage

    Hi all,
    I've got some items on my stage that I'm removing with
    RemoveChild(). The items no longer show, however, as stated in
    LiveDocs, the item is not actually destroyed. This means any
    bindings/listeners created by that object are still in existence
    and are creating errors (Specifically, I'm getting "The supplied
    DisplayObject must be a child of the
    caller").
    LiveDocs mentions that if I want to actually delete an object
    from the stage entirely, I should use the "delete operator", but
    for the life of me, I can not find any documentation on the
    existence of such an operator. Any advice would be much
    appreciated.
    -Hob

    It IS ridiculously hard to find. Searcing Live Docs for
    delete oprator will turn up a slew of hits, but which is the right
    one?
    This is from old docs, but it is still valid:
    http://livedocs.adobe.com/flash/8/main/00001865.html
    Tracy

  • How do you call a java class from the main method in another class?

    Hi all,
    How do you call a java class from the main() method in another class? Assuming the two class are in the same package.
    Thanks
    SI
    Edited by: okun on May 16, 2010 8:40 PM
    Edited by: okun on May 16, 2010 8:41 PM
    Edited by: okun on May 16, 2010 8:47 PM

    georgemc wrote:
    To answer your impending question, either the method you're calling has to be static, or you need an instance of that other class to invoke it against. Prefer the latterAnd to your impending question after that: no, don't use the Singleton pattern.

  • Copy all the objects from the one system that start with (ZANK)

    hi to all,
    I have installed the name space /ank/ in the US system, we need to copy all the objects from the India system that start with (Zank) and re-create them as /ank/. problem is how can i copy objects and re-create.
    thanks

    Hi Ankal,
    I guess this is your second thread on the same question. Ok provide these information
    >>I have installed the name space /ank/ in the US system,
    Are you saying that you have a machine (US System) and i has a namespace /ank/ ? What all objects are there in this namespace?
    >>we need to copy all the objects from the India system that start with (Zank) and re-create them as /ank/.
    Is the India system on the same US system?
    Also tell me whether you have opened the home page of SAP XI/PI?  If yes , are you able to open Integration Repository? If yes then how these US and India systems are referred in Integration Repository? Are they referred as separate software components?
    Regards
    Suraj

  • How do I remove an object from the foreground of a photo eg a fence?

    How do I remove an object from the foreground of a photo eg a fence?

    What version of Photoshop?
    If CC then try here
    Learn Photoshop CC | Adobe TV

  • How to suppress compiler errors without excluding database objects from the "Schema Compare" tool (using VS2013/SSDT)

    Hi,
    In short: How to suppress compiler errors without excluding the object from the "Schema Compare" tool ??
    A bit longer:
    We have a SQL Server 2008 project in Visual Studio 2013 running SQL Server Data Tool.
    An old database, with a lot of history in, has been imported into SSDT and there are many syntax errors preventing the project from compiling/running. An typical error is: "SQL70001: This statement is not recognized in this context".
    Running the "faulty" scripts on the server, executes just fine. I understand that there are syntax errors and they should be rewritten, but it's not gonna happen just like that - it is a slow process over a long period of time.
    I know it is possible to change Build Action to None, but that also exclude the object from appearing in the Schema Compare function/window.
    So - how to ignore some compiler errors and still having the objects to appear when doing "Schema Compare" ??
    Thank you in advance.

    Hi Steven,
    Thanks for your comments.
    Well, it sure does help in the future, but right now i would prefer the other way - to suppress some errors and still allow the scripts to build.
    The thing is that if we "rewrite" the objects into create scripts, then we have a huge test job ahead of us + the database environments (PROD vs DEV and UAT) does not share the same AD or DB users and therefore grants is lost if dropping/creating
    objects, right!
    If you drop a object before creating it, the drop will also drop the roles and grants and since they don't share user table, the create will not be able to add the permissions again. There might be a solution to that, but it is going to be very complicated
    for some newbies like us. We need something we can trust.
    BR
    Peter

  • [Cp] Select object from the timeline and move it on slide with cursor keys ?

    Hello,
    I don't know if there's a shortcut for this :
    Sometimes, it's easier to select an object from the timeline but if you try to use cursor keys to move it, you're in fact moving IN the timeline.
    Is there a way to switch to Slide edition ?
    Thanks.
    PJ

    You can not only use the cursor keys, but also in combination with other keys. And indeed, you have to move the cursor over the stage:
    http://blog.lilybiri.com/shortcut-keys-part-1-moving-and-resizing-obje    about shortcut keys for the stage
    http://blog.lilybiri.com/tiny-timeline-tidbits    about shortcut keys for the Timeline
    There is a list with shortcut keys in the Help, but not complete.

  • [svn:osmf:] 14486: Add stream metadata support by extracting the actual metadata object from the binary data stream .

    Revision: 14486
    Revision: 14486
    Author:   [email protected]
    Date:     2010-03-01 14:27:41 -0800 (Mon, 01 Mar 2010)
    Log Message:
    Add stream metadata support by extracting the actual metadata object from the binary data stream.
    Fix bug 466
    Modified Paths:
        osmf/trunk/framework/OSMF/org/osmf/elements/f4mClasses/ManifestParser.as
        osmf/trunk/framework/OSMF/org/osmf/elements/f4mClasses/Media.as
        osmf/trunk/framework/OSMF/org/osmf/net/httpstreaming/HTTPStreamingUtils.as
        osmf/trunk/framework/OSMF/org/osmf/net/httpstreaming/f4f/HTTPStreamingF4FIndexHandler.as
        osmf/trunk/framework/OSMF/org/osmf/net/httpstreaming/f4f/HTTPStreamingF4FStreamInfo.as

    same problem, data not replicated.
    its captured,propagated from source,but not applied.
    also no apply errors in DBA_APPLY_ERROR. Looks like the problem is that LCRs propagated from source db do not reach target queue.can i get any help on this?
    queried results are as under:
    1.at source(capture process)
    Capture Session Total
    Process Session Serial Redo Entries LCRs
    Number ID Number State Scanned Enqueued
    CP01 16 7 CAPTURING CHANGES 1010143 72
    2. data propagated from source
    Total Time Executing
    in Seconds Total Events Propagated Total Bytes Propagated
    7 13 6731
    3. Apply at target(nothing is applied)
    Coordinator Session Total Total Total
    Process Session Serial Trans Trans Apply
    Name ID Number State Received Applied Errors
    A001 154 33 APPLYING 0 0 0
    4. At target:(nothing in buffer)
    Total Captured LCRs
    Queue Owner Queue Name LCRs in Memory Spilled LCRs in Buffered Queue
    STRMADMIN STREAMS_QUEUE 0 0 0

  • Returning more than one value/object from an EJB method

    Hi,
    I have the follong method in the remote interface of my EJB:
    void createSomeObject( MyObject obj1, List returnList1, Map returnMap1);
    Since i want to return a List (returnList1) and a Map(returnMap1) from my EJB method "createSomeObjects", i am passing these as parameters thinking they will be passed by reference and the client(servlet) gets the changes the EJB made to these objects.
    But it doesn't seem to be working, the EJB is filling the List and Map objects and the servlet doesn't get it (pass by value problem).
    My understading is that, all parameters to an EJBs are passed by value(because they are remote calls, the RMI thing), let me know if this right.
    Is there any workaround apart from the following alternative?
    Alternatives:
    1. Wrap "List list1" and "Map map1" in another model and return this instead of passing them as parameters.
    Thanks
    Vasu

    My understading is that, all parameters to an EJBs
    are passed by value(because they are remote calls,
    the RMI thing), let me know if this right.Yes, that is correct - which you should know from your introduction to J2EE reading.
    Is there any workaround apart from the following
    alternative?
    Alternatives:
    1. Wrap "List list1" and "Map map1" in another model
    and return this instead of passing them as
    parameters.No.

Maybe you are looking for

  • Change default value "Number of Search Results" - Component PPM_DYNSEARCH

    Hi Gurus, I am new to SAP CRM WebUI development and hope you can help me on following problem. In Pipeline & Performance Management we want to change the default value for the search results from 100 to 1000. SAP CRM 7.0 Component: PPM_DYNSEARCH View

  • Server Newbie. TM help

    I had a WD ext HDD fire wired to my imac & backed TM directly to there. I have just set up Mac mini server & thought I would be able to plug in the ext HDD to the mac mini & then wirelessly back up my Imac to the same backup folder created when ti wa

  • A slightly different backlight question

    I've heard some other people have had a problem with the backlight of their iBooks turning off and then not coming back. I've had the same problem but it tends to happen when I adjust the screen. I'll push it back slightly and it will turn off. If I

  • Imqjmsra.rar references imq.jar which is not inside RAR ... and ra.xml

    When deploying the RAR file to JBoss 4.0.5, it shows the following 2006-12-01 15:49:06,040 DEBUG [org.jboss.deployment.MainDeployer] The manifest entry in file:/home/jsalvo/jboss-4.0.5.GA/server/default/tmp/depl oy/tmp5798imqjmsra.rar-contents/imqjmx

  • IPod touch 2.2.1 version upgrade?

    I have an iPod touch 16 GB version 2.2.1 that a friend recently gave me.  Most of the apps seem to work only on the more recent versions.  Is there any way to update the firmware to more recent version?