我使用VS2008,.net 3.5。使用WCF代理將服務引用(WCF,VS2008)添加到外部服務
有一個外部Web服務(這是PHP執行,但不介意實施-.net,Java,PHP和...-)。
在我的項目的csproj,我想服務引用添加到WebService的,我想使用WCF。
當我在VS2008中添加服務引用時,創建了WCF代理。
添加服務引用(外部服務)的任何最佳實踐(模式和實踐)?
的WCF代理生成器(我認爲同樣SvcUtil工具命令)生成這樣的源代碼。也許有趣的是管理生成的代碼(ServiceContractAttribute Namespace =「http://192.168.50.63/WebService」使用IP地址,而OperationContractAttribute(Action =「http://devservername/webservice/SmoBridge.php/login」use servername )
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(Namespace="http://192.168.50.63/WebService", ConfigurationName="ServiceEasyVista.WebServicePortType")]
public interface WebServicePortType {
[System.ServiceModel.OperationContractAttribute(Action="http://devservername/webservice/SmoBridge.php/login", ReplyAction="*")]
[System.ServiceModel.XmlSerializerFormatAttribute(Style=System.ServiceModel.OperationFormatStyle.Rpc, Use=System.ServiceModel.OperationFormatUse.Encoded)]
[return: System.ServiceModel.MessageParameterAttribute(Name="return")]
string login(string SESSION_ID, [System.ServiceModel.MessageParameterAttribute(Name="LOGIN")] string LOGIN1, string PASSWORD, string COMPANY_ACCOUNT);
更新:。
的Erwyn的大約有故障的WCF通道的正確閉合建議 http://bloggingabout.net/blogs/erwyn/archive/2006/12/09/WCF-Service-Proxy-Helper.aspx
爲什麼ClientBase處置需要扔在故障狀態(或者說,有什麼?關閉和中止的區別?)
http://social.msdn.microsoft.com/forums/en-US/wcf/thread/b95b91c7-d498-446c-b38f-ef132989c154/
但據我所知,使用「添加Web引用」選項不使用WCF。 – 2010-11-05 09:32:49
請閱讀完整的文章,在這種情況下我們也使用相同的技術。 – 2010-11-05 09:42:01
thx,另一個參考使用.NET的任何Web服務實現的最佳實踐(不僅PHP,也是.net WCF服務,Java ...) – Kiquenet 2010-11-05 10:32:14