我有通过自定义wsdl实现的WCF服务。根据wsdl,它简单地有5种方法。从标准客户端调用我的服务工作正常。发送SoapAction=""
的一些旧实现存在问题
如果我变空,我想将soapAction
更改为某个值。为此,我实施了CustomBehavior
,但即使在其中我也无法点击AfterReceiveRequest
方法或行为中的任何方法
public class CustomInspectorBehavior : Attribute, IDispatchMessageInspector,
IClientMessageInspector, IEndpointBehavior, IServiceBehavior
即使我在请求
中有SOAPAction =“”,我仍然可以回复编辑 我的服务如下所示
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(Namespace="http://txnTest.Test.com", ConfigurationName="MyServiceTxnHost")]
public interface IMyServiceTxnHost
{
[System.ServiceModel.OperationContractAttribute(Action = "http://txnTest.Test.com/IMyServiceTxnHost/payment")]
//[System.ServiceModel.OperationContractAttribute(Action = "*")]
//[System.ServiceModel.XmlSerializerFormatAttribute(Style=System.ServiceModel.OperationFormatStyle.Rpc, Use=System.ServiceModel.OperationFormatUse.Encoded)]
paymentResponse payment(paymentRequest request);
//[System.ServiceModel.OperationContractAttribute(Action = "*")]
[System.ServiceModel.OperationContractAttribute(Action = "http://txnTest.Test.com/IMyServiceTxnHost/commit")]
//[System.ServiceModel.XmlSerializerFormatAttribute(Style=System.ServiceModel.OperationFormatStyle.Rpc, Use=System.ServiceModel.OperationFormatUse.Encoded)]
commitResponse commit(commitRequest request);
//[System.ServiceModel.OperationContractAttribute(Action = "*")]
[System.ServiceModel.OperationContractAttribute(Action = "http://txnTest.Test.com/IMyServiceTxnHost/reserve")]
//[System.ServiceModel.XmlSerializerFormatAttribute(Style=System.ServiceModel.OperationFormatStyle.Rpc, Use=System.ServiceModel.OperationFormatUse.Encoded)]
reserveResponse reserve(reserveRequest request);
//[System.ServiceModel.OperationContractAttribute(Action = "*")]
[System.ServiceModel.OperationContractAttribute(Action = "http://txnTest.Test.com/IMyServiceTxnHost/cancel")]
//[System.ServiceModel.XmlSerializerFormatAttribute(Style=System.ServiceModel.OperationFormatStyle.Rpc, Use=System.ServiceModel.OperationFormatUse.Encoded)]
cancelResponse cancel(cancelRequest request);
//[System.ServiceModel.OperationContractAttribute(Action = "*")]
[System.ServiceModel.OperationContractAttribute(Action = "http://txnTest.Test.com/IMyServiceTxnHost/raise")]
//[System.ServiceModel.XmlSerializerFormatAttribute(Style=System.ServiceModel.OperationFormatStyle.Rpc, Use=System.ServiceModel.OperationFormatUse.Encoded)]
raiseResponse raise(raiseRequest request);
//[System.ServiceModel.OperationContractAttribute(Action = "*")]
[System.ServiceModel.OperationContractAttribute(Action = "http://txnTest.Test.com/IMyServiceTxnHost/balance")]
//[System.ServiceModel.XmlSerializerFormatAttribute(Style=System.ServiceModel.OperationFormatStyle.Rpc, Use=System.ServiceModel.OperationFormatUse.Encoded)]
balanceResponse balance(balanceRequest request);
}
答案 0 :(得分:0)
将OperationContract的属性操作设置为“*”,以将每个无法到达目的地的呼叫与特定方法相关联。
[OperationContract(Action = "*")]
void LostRequest();