Nadat i think you right but theres not a whole load of code in the middle of the call, so i dont think there is that much i could have screwed up. (I think!)
So over the weekend i tried using Axis2 with ADB and Xmlbeans the ADB had serious problems working with the betdaq api so then rewrote it using xml beans. Betdaq calls take about 180ms and betfair 200ms.
As you can see the code the timing is around the proxy call so it should be pretty light. Any ideas?
Here is the code,
protected BFExchangeServiceStub createExchangeBindingStub() throws ExchangeException {
try {
if (exchangeBindingStub == null) {
exchangeBindingStub = new BFExchangeServiceStub(_sEndPointURLExchange);
Options options = exchangeBindingStub._getServiceClient().getOptions();
options.setProperty(HTTPConstants.MC_ACCEPT_GZIP, "true");
exchangeBindingStub._getServiceClient().setOptions(options);
}
return exchangeBindingStub;
} catch (AxisFault axisFault) {
throw new ExchangeException("Axis is generally fucked and cant create exchange binding stub", axisFault);
}
}
protected com.betfair.www.publicapi.types.exchange.v5.APIRequestHeader getHeaderExchange() {
if (exchangeHeader == null) {
exchangeHeader = com.betfair.www.publicapi.types.exchange.v5.APIRequestHeader.Factory.newInstance();
}
exchangeHeader.setClientStamp(new GregorianCalendar().getTimeInMillis());
exchangeHeader.setSessionToken(sessionToken);
return exchangeHeader;
}
public String getMarketPricesCompressed(Integer marketId) throws ExchangeException {
//Set up service calls
BFExchangeServiceStub stubUK = createExchangeBindingStub();
//Initialise request object
GetMarketPricesCompressedDocument doc = GetMarketPricesCompressedDocument.Factory.newInstance();
GetMarketPricesCompressedDocument.GetMarketPricesCompressed sub = GetMarketPricesCompressedDocument.GetMarketPricesCompressed.Factory.newInstance();
GetMarketPricesCompressedReq req = GetMarketPricesCompressedReq.Factory.newInstance();
//Initialise Header
req.setHeader(getHeaderExchange());
req.setMarketId(marketId);
sub.setRequest(req);
doc.setGetMarketPricesCompressed(sub);
try {
//Make the call
PerfTimer timer = new PerfTimer();
GetMarketPricesCompressedResp resp = stubUK.getMarketPricesCompressed(doc).getGetMarketPricesCompressedResponse().getResult();
logger.info("bf time:"+timer.getElapsedTime());
//Maintain the session
setHeader(resp.getHeader());
//Check for errors & return result
if (resp.getErrorCode() != GetMarketPricesErrorEnum.OK) {
throw new ExchangeException("Service Call Error - " + resp.getErrorCode());
} else {
return resp.getMarketPrices();
}
} catch (RemoteException e) {
throw new ExchangeException("Error calling getMarketPricesCompressed", e);
}
}