servicecontract

Use parameter “params string[]” in WCF Rest endpoint

爱⌒轻易说出口 提交于 2019-12-08 01:10:39
问题 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 parameter in an OperationContract and define this in the UriTemplate? [ServiceContract] public interface IRestService { [OperationContract] [WebGet(UriTemplate = "operations/{values}")] void Operations(params string[] values); } 回答1: You should not do this on a GET operation. GET operations support

What is the format of the DataContractAttribute.Namespace Property?

烂漫一生 提交于 2019-12-06 20:52:35
This MSDN article recommends always to provide a namespace to a ServiceContract and DataContract. Examples usually have a "schema" prefix and a URI type pattern for the namespace such as Namespace="urn:WCFEssentials/Samples/2008/12" instead of a traditional C# namespace with dot-notation such as Namespace="MyNamespace.MyDataClasses" What is the suggested format the namespace property? Do we need the schema prefix? Why is this format suggested? It's an XML Namespace . Those can either be in the urn: format or they can be URLs. Here are some additional suggestions from MSDN : The namespace can

Wcf service inheritance (Extend a service)

假如想象 提交于 2019-12-06 15:09:51
The program I am working on exposes both callbacks and services using wcf. Basically, what the services do is simply return some variables value. As for the callback, they simply update those variables. I want to be able to expose one class containing only the services and one class containing the services and the callbacks. For example : [ServiceContract] [ServiceBehavior(InstanceContextMode=InstanceContextMode::Single, ConcurrencyMode=ConcurrencyMode::Multiple)] public ServiceClass { [OperationContract] public int getValue() { return mValue; } protected static int mValue; }; [ServiceContract

Provide ServiceKnownType during runtime?

怎甘沉沦 提交于 2019-12-06 08:15:26
问题 I've got a working WCF interface using more than 100 ServiceKnownType in the contract like this: [ServiceKnownType(typeof(RowUser))] [ServiceKnownType(typeof(RowRegion))] [ServiceKnownType(typeof(RowDocument))] [... loads more ...] [ServiceContract(SessionMode = SessionMode.Required)] public interface IServiceBrowse : IDisposable { [OperationContract] void Insert(Row satz); } Is there any way to provide these ServiceKnownTypes during runtime? It is not only error-prone and tedious to add all

Provide ServiceKnownType during runtime?

女生的网名这么多〃 提交于 2019-12-04 14:53:31
I've got a working WCF interface using more than 100 ServiceKnownType in the contract like this: [ServiceKnownType(typeof(RowUser))] [ServiceKnownType(typeof(RowRegion))] [ServiceKnownType(typeof(RowDocument))] [... loads more ...] [ServiceContract(SessionMode = SessionMode.Required)] public interface IServiceBrowse : IDisposable { [OperationContract] void Insert(Row satz); } Is there any way to provide these ServiceKnownTypes during runtime? It is not only error-prone and tedious to add all these ServiceKnownTypes in the source, it keeps my assemblies tied together in a way I don't like (I'd

WCF class implementing two operation contracts in different service contracts with same name

穿精又带淫゛_ 提交于 2019-12-04 04:49:37
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 both contracts. But I'm not able to access the service from client code. It displays a big error when I try to update the service reference as: Metadata contains an error that cannot be resolved.... There was no endpoint listening at ... , etc. I know that you can't have two

WCF contract changes that affect clients

荒凉一梦 提交于 2019-12-03 05:17:41
问题 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? Add/remove/change the DataContract's serialized properties? Add/remove OperationContracts from a ServiceContract? A friend asked a similar question here: Does

WCF contract changes that affect clients

夙愿已清 提交于 2019-12-02 18:34:21
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? Add/remove/change the DataContract's serialized properties? Add/remove OperationContracts from a ServiceContract? A friend asked a similar question here: Does adding a method to a WCF ServiceContract break existing clients? EDIT: As John Saunders pointed out,

generate wcf server code from wsdl files

徘徊边缘 提交于 2019-12-02 07:10:48
Greetings, I would like to generate some contract based on wsdl file. I used svcutil but I suspect it generated it wrong as all contract methods have void returned type. Is there any tool for this purpose? EDIT: here is the wsdl file: <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://dantek.com.pl/EDItEUR/EDItX/LibraryBookSupply/WebService

Single endpoint with multiple service contracts

╄→гoц情女王★ 提交于 2019-12-01 05:48:25
How can I write a WCF web service that has single endpoint but multiple service contract? Example: [ServiceContract] public interface IWirelessService { [OperationContract] void AddWireless(); } [ServiceContract] public interface IWiredService { [OperationContract] void AddWired(); } [ServiceContract] public interface IInternetService { [OperationContract] void AddInternet(); } Lets think like IInternetService is my main webs service and i want to implement IwiredService and IWirelessService in it, but i want to do implementation in their classes.Is this possible? How can i solve this problem?