operationcontract

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 can change safely, and what you can't. Add/remove parameters from an OperationContract? A...

How can we use a DataMember of a DataContract in silverlight

I am creating an application in which i made a WCF service and now a DataContract Class which have some DataMebers in the ServiceContract I am using that DataContract Class No I am able to access the operationContracts but now I want to access the DataMember of the DataContract Class in the silverligh XAML.CS page Please Suggest How ...

WCF MessageContract Inheritance

Hi there, I am fairly new to WCF and just have a question on how to correctly get MessageContract inheritance working. A simplified version of my setup is as follows - a "base" message type, and then another "test" message which inherits from it. [MessageContract] public abstract class BaseMessage { } [MessageContract] public class Te...

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 exception if there is a problem. Question is: Do I need to specify a FaultContract on each met...

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<T>, List<T>, IList<T>, IEnumerable<T> or something else? I suppose that List<T> is out of the question since I want to avoid CA1002 errors, but the underlying type will be a List<T>. I am really interes...

What is the use of "AsyncPattern" property of "OperationContractAttribute" + wcf?

Thus for used ajax enabled wcf services to get records from DB and display it in client without using AsyncPattern property of OperationContractAttribute.... When should i consider AsyncPattern property? Sample of my operationcontract methods, [OperationContract] public string GetDesignationData() { DataSet dt = GetDes...

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 ip); } I have a class which implements these two contracts. I have created two endpoints for ...

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 a); [OperationContract] action2Answer action2(action2data a); or [OperationContract] actionAnswe...

Designing WCF Contracts (Operation / Data)

I am currently looking to design some WCF services and wanted to get the community's opinion on the best way to handle operation / data contracts. I have 2 basic operation contracts, the first creates a quote and the second adds an item to a quote (and calculates totals behind the scene). The first takes in customer information and sto...

How to create generic WCF OperationContract to retrieve data from a SQL table.

I've been given the task of creating a .net interface for a table that will be retrieved a database. One of the obvious things that the interface must do is retrieve data from the table. So.... I could write a function that simply does Select * from MyTable; and then returns the result. However, the table has ten columns and someone u...

How to specify a parameter of an OperationContract as required

Hi, 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 IMyWebService { [OperationContract] string DoSomething(string param1, string p...

Does WCF UserNamePasswordValidator require checking PrimaryIdentity.IsAuthenticated?

Currently I have a service that uses a UserNamePasswordValidator to authenticate the client user. The code for the validation goes as follows: public override void Validate(String userName, String password) { if (userName == null) || (password == null) throw new FaultException("Username and/or password not specified....

Cookies in wcf service OperationContract

Is it possible to read cookies in the OperationContract of a wcf service? I am trying to read a cookie value in the contract method, but its always empty. If I read the same cookie from a .aspx page, the value is present. Any ideas? ...

Getting Gibberish instead of Hello World from a service with webHttpBinding

Here is a trivial example that is supposed to return "Hello World" string. However, a browser displays something like SGVsbG8gV29ybGQ=. Which is the right way to return plain text from an oldskul-style service? please know that: I can't return a string: three Unicode characters will be automatically prepended and the legacy HTTP clien...