Add Service reference does not create expected operations

Damir Dobric Posts

Next talks:

 

    

Follow me on Twitter: #ddobric



 

 

Archives


When adding the service reference to some WCF based service, it can happen that generated reference does not contain any or some of operations. To illustrate this take a look on following contract definition.

[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]

[ServiceContractAttribute(Namespace="http://schemas... /", ConfigurationName="ServiceReference1.MyService")]

public interface IMyService

{

       

 [OperationContractAttribute(Action="http://schemas/MyOperation”, ReplyAction="*")]

       OperationResponse MyOperation(OperationRequest request);

}

The services IMyservice defines the operation with name MyOperation. If you try to add the service reference to this service, the reference will be created, but without operation.

The problem is in definition of Reply Action attribute, which is defined for operation. In this case the action is defined as:

ReplyAction="*"

To workaround the problem replace the “*” with “”.

Finally the operation contract should look like:

[OperationContractAttribute(Action="http://schemas/MyOperation”, ReplyAction="")]

OperationResponse MyOperation(OperationRequest request);


This issue happens when you create the contract definition from WSDL and then create the service from created contract definition.


Posted Aug 30 2011, 06:25 PM by Damir Dobric
Filed under:

Comments

Ryan wrote re: Add Service reference does not create expected operations
on 09-28-2012 21:48

This is exactly the information I needed. Helped me out a lot. Thanks.

developers.de is a .Net Community Blog powered by daenet GmbH.