3
我想知道wcf中MessageParameterAttribute的用法。如何在wcf中使用MessageParameterAttribute
在我的功能:
[OperationContract]
public float GetAirfare(
[MessageParameter(Name=」fromCity」)] string originCity,
[MessageParameter(Name=」toCity」)] string destinationCity);
我在不執行,甚至在使用服務中使用fromCity或toCity任何地方。那麼給它一個名字有什麼意義呢?
謝謝。但是,你什麼時候可以直接指定XSD?你能舉個例子嗎? – Archie 2010-05-12 07:51:20
假設您使用的是Visual Studio IDE,則會自動爲您生成XSD。如果您或其他客戶端向WCF服務添加服務引用,您會注意到自動生成的Reference.cs類將如下所示: public float GetAirfare(string fromCity,string toCity){ return base.Channel。 GetAirfare(fromCity,toCity); 如果有人使用非.NET環境來使用服務,並且沒有工具來自動生成像我們這樣的服務代理,那麼他們可能需要手動創建代理類,並且需要XSD和WSDL才能執行它。 – 2010-05-12 19:16:18