2
嗨, 我有2個客戶端與2個不同的服務器。 生成wsdl類後,我相應地在SoapHttpClientProtocol consructor中更改客戶端的url地址。更改c#WebReference的網址
從this.Url = "http://10.0.3.5:88/SomeName/dish
到
this.Url = "http://192.168.20.5:88/SomeOtherName/dish
但我不能在運行時改變SoapDocumentMethodAttribute。不改變它,我的方法不會返回DataSet。在改變屬性的所有地址後,一切正常。
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://10.0.3.5:88/SomeName/EuroSoft/ProductTransferExecute", RequestNamespace = "http://10.0.3.5:88/SomeName/dish", ResponseNamespace = "http://10.0.3.5:88/SomeName/dish", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle =
System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public System.Data.DataSet ProductTransferExecute([System.Xml.Serialization.XmlElementAttribute(IsNullable = true)] string department, [System.Xml.Serialization.XmlElementAttribute(IsNullable = true)] string XMLproducts, out int sqlcode) {}
服務由Sybase Anywhere 9數據庫生成。是否有可能改變它的動態?什麼需要是相同的才能工作?
我的問題是WSA中的SOAPAction問題隨服務器而變化。我會嘗試這個解決方案[鏈接](http://social.msdn.microsoft.com/Forums/vstudio/en-US/0e9874a5-ce16-4d69-936c-4af46d6a02a2/soap-action-override-at-runtime- from-imported-wsdl) – koziol
另一個類似的問題[stack link](http://stackoverflow.com/questions/8504820/dynamically-changing-attributes-for-properties) – koziol