我有一个带有 WSDL 之类的普通 3rd 方 SOAP 服务。问题是 - 它只接受 GET 请求。如何在 c# 中访问它?
当我将该服务添加到 VS viaAdd Service Reference
并尝试照常使用它时:
var service = new BaseSvcClient(
new BasicHttpContextBinding(),
new EndpointAddress("http://some.internal.ip/WebServices/Base.svc"));
var ver = service.Version();
我看到(通过提琴手)它实际上发送 POST 请求,并且 Web 服务以Endpoint not found
错误消息响应。如果我只是http://some.internal.ip/WebServices/Base.svc/Version
在浏览器中点击,则会返回正确的 xml。
我可以使用 WebClient,但是我必须手动构造所有的 GET 请求,这看起来不太好。还有其他解决方案吗?