我尝试从我的应用程序内部调用此 URI:http ://data.mtgox.com/api/1/BTCEUR/ticker?raw
将此代码用作 ServiceContract:
[ServiceContract(Namespace = "/api/1")]
public interface ITickerService
{
//base uri: "http://data.mtgox.com";
[OperationContract]
[WebGet(ResponseFormat = WebMessageFormat.Json,
UriTemplate = "{ident}{currency}/ticker?raw")]
String GetTicker(String ident, String currency);
}
而这个调用代码
BasicHttpBinding myBinding = new BasicHttpBinding();
EndpointAddress mtGoxEndpoint = new EndpointAddress("http://data.mtgox.com/");
ChannelFactory<ITickerService> channelFactory = new ChannelFactory<ITickerService>(myBinding, mtGoxEndpoint);
ITickerService tickerService = channelFactory.CreateChannel();
// Stops here till timeout after 1 min
var result = tickerService.GetTicker("BTC", "EUR");
任何想法有什么问题?
坦克,塔里昂