How to specify custom SoapAction for WCF

前端 未结 2 1008
灰色年华
灰色年华 2021-02-13 22:58

I am creating a WCF service which will be called from another service.

In the WSDL soapaction is appearing as follows



        
相关标签:
2条回答
  • 2021-02-13 23:41

    You could also specify the Action property on the operation contract:

    [ServiceContract]
    public interface IMyServiceContract
    {
        [OperationContract(Action = "http://www.TextXYZ.com/FUNC/1/0/action/MyMethod")]
        void MyMethod();
    }
    

    You can also set the ReplyAction if you need to.

    Darin's answer will set the action based on the namespace, the contract name, and the operation name, which is much easier to use, but may not work if you need to set the action to exactly what you want.

    0 讨论(0)
  • 2021-02-13 23:51

    You could specify it in the service contract definition:

    [ServiceContract(Namespace = "http://www.TextXYZ.com/FUNC/1/0/action")]
    public interface IMyServiceContract
    {
        [OperationContract]
        void MyMethod();
    }
    
    0 讨论(0)
提交回复
热议问题