51 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			51 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			C#
		
	
	
	
|  | using System; | |||
|  | using System.Collections.Generic; | |||
|  | using System.Linq; | |||
|  | using System.Runtime.Serialization; | |||
|  | using System.ServiceModel; | |||
|  | using System.ServiceModel.Web; | |||
|  | using System.Text; | |||
|  | 
 | |||
|  | namespace epickService | |||
|  | { | |||
|  |     // 注意: 使用“重构”菜单上的“重命名”命令,可以同时更改代码和配置文件中的接口名“IService1”。 | |||
|  |     [ServiceContract] | |||
|  |     public interface IService1 | |||
|  |     { | |||
|  | 
 | |||
|  |         [OperationContract] | |||
|  |         [WebInvoke( | |||
|  |            Method = "GET", | |||
|  |            RequestFormat = WebMessageFormat.Json, | |||
|  |            ResponseFormat = WebMessageFormat.Json, | |||
|  |            UriTemplate = "getCarIp?car={carNo}" | |||
|  |            )] | |||
|  |         string getCarIp(string carNo); | |||
|  | 
 | |||
|  |         // TODO: 在此添加您的服务操作 | |||
|  |     } | |||
|  | 
 | |||
|  | 
 | |||
|  |     // 使用下面示例中说明的数据约定将复合类型添加到服务操作。 | |||
|  |     [DataContract] | |||
|  |     public class CompositeType | |||
|  |     { | |||
|  |         bool boolValue = true; | |||
|  |         string stringValue = "Hello "; | |||
|  | 
 | |||
|  |         [DataMember] | |||
|  |         public bool BoolValue | |||
|  |         { | |||
|  |             get { return boolValue; } | |||
|  |             set { boolValue = value; } | |||
|  |         } | |||
|  | 
 | |||
|  |         [DataMember] | |||
|  |         public string StringValue | |||
|  |         { | |||
|  |             get { return stringValue; } | |||
|  |             set { stringValue = value; } | |||
|  |         } | |||
|  |     } | |||
|  | } |