Announcement

Collapse
No announcement yet.

Trying to connect to ActiveX Desktop API from Java

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Trying to connect to ActiveX Desktop API from Java

    Hi,

    We are trying to connect to eSignal ActiveX Desktop API from a Java application. When we connect to eSignal (demo) via
    ActiveX, the eSignal application is being loaded succesfully, one can request eSignal software version via ActiveX or current time, but when we try to request a ticker, we get 'null'.

    We are using this demo example:


    , and added the following there:

    m_app.IsValidSymbol("IBM");
    m_app.XMLGetBasicQuote("IBM");

    , and cannot get the data... Can please someone help?
    Attached is our sample Java code.




    package com.esignal.test;

    import com.esignal.*;

    /**
    * This application uses the IBM Bridge2Java/Interface Tool to
    * interact with the eSignal ActiveX interface.
    *
    * A set of Java classes were generated using the tool into
    * the '../generated' directory, which allow us to instantiate
    * and hook into the eSignal ActiveX interface.
    *
    * Note that the __MIDL__MIDL_itf_winsig_0000_0010 interface that
    * we are using is to gain easy access to the constants specified
    * (corresponds to the windowTypeFlags enum in the winsig.odl file).
    *
    * @author Dion Loy
    * @date 2004/03/17
    * @version 1.0
    */
    public class eSignalTest implements __MIDL___MIDL_itf_winsig_0000_0010 {

    /////////////////////////////////////////////////////////
    // Private Fields

    /** Our connection to the eSignal ActiveX interface. */
    private Hooks m_app;

    /////////////////////////////////////////////////////////
    // Entry Point

    /** The main entry point for our stand alone application. */
    public static void main(String[] args) {

    // instantiate our test object and start the test.
    eSignalTest test = new eSignalTest();
    test.start();
    }

    /////////////////////////////////////////////////////////
    // Public Methods

    /**
    * Starts the ActiveX demo. We will attempt to connect to
    * eSignal, and register for some quote updates.
    */
    public void start() {
    try {
    // Initialize the Java2Com Environment
    com.ibm.bridge2java.OleEnvironment.Initialize();

    // Create a new eSignal hook.
    m_app = new Hooks();
    // Wait 5 seconds for eSignal to finish loading.
    //Thread.sleep(5000);
    m_app.SetApplication("USER_NAME");


    System.out.println("Entitled: " + m_app.get_IsEntitled());
    System.out.println("Title: " + m_app.get_GetTitle("IDC"));
    System.out.println("Symbol: " + m_app.get_GetCurrentLinkingSymbol());
    System.out.println("Version: " + m_app.get_GetAppBuildNumber());

    // Wait 5 seconds for eSignal to finish loading.
    Thread.sleep(1000);

    System.out.println(m_app.IsValidSymbol("IBM") );
    System.out.println(m_app.XMLGetBasicQuote("IBM"));

    // launch Advanced Charts
    m_app.CreateNewWindow(wtfADVANCEDCHART, 0, 0, 400, 300, 0, "QQQ");

    // launch Time & Sales
    m_app.CreateNewWindow(wtfTIMESALES, 401, 0, 200, 500, 0, "QQQ");

    // launch News
    m_app.CreateNewWindow(wtfSTORY, 0, 301, 400, 200, 0, "QQQ");

    // launch Option Chains
    m_app.CreateNewWindow(wtfOPTIONS, 502, 0, 600, 200, 0, "QQQ");

    // Wait 10 seconds.
    Thread.sleep(10000);

    } catch (com.ibm.bridge2java.ComException e) {
    System.out.println( "COM Exception:" );
    System.out.println( Long.toHexString((e.getHResult())) );
    System.out.println( e.getMessage() );
    } catch (Exception e) {
    System.out.println("message: " + e.getMessage());
    } finally {
    // null out our app reference to get it GC'd.
    m_app = null;

    // uninitialize the OLE bridge.
    com.ibm.bridge2java.OleEnvironment.UnInitialize();
    }
    }

    }


    Thanks,
    Marco

  • #2
    Did you set your eSignal username in the line:

    m_app.SetApplication("USER_NAME");

    This username should match with the one you are using in DataManager and eSignal application. Also note that you need to be entitled to Active X Development.

    You need to request real-time data for a particular symbol in eSignal or in your application prior to calling XMLGetBasicQuote for that symbol.

    Anthony
    eSignal Developer Support

    Comment


    • #3
      Hi Anthony,

      Please see my comments below:

      >Did you set your eSignal username in the line:
      >
      >m_app.SetApplication("USER_NAME");

      Yes, instead of USER_NAME I put a real valid eSignal login.
      We are subscribed for eSignal ActiveX Desktop API service.
      As I mentioned the eSignal application program itself (not ActiveX) works just fine with that username - gets the data OK.

      >This username should match with the one you are using in >DataManager and eSignal application. Also note that you need >to be entitled to Active X Development.

      Yes, I put these username/password both in DataManager and in eSignal application.

      Why does m_app.IsValidSymbol("IBM"); returns 'null'?

      >You need to request real-time data for a particular symbol in >eSignal or in your application prior to calling XMLGetBasicQuote >for that symbol.

      I tried the above today - this does not help.

      Maybe you could send me an example in Java that works? In private area of this forum or in public.
      I asked these questions eSignal support and Michael from support said that I need to use this forum.

      Thanks,
      Marco

      Comment

      Working...
      X