isDispatchNotSupported returning false; Can I use JICallBuilder?

Help
2013-10-03
2013-10-14
  • monica nath
    monica nath
    2013-10-03

    Hi,

    I have a C++ DLL and I am trying to write a Java client for it. My C++ dll is old and it does not support IDispatch (isDispatchSupported is returning false). When I run the following code, I get the error at the dmObject.call(...) line of code:

    rpc.PresentationException: Context rejected. (PROVIDER_REJECTION; ABSTRACT_SYNTAX_NOT_SUPPORTED)

    Code is:

            JISystem.getLogger().setLevel(Level.SEVERE);
    
            JISystem.setAutoRegisteration(false);
    
            JISession dmSession = JISession.createSession("domain","username","password");
    
          JIComServer dmServer = new JIComServer(JIProgId.valueOf("dll"),"127.0.0.1", dmSession);
    
           IJIComObject dmObject = dmServer.createInstance();
    
            System.out.println("is dispatch supported:" + dmObject.isDispatchSupported());  // prints false
    
            JICallBuilder dmCallBuilder = new JICallBuilder(false);
    
            try
            {
                dmCallBuilder.reInit();
                dmCallBuilder.setOpnum(4);
                short chan = 1;
                dmCallBuilder.addInParamAsString(new String("alpha"), JIFlags.FLAG_REPRESENTATION_STRING_BSTR);
                dmCallBuilder.addInParamAsShort(chan, JIFlags.FLAG_NULL);
                Object[] dmResults = dmObject.call(dmCallBuilder);
            }
            catch(JIException ex)
            {
                    System.out.println("exception caught for index " + i + ".");
            }
    

    My interface method details from idl are:
    interface IHTDataMgr : IUnknown {
    HRESULT _stdcall DisConnectServer(
    [in] BSTR sServerName,
    [in] short ID);
    .
    .
    .
    }

    Thanks,
    Monica

     
    • Hi,

      Could you do a queryinterface first on the com server for the right
      interface and use that with JICallBuilder ?

      Best regards,
      Vikram

      Hi,

      I have a C++ DLL and I am trying to write a Java client for it. My C++ dll
      is old and it does not support IDispatch (isDispatchSupported is returning
      false). When I run the following code, I get the error at the
      dmObject.call(...) line of code:

      rpc.PresentationException: Context rejected. (PROVIDER_REJECTION;
      ABSTRACT_SYNTAX_NOT_SUPPORTED)

      Code is:

          JISystem.getLogger().setLevel(Level.SEVERE);
      
          JISystem.setAutoRegisteration(false);
      
          JISession dmSession =
      

      JISession.createSession("domain","username","password");

        JIComServer dmServer = new
      

      JIComServer(JIProgId.valueOf("dll"),"127.0.0.1", dmSession);

         IJIComObject dmObject = dmServer.createInstance();
      
          System.out.println("is dispatch supported:" +
      

      dmObject.isDispatchSupported()); // prints false

          JICallBuilder dmCallBuilder = new JICallBuilder(false);
      
          try
          {
              dmCallBuilder.reInit();
              dmCallBuilder.setOpnum(4);
              short chan = 1;
              dmCallBuilder.addInParamAsString(new String("alpha"),
      

      JIFlags.FLAG_REPRESENTATION_STRING_BSTR);
      dmCallBuilder.addInParamAsShort(chan, JIFlags.FLAG_NULL);
      Object[] dmResults = dmObject.call(dmCallBuilder);
      }
      catch(JIException ex)
      {
      System.out.println("exception caught for index " + i + ".");
      }

      My interface method details from idl are:
      interface IHTDataMgr : IUnknown {
      HRESULT _stdcall DisConnectServer(
      [in] BSTR sServerName,
      [in] short ID);
      .
      .
      .
      }

      Thanks,
      Monica


      isDispatchNotSupported returning false; Can I use JICallBuilder?


      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/

       
  • monica nath
    monica nath
    2013-10-14

    Thanks Vikram! That worked.