Questions tagged [operationcontract]
70 questions
20
votes
2 answers
WCF OperationContract
What is a WCF OperationContract? I dont really understand what it does

Obsivus
- 8,231
- 13
- 52
- 97
14
votes
4 answers
WCF service method unavailable in WCF Test Client because it uses type
I am trying to use the WCF Test Client to test a WCF service I have built.
The service has one method "SubmitRequest".
[OperationContract]
Response SubmitRequest(Request request);
When I load up the WCF Test Client, the method is grayed out with…

thiag0
- 2,199
- 5
- 31
- 51
14
votes
3 answers
WCF: Same Faultcontract on many methods
Take for example a project with 10 services and 20 methods on each service.
All services inherit from a base services which has a security check. The first thing each method does is to make a call to the security check. This throws a security…

Shiraz Bhaiji
- 64,065
- 34
- 143
- 252
10
votes
2 answers
WCF OperationContract - What's the point of Action and ReplyAction?
[ServiceContract(Namespace = "http://schemas.mycompany.com/", Name = "MyService")]
public interface IMyService
{
[OperationContract(Name = "MyOperation")
OperationResponse MyOperation(OperationRequest request);
}
In this scenario, what is…

michael
- 14,844
- 28
- 89
- 177
10
votes
2 answers
WCF OperationContract - which generic collection type should I expose?
I have a WCF web service that has a method that returns a generic collection. Now, my question is: Should I expose it as ICollection, List, IList, IEnumerable or something else?
I suppose that List is out of the question since I…

Klaus Byskov Pedersen
- 117,245
- 29
- 183
- 222
9
votes
5 answers
WCF contract changes that affect clients
I was curious if someone could outline which types of WCF contract (interface) changes on the server side would break a client trying to send in a message, and why. I believe WCF can handle certain discrepancies, but I'm not sure exactly what you…

Andy White
- 86,444
- 48
- 176
- 211
9
votes
2 answers
WCF: is there an attribute to make parameters in the OperationContract required?
I use [DataMember(IsRequired=true)] to make the DataContract properties required. There doesn't seem to be some IsRequired for the OperationContract parameters. How do I make them required and not allow null?
The parameter in of OperationContract…

Dieko
- 101
- 1
- 5
8
votes
2 answers
WCF class implementing two operation contracts in different service contracts with same name
I have declared two service contracts as follows:
[ServiceContract]
public interface IContract1
{
[OperationContract]
double Add(int ip);
}
[ServiceContract]
public interface IContract2
{
[OperationContract]
double Add(double…

Archie
- 2,564
- 8
- 39
- 50
7
votes
2 answers
How to specify a parameter of an OperationContract as required
I wonder how I can specify a parameter of an OperationContract method in WCF as required so that the generated xsd contains minOccurs="1" instead of minOccurs="0".
Example:
[ServiceContract(Namespace = "http://myUrl.com")]
public interface…

Jan-Patrick Ahnen
- 1,380
- 6
- 17
- 31
4
votes
2 answers
WCF Rest .svc throws error when viewing directly, but works otherwise
I have a WCF rest service with two OperationContracts as follows:
[OperationContract]
[WebGet(UriTemplate = "ping/")]
Message PingServer();
[OperationContract]
[WebGet(UriTemplate = "files/")]
Message AddFile(string…

Jeffrey Kevin Pry
- 3,266
- 3
- 35
- 67
4
votes
1 answer
WCF - Customized WDSL generation
I spent hours trying to do some customizations in the wsdl generation, without results.
I got stuck mainly because I could not find a clear sample for what I want to do (I may have missed something).
Let's got to the point : I want to customize the…

Mose
- 1,781
- 3
- 16
- 35
4
votes
2 answers
WCF OperationContract with loosely typed parameter
I want a loosely typed parameter in my web method.
I have a scenario where the client can send any of 25 DataContract objects into the WCF operation e.g.
proxy1.myFunction(PersonObject)
proxy1.myFunction(ComputerObject)
My restriction is there…

user1312242
- 339
- 1
- 3
- 16
3
votes
1 answer
How to rename xml root in WCF response?
Possible Duplicate:
WCF REST: remove prefix “ArrayOf” for wcf method response
I have defined a simple WCF service in c# like this:
[ServiceContract]
public interface IAugeService
{
[OperationContract]
[WebGet]
List…

sne11ius
- 726
- 1
- 9
- 18
3
votes
1 answer
How is the OperationContractAttribute.Action value is set?
I'm using the "Add Service Reference" option in Visual Studio in order to create a proxy class using a WSDL file given to me by a third party.
I got 2 versions of the WSDL - we'll call them "OLD" and "NEW".
Even though the WSDL files suppose to be…

Dardar
- 624
- 3
- 13
- 30
3
votes
2 answers
In WCF, is it better to have multiple operation contracts or to have only one operation with polymorphic data contract?
I was wondering if it was better in WCF to use multiple operation contracts or to have only one operation contract with a polymorphic data contract.
Let me give you a small example :
[OperationContract]
action1Answer action1(action1data…

Gab Royer
- 9,587
- 8
- 40
- 58