0

I have a WCF service implemented via custom wsdl. It simple have 5 methods as per wsdl. Call to My service from standard client works fine. Problem was in some old implementation which send SoapAction="" I wanted to change the soapAction to some value if i got empty. For that I have implemented CustomBehavior but even in it I can't able to hit AfterReceiveRequest method or any method in the behavior

 public class CustomInspectorBehavior : Attribute, IDispatchMessageInspector, 
        IClientMessageInspector, IEndpointBehavior, IServiceBehavior

Any idea i can response even if i have SOAPAction="" in the request

Edit My Service Looks like following

[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);
}
4

1 回答 1

0

将 OperationContract 的属性Action设置为“*”,以将每个无法到达其目的地的调用与特定方法相关联。

[OperationContract(Action = "*")]
void LostRequest();
于 2015-12-11T14:19:42.687 回答