我们有一个ASMX Web服务。我知道,它已经过时了,但我们必须保留它。所以,我有一个客户端应用程序发送请求(有的WS-Addressing头)这项服务的方法:通过WS-Addressing请求ASMX服务
someASMX.someSoapClient client = new someASMX.someSoapClient();
using (OperationContextScope scope = new OperationContextScope(client.InnerChannel))
{
OperationContext.Current.OutgoingMessageHeaders.ReplyTo = new EndpointAddress("https://address2answer");
OperationContext.Current.OutgoingMessageHeaders.MessageId = new System.Xml.UniqueId(Guid.NewGuid());
client.someMethod("1", "test");
}
但请求失败,出现以下异常:
Addressing Version 'AddressingNone (http://schemas.microsoft.com/ws/2005/05/addressing/none)' does not support adding WS-Addressing headers
ASMX网络服务甚至支持WS-Addressing吗?如果他们这样做,我该怎么做才能使它接受带有WS-Addressing标头的请求?
我有以下的结合在客户端的app.config
:
<basicHttpBinding>
<binding name="someSoap">
<security mode="Transport" />
</binding>
</basicHttpBinding>
<endpoint address="https://someserver:443/some.asmx"
binding="basicHttpBinding" bindingConfiguration="someSoap"
contract="someNS.someSoap" name="someSoap" />
我怀疑它做绑定的东西,但在Visual Studio中添加Service Reference
自动生成的东西 - 它为什么被生成然后呢?也许我需要改变ASMX服务方面的一些东西?