我們希望爲客戶提供輸入Web服務的能力,我們的應用程序將檢查服務,爲他們提供輸入參數和類型,客戶將輸入參數和我們的應用程序調用該Web服務。我發現了代碼示例,它們將動態檢查和調用.asmx服務,3.5中依賴於共享接口的示例以及4.0中使用新4.0組件的示例。動態調用WCF服務
我缺少的是一種使用.NET 3.5動態檢查WCF服務而無需交換共享接口的方法。我已經能夠確定服務名稱和方法,但是WSDL上的值參數沒有通過。
這裏是我的簡單的服務:
[OperationContract]
string GetDataInt(int value);
[OperationContract]
string GetDataStringInt(int value, string stringValue);
[OperationContract]
string GetDataStringIntBool(int value, string stringValue, bool boolValue);
這裏是什麼來通過作爲參數的WSDL(爲參數):
<wsdl:message name="IService1_GetDataInt_InputMessage">
<wsdl:part name="parameters" element="tns:GetDataInt"/>
</wsdl:message>
<wsdl:message name="IService1_GetDataInt_OutputMessage">
<wsdl:part name="parameters" element="tns:GetDataIntResponse"/>
</wsdl:message>
<wsdl:message name="IService1_GetDataStringInt_InputMessage">
<wsdl:part name="parameters" element="tns:GetDataStringInt"/>
</wsdl:message>
<wsdl:message name="IService1_GetDataStringInt_OutputMessage">
<wsdl:part name="parameters" element="tns:GetDataStringIntResponse"/>
</wsdl:message>
參數類型不通過就快到了wsdl。有沒有在.NET 3.5中檢查WCF服務並調用它的方法?
你的意思是像[WcfTestClient](http://msdn.microsoft.com/en-us/library/bb552364.aspx)? – 2011-12-21 21:58:30
就是這樣,儘管還有更多。我試圖從商業的角度來闡述我們想要做的事情,這樣人們就會明白我爲什麼要問這個問題。 – Drew 2011-12-22 19:07:16