Search code examples
.netwcfsoapwsdl

Way to control WCF code generation for operation contracts for external service


I have reference to the external SOAP service from .NET Framework library project. After updating service reference in Visual Studio 2019 (16.11.5), it start generating OperationContract attributes with IsOneWay=true.

[System.ServiceModel.OperationContractAttribute
(IsOneWay=true, Action="http://sap.com/xi/WebService/soap1.1")]

There is no related WSDL changes I could notice, only several new fields. Rolled back to old WSDL - still same thing.

Is there any way to control generation of OperationContractAttribute via config files or svcutil?


Solution

  • It should be changed according to the service:
    Use the one-way design pattern:

    • When the client must call operations and is not affected by the result of the operation at the operation level.
    • When using the NetMsmqBinding or the MsmqIntegrationBinding class. (For more information about this scenario, see Queues in WCF.)

    One-Way Services
    OperationContractAttribute Class