我们必须连接到第三方 SOAP 服务,并且我们正在使用 WCF 来执行此操作。该服务是使用 Apache AXIS 开发的,我们无法控制它,也无法改变它的工作方式。我们看到的问题是它希望使用 Web 服务安全性对请求进行格式化,因此我们正在执行所有正确的签名等操作。然而,来自第 3 方的响应是不安全的。如果我们嗅探电线,我们会看到响应正常(尽管没有任何时间戳、签名等)。底层 .NET 组件将此视为错误,因为它认为这是一个安全问题,因此我们实际上并没有收到这样的肥皂响应。有什么方法可以配置 WCF 框架以发送安全请求,但不要期望响应中的安全字段?查看 OASIS 规范,它没有
有关信息,这是我们看到的异常:
我们收到的例外是:
System.ServiceModel.Security.MessageSecurityException was caught
Message="Security processor was unable to find a security header in the message. This might be because the message is an unsecured fault or because there is a binding mismatch between the communicating parties. This can occur if the service is configured for security and the client is not using security."
Source="mscorlib"
StackTrace:
Server stack trace:
at System.ServiceModel.Security.TransportSecurityProtocol.VerifyIncomingMessageCore(Message& message, TimeSpan timeout)
at System.ServiceModel.Security.TransportSecurityProtocol.VerifyIncomingMessage(Message& message, TimeSpan timeout)
at System.ServiceModel.Security.SecurityProtocol.VerifyIncomingMessage(Message& message, TimeSpan timeout, SecurityProtocolCorrelationState[] correlationStates)
at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.ProcessReply(Message reply, SecurityProtocolCorrelationState correlationState, TimeSpan timeout)
at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
顺便说一句,我看到很多帖子都说如果你不考虑时间戳,那么安全字段就不会出现。这不是一个选项 - 我们正在与之通信的服务要求时间戳。