Problem with application developed with vtapi(Vt Systems) - events
Hello!
I'm developing aplication based on api prepared by VT Systems (http://
www.cmsfx.com/en/trading-software/download-vt-trader/download-vt-trader-api/).
This api is used to perform forex transactions. I've written a Web
Service which connects with this api and
alows other modules of my application to perform transactions. I'm
using JAX-WS and Sun Java Application Server.
This is sample of Web Service :
@WebService()
public class ForexService{
protected static VT_API api;
Checker checker;
String userName = "***";
String userPassword = "***";
ConstRecord constants;
public static IVT_APIEventsAdapterExtended events;
public void initAPI(){
try{
System.loadLibrary("bridge2java");
OleEnvironment.Initialize();
api = new VT_API();
api.setForceDisableSSL(false);
events = new IVT_APIEventsAdapterExtended(api);
api.addIVT_APIEventsListener(events);
constants = new ConstRecord();
}catch(Exception e) {
e.printStackTrace();
}
}
public ForexService(){
initAPI();
logonResult = api.Login(userName, userPassword, 0) ;
System.out.println("Rezultat logowania: " + logonResult);
checker = new Checker(this);
new Thread(checker).start();
}
@WebMethod
public String getLogonResult() {
return new Integer(logonResult).toString();
}
@WebMethod
public String getServerList(){
return api.GetServerList();
}
}
I'm using event listener which was attached to Java Sample in
documentation.
public class IVT_APIEventsAdapterExtended extends
IVT_APIEventsAdapter{
private VT_API api;
public IVT_APIEventsAdapterExtended(VT_API apiInstance) {
api = apiInstance;
}
public void
OnInstrumentChange(IVT_APIEvents_OnInstrumentChangeEvent e)
{
super.OnInstrumentChange(e);
System.out.println("instrument change - " +
e.get_InstrumentID());
}
public void
OnNewServerMessage(IVT_APIEvents_OnNewServerMessageEvent e)
{
super.OnNewServerMessage(e);
System.out.println("Server message :" +
api.get_ServerMessages().get_Items(e.get_MsgID()).get_Text());
}
}
I've problem with listening events incoming from forex server. When I
run Wireshark(Network Protocol Analyzer) I can see that events income
to my computer (on different ports - for example: 2070, 2071, 2072),
but don't income to Sun Java Application Server. I suspect that server
don't listen on this ports, but how can I fix this? Maybe should I
choose a other server? I've tried also Tomcat -with similar result :(
Regards,
Peter
//Sorry for my english :)