要在我的評論擴大,你應該能夠創建一個接口它具有與asmx服務中的Web服務方法相匹配的方法。例如:
Web服務方法
string GetMessage()
void SendMessage(string message)
int AddNumbers(int x, int y)
服務合同
[ServiceContract]
public interface IServiceName
{
[OperationContract]
string GetMessage();
[OperationContract]
void SendMessage(string message);
[OperationContract]
int AddNumbers(int x, int y)
}
的ChannelFactory
ChannelFactory<IServiceName> serviceFactory =
new ChannelFactory<IServiceName>(new BasicHttpBinding(),
"http://www.services.com/Service.asmx");
不是100%肯定這會起作用,但它很容易嘗試。此外,您可能希望在服務合同([ServiceContract(Namespace = "somenamespace")]
)上設置命名空間以匹配舊式asmx服務,否則可能無法處理消息。
來源
2013-09-29 06:53:56
Tim
您可以嘗試使用適當的WCF裝飾和Web服務的方法簽名創建一個接口,並使用basicHttpBinding。 – Tim