Achtung, hier musste ich serverseitig noch .NET Activation (4.7) freischalten. Da habe ich leider eine Weile suchen müssen..
41 lines
1.3 KiB
C#
41 lines
1.3 KiB
C#
using System;
|
|
using System.ServiceModel.Web;
|
|
using System.Runtime.Serialization;
|
|
using System.ServiceModel;
|
|
|
|
namespace bsmd.pasttrack.service
|
|
{
|
|
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
|
|
[ServiceContract]
|
|
public interface IService
|
|
{
|
|
[WebInvoke(Method = "GET",
|
|
BodyStyle = WebMessageBodyStyle.Wrapped,
|
|
RequestFormat = WebMessageFormat.Json,
|
|
ResponseFormat = WebMessageFormat.Json,
|
|
UriTemplate = "pasttrack/{mmsi}/{mins}")]
|
|
[OperationContract]
|
|
Pasttrack[] GetPasttrack(string mmsi, string mins);
|
|
}
|
|
|
|
// Use a data contract as illustrated in the sample below to add composite types to service operations.
|
|
[DataContract]
|
|
public class Pasttrack
|
|
{
|
|
/*
|
|
* select top 1000 Latitude, Longitude, Heading from aisposreport where mmsi=224717000
|
|
And timestamp > DATEADD(MINUTE, -120, GETDATE())
|
|
order by timestamp desc
|
|
*/
|
|
|
|
[DataMember]
|
|
public double Latitude { get; set; }
|
|
[DataMember]
|
|
public double Longitude { get; set; }
|
|
[DataMember]
|
|
public DateTime Timestamp { get; set; }
|
|
[DataMember]
|
|
public int Heading { get; set; }
|
|
}
|
|
}
|