Questions tagged [operationcontract]

The tag has no usage guidance.

operationcontract
Filter by
Sorted by
Tagged with
21 votes
2 answers
32k views

WCF OperationContract

What is a WCF OperationContract? I dont really understand what it does
Obsivus's user avatar
  • 8,319
14 votes
3 answers
4k views

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 ...
Shiraz Bhaiji's user avatar
14 votes
4 answers
21k views

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 ...
thiag0's user avatar
  • 2,209
13 votes
3 answers
17k views

In the WCF web programming model, how can one write an operation contract with an array of query string parameters (i.e. with the same name)?

Using the WCF web programming model one can specify an operation contract like so: [OperationContract] [WebGet(ResponseFormat = WebMessageFormat.Xml, UriTemplate = "SomeRequest?qs1={qs1}&qs2={qs2}...
Dilip Krishnan's user avatar
10 votes
2 answers
15k views

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 ...
Klaus Byskov Pedersen's user avatar
10 votes
2 answers
23k views

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(...
michael's user avatar
  • 15k
9 votes
5 answers
13k views

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 ...
Andy White's user avatar
  • 87.4k
9 votes
2 answers
10k views

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 ...
Dieko's user avatar
  • 101
8 votes
2 answers
6k views

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 { ...
Archie's user avatar
  • 2,594
7 votes
2 answers
22k views

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(...
Jan-Patrick Ahnen's user avatar
4 votes
2 answers
3k views

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....
user1312242's user avatar
4 votes
2 answers
1k views

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(...
Jeffrey Kevin Pry's user avatar
4 votes
1 answer
5k views

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). ...
Mose's user avatar
  • 1,801
3 votes
2 answers
8k views

WCF Post with Query String

I am currently developing a Windows Service hosted WCF service. One of the methods has a URI which is set up to receive a callback from a payment provider. This is the interface contract... [...
David Muir's user avatar
3 votes
6 answers
4k views

WCF MessageContract Inheritance

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 "...
Frank Bell's user avatar
3 votes
2 answers
2k views

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 : [...
Gab Royer's user avatar
  • 9,697
3 votes
1 answer
1k views

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 "...
Dardar's user avatar
  • 644
3 votes
1 answer
4k views

How to rename xml root in WCF response? [duplicate]

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 { ...
sne11ius's user avatar
  • 726
2 votes
3 answers
2k views

Use parameter "params string[]" in WCF Rest endpoint

I would like to define an OperationContract, which I can pass any number of string parameters. The values should be interpreted as an array of string. Is there any possibility to use this type of ...
rbr94's user avatar
  • 2,247
2 votes
1 answer
1k views

WCF Service Implementation

I've scoured the internet, several books, and even consulted some peers. Nothing really states if what I'm attempting to do is bad practice or not. The short; is I'm just doing a fire-and-forget ...
Greg's user avatar
  • 11.4k
2 votes
3 answers
3k views

how to apply OperationContract to all methods in interface

Im creating a service contract in my wcf application and it contains a lot of methods. I find it very annoying to write an OperationContract attribute to all of them. Is there any simple way how to ...
John Smith's user avatar
  • 1,793
2 votes
2 answers
10k views

How To Use Interface as DataContract in WCF

I need invoke webservice operations using standard wsdl, but data objects must be different in client and in the server. Using interfaces for data objects in a common library, making proxy classes ...
thr0w's user avatar
  • 1,524
2 votes
1 answer
1k views

WCF service with 4 input parms and 3 out parms gets reordered by Add Service Reference in Proxy Class Project

I've looked in SO and elsewhere and seen questions posed about this along with some answers that still make no sense to me in my case. I'm refactoring my working VStudio 2010 solution which has: one ...
John Adams's user avatar
  • 4,823
2 votes
1 answer
2k views

In WCF can I have a wildcard character in a literal segment of my UriTemplate?

I am authoring a RESTful WCF service using .Net 4.0. I want the following two URLS: /root/document/{ids}?fields={fields} /root/externaldocument/{ids}?fields={fields} to map to the same interface ...
Joe Alfano's user avatar
  • 10.2k
2 votes
2 answers
2k views

WCF Connection closed with complex data

I have a WCF service and in this service I return a class with lots of properties, some of which are classes themselves and it is a little complex but not hugely. I've done a similar thing on the ...
Sachin Kainth's user avatar
2 votes
2 answers
2k views

WCF Generics - Why do DataContract and CollectionDataContract allow formatted naming, but not DataMember, OperationContract or ServiceContract?

Basically as the title says: [DataContract(Name = "{0}Item")] //This will format properly public class GenericItem<T> { [DataMember(Name = "The{0}")] //This will NOT format properly ...
myermian's user avatar
  • 32.2k
2 votes
1 answer
1k views

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 ...
Jesse's user avatar
  • 8,631
2 votes
1 answer
850 views

Update Service Reference does not work when the [OperationContract] method have colletion as argument

I have a very strange problem which I do not understand. I have my WCF interface which methods are decorated with the [OperationContract] attribute. Then I have my Service Reference folder which I ...
user2323704's user avatar
2 votes
2 answers
46 views

Provide whole library's functionality via WCF

I want to build a WCF Service application, which is supposed to use a library of mine in order to make all the library's methods available for the service's client. There must be a better way than ...
wodzu's user avatar
  • 3,122
2 votes
1 answer
451 views

Strange issue with wcf service

I have this strange problem. I wrote a wcf service and added a service reference to other project so that I can use it. Usage in a project with a reference to this service looks like this: private ...
Jarek Mazur's user avatar
  • 2,062
2 votes
1 answer
713 views

Can I call multiple operation contracts when ConcurrencyMode is Single

I have a WCF service with 3 operation contracts. I set [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Single)] for this service. My basic doubt is can I able to call all the 3 service at a time or ...
Maddy's user avatar
  • 174
2 votes
3 answers
1k views

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 ...
Vivian River's user avatar
  • 31.8k
1 vote
1 answer
596 views

Is it necessary for me to write [OperationContract] over every method in my WCF Service?

For example, is this correct? [OperationContract] bool IsHappy(string userID); bool IsSad(string userID); bool IsHungry(string userID); Is that a valid body of operations for a WCF ServiceContract ...
user avatar
1 vote
2 answers
1k views

Is there a limitation for number of Operation Contracts in WCF services?

I have a WCF service that contains a number of operation contracts. When the number of these operations was too many, I get an error in wcftestclient for binding service. When I split this service ...
masoud ramezani's user avatar
1 vote
2 answers
3k views

WCF - Generalizing Action String

I have to take some pre-defined WSDL's (I do not control these), and expose them on our device to reply to various SOAP/UPnP requests. Anyway, I have all of this working, but the problem comes ...
ifdef_debug's user avatar
1 vote
1 answer
780 views

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 ...
Ken Burkhardt's user avatar
1 vote
2 answers
544 views

WCF service only receiving 65536 String.Length size only, not more than that

I have created a WCF service which receives String (Text/Json) as a request, but the problem is it is only able to receive String length of 65536 (String.Length). I have tried below (binding ...
NDestiny's user avatar
  • 1,143
1 vote
1 answer
621 views

WCF cannot implement interface - no matching return type

Why do I get this error: Error 1 'JoomlaWebservice.KundeService' does not implement interface member 'JoomlaWebservice.ServiceInterface.HentOpgave(int)'. 'JoomlaWebservice.KundeService....
Veshkuul's user avatar
1 vote
1 answer
601 views

Can WCF Authentication be disabled for a single Operation

I have recently read the WCF Security Guide and am using it to create an application where users need to create their own account, and then access the application with message security. Below is the ...
Mike Beck's user avatar
1 vote
1 answer
293 views

Locating the parameter of an Operation in System.ServiceModel.Channels.Message in WCF

Suppose we have the following Service contract: [ServiceContract] public interface IPing { [OperationContract] string Ping(string parameter1, string parameter2); } I'm wondering, how it ...
charfeddine.ahmed's user avatar
1 vote
1 answer
1k views

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 ...
ACP's user avatar
  • 35.1k
1 vote
0 answers
219 views

Return Multiple Elements in a SOAP Response

I'm using: .NET Core 3.0 (C#) SOAPCore for serialization SQL Server I have a pre-built SOAP service from a legacy system that is providing a request structured with two (2) Elements (RequestHeader ...
William Howell's user avatar
1 vote
1 answer
2k views

How to send over a PDF file through WCF Service?

I am currently using Visual Studio 2015 and is building a website. I have tried using OperationContracts and ServiceContracts with a 3-tier architecture, however, I could only do the basic things (...
John Arc's user avatar
  • 183
1 vote
1 answer
213 views

Remove TransactionScopeRequired = true

I have an operation contract, on a windows service and it has an attribute [OperationBehavior(TransactionScopeRequired = true)] I would like to get rid of this attribute. Reason : containerize ...
Raj 's user avatar
  • 77
1 vote
2 answers
475 views

How to figure out (on server side) which contract a WCF Client has used to connect (multiple contracts)?

Consider the following: I have one master server and several servers on different locations which can communicate with the master server. Additionally (GUI) clients can connect to each server. So I ...
toATwork's user avatar
  • 1,347
1 vote
0 answers
288 views

Can I change a WCF method parameter from int data type to long?

Let's say I have an existing method in a WCF service: [OperationContract] CustomerInfo GetCustomerInfo(int customerId); It turns out I need to change this to take a long as its parameter instead of ...
Mike G's user avatar
  • 133
1 vote
1 answer
1k views

WCF wrapper for 3rd party web service - fire and forget [OperationContract(IsOneWay = true)]

I have created a WCF service which is a wrapper for a third party web service adding some additional functionality. The issue I have is that within my methods I want to call methods in the 3rd party ...
Nigel B's user avatar
  • 3,577
1 vote
0 answers
83 views

What is best practices for such scenario in Workflow?

I have one workflow which is calling a WCF service for some operations in my Library management application. Now one of the operation is to - to add a new book in the library. But if there does not ...
Nirman's user avatar
  • 6,753
0 votes
1 answer
241 views

Send DbConnection via OperationContract in WCF

Is there any possibility to send DbConnection as a parameter of OperationConstract in WCF? Because I get exception "Type System.Data.SqlClient.SqlConnection with data contract name SqlConnection:http:/...
user1759320's user avatar
0 votes
2 answers
169 views

WCF type conversion

I am stuck with this error..can anyone point me in right direction In my WCF service ..I have a operationcontract defined as follows... [OperationContract] [FaultContract(typeof(ProductFault))] ...
bp581's user avatar
  • 859