DCOM server development

Help
2013-07-09
2013-07-10
  • Andrey Romanenko

    Hello,

    We are working on j-interop to add DCOM server capabilities.

    So far, the IRemmoteActivation:RemoteActivation method has been added and a possibility to launch oxidResolver on port 135.

    In an sample test server, a local object is created:

    JILocalInterfaceDefinition iface = new JILocalInterfaceDefinition(clsId, false);
    JILocalParamsDescriptor descr = new JILocalParamsDescriptor();
    descr.addInParamAsType(Integer.class, JIFlags.FLAG_NULL);
    JILocalMethodDescriptor methodDescriptor = new JILocalMethodDescriptor("Ping", 0x0, descr);
    iface.addMethodDescriptor(methodDescriptor);
    JILocalCoClass lc = new JILocalCoClass(iface, new SimpleTestClass(), true);
    IJIComObject jo = JIObjectFactory.buildObject(_session, lc);

    however, inside RemoteActivation call:
    JIComOxidDetails oxid = JIComOxidRuntime.getComponentFromIPID(clsid.toString());
    JILocalCoClass jlc =JIComOxidRuntime.getJavaComponentFromIPID(clsid.toString());

    with the ClsID used to create the interface above produce null results. So, I believe this way is wrong. What is the right way to look up locally created objects so that RemoteActivation can send the info back to the client (oxid, IremoteUnknown, IDispatch, etc)?

    Thanks!

    Best Regards,
    Andrey

     
  • Andrey Romanenko

    Just an update:

    I was able to add a method:
    static JILocalCoClass getJavaComponentFromIID(String iid)
    {
    JILocalCoClass component = null;
    synchronized (mutex2) {
    for (int i = 0; i < listOfExportedJavaComponents.size(); i++ )
    {
    component = (JILocalCoClass)listOfExportedJavaComponents.get(i);
    //this will be unique, no two components will ever have same IPID for an IID.They will have different IPIDs for same IIDs.
    if (component.getCoClassIID().equalsIgnoreCase(iid))
    {
    break;
    }
    component = null;
    }
    }
    return component;
    }

    that finds the local "server". However, I cannot use

    JIInterfacePointer interfacePointer = JIComOxidRuntime.getInterfacePointer(cls.getSession(), cls);

    because the system complaints that the object has been exported. How can one find the oxid and IPIDs of the interfaces that have to be returned by RemoteActivation()? Thanks!

    Best Regards,
    Andrey

     
    • Vikram Roopchand

      Hi,

      Can you please have a look at the MSInternetExplorer.java example
      (src->"test" package). It demonstrates creating a local DCOM server.

      You should not be needing any OXIDs, or IPIDs.

      thanks,
      best regards,
      Vikram

      On Tue, Jul 9, 2013 at 10:05 PM, Andrey Romanenko androm@users.sf.netwrote:

      Just an update:

      I was able to add a method:
      static JILocalCoClass getJavaComponentFromIID(String iid)
      {
      JILocalCoClass component = null;
      synchronized (mutex2) {
      for (int i = 0; i < listOfExportedJavaComponents.size(); i++ )
      {
      component = (JILocalCoClass)listOfExportedJavaComponents.get(i);
      //this will be unique, no two components will ever have same IPID for an
      IID.They will have different IPIDs for same IIDs.
      if (component.getCoClassIID().equalsIgnoreCase(iid))
      {
      break;
      }
      component = null;
      }
      }
      return component;
      }

      that finds the local "server". However, I cannot use

      JIInterfacePointer interfacePointer =
      JIComOxidRuntime.getInterfacePointer(cls.getSession(), cls);

      because the system complaints that the object has been exported. How can
      one find the oxid and IPIDs of the interfaces that have to be returned by
      RemoteActivation()? Thanks!

      Best Regards,
      Andrey


      DCOM server developmenthttps://sourceforge.net/p/j-interop/discussion/600730/thread/75ec7ea8/?limit=25#2158

      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/j-interop/discussion/600730/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

      --
      The Mind is a place of its own. It can make a heaven out of hell or a hell
      out of heaven. Attitude is everything. No matter how adverse conditions
      maybe, one has the capacity to turn things around by one's Determination,
      Perseverance and Hardwork.

      John Milton
      (Paradise Lost)

       
      • Andrey Romanenko

        Hi Vikram,

        Thanks for the reply. Yes, I have looked at that example and it does provide all that is needed to create a DCOM server in java. However, this example deals with creating a callback for an existing server.

        What I am trying to do is:
        1. create a java DCOM server (the way you have in the example)
        2. wait on port 135 for incoming connections to serve up RemoteActivation or SystemActivation from a client. For instance RemoteAtivation reply from the server (Linux) has to provide:

            [out] OXID                             *pOxid,
            [out] DUALSTRINGARRAY                  **ppdsaOxidBindings,
            [out] IPID                             *pipidRemUnknown,
            [out] DWORD                                *pAuthnHint,
            [out] COMVERSION                           *pServerVersion,
            [out] HRESULT                              *phr,
            [out,size_is(Interfaces), disable_consistency_check] 
                                    MInterfacePointer **ppInterfaceData,
            [out,size_is(Interfaces), disable_consistency_check] 
                                    HRESULT            *pResults
        

        OXID, oxidbindings, IPIP, MIPs are of the DCOM server created in step 1.

        I already have RemoteActivation/OxidResolver listening on port 135 but need to find out a way to get that data to send back to the client.

        I can email you the sources as they are now for you to understand better what I am trying to achieve. Thanks.

        Best Regards,
        Andrey

         

Log in to post a comment.