Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify custom SoapAction for WCF

Tags:

c#

.net

asp.net

wcf

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

In the WSDL soapaction is appearing as follows

<soap12:operation soapAction="http://tempuri.org/ISubscriptionEvents/MyMethod" style="document" />

I want it to be

<soap12:operation soapAction="http://www.TextXYZ.com/FUNC/1/0/action/MyMethod" style="document" />

How can I specify the custom soap action?

like image 856
Ram Avatar asked Jul 07 '10 07:07

Ram


1 Answers

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.

like image 110
Quartermeister Avatar answered Sep 20 '22 10:09

Quartermeister