messagecontract

Send information in Soap Header to WCF service in C#

谁说胖子不能爱 提交于 2019-12-25 16:46:30
问题 i want a web application to create a service reference to my WCF service, insert information to the header of the soap call and call my WCF method. i read about MessageContract attribute and declared one in the interface file: [MessageContract] public class BasicServiceHeader { [MessageHeader] public string myString; } my WCf interface is: [ServiceContract] public interface IBasicService { [OperationContract] [WebGet(UriTemplate = "GetData?value={value}")] // Add support for HTTP GET Requests

Customize SOAP Header namespace prefixes in WCF

眉间皱痕 提交于 2019-12-22 07:24:26
问题 I have wrote about a way to customize namespaces and namespace prefixes in a SOAP message generated by wcf here. However, I can't find a proper method to override in the Message class in order to customize the SOAP headers of the messages. I want to make this message: <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"> <s:Header> <h:Protocol xmlns="http://www.xyz.de/Protocol" xmlns:h="http://www.xzy.de/Protocol"> <version>IFD_1.4</version> </h:Protocol> </s:Header> <s:Body xmlns

WCF MessageContract Inheritance

做~自己de王妃 提交于 2019-12-17 21:03:35
问题 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 TestMessage : BaseMessage { } I then have an asynchronous OperationContract on a ServiceContract defined as: [OperationContract(AsyncPattern = true)] IAsyncResult

WCF MessageContract wrapping and lists

拜拜、爱过 提交于 2019-12-14 01:32:20
问题 I've received a specification from a customer of how their web-service client works. The specification is the actual SOAP XML messages that are sent and received from the service as well as the corresponding XSD. The customer want me to implement a web-service that comply with the client. The client is written with axis2 ws-stack and what i'm trying to do is to create a web-service in WCF that will accept the requests made by the client and return a response that comply with the XML that they

Problem with MessageContract, Generic return types and clientside naming

好久不见. 提交于 2019-12-12 04:47:09
问题 I'm building a web service which uses MessageContracts, because I want to add custom fields to my SOAP header. In a previous topic, I learned that a composite response has to be wrapped. For this purpose, I devised a generic ResponseWrapper class. [MessageContract(WrapperNamespace = "http://mynamespace.com", WrapperName="WrapperOf{0}")] public class ResponseWrapper<T> { [MessageBodyMember(Namespace = "http://mynamespace.com")] public T Response { get; set; } } I made a ServiceResult base

Incorrect Soap's namespaces in inner complex types

帅比萌擦擦* 提交于 2019-12-12 01:55:30
问题 Im using the MessageContract. Here the wrong SOAP message, which is generated: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Header> ... </s:Header> <s:Body> <BoolValue xmlns="http://my.site/rev2015">true</BoolValue> <StringValue xmlns="http://my.site/rev2015">HelloWorld</StringValue> <InnerType xmlns="http://my.site/rev2015" xmlns:a="http://schemas.datacontract.org/2004/07/Server" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <a:ANotherBool>true</a:ANotherBool>

Webservice Response is turned into ref parameter when using MessageContract

大城市里の小女人 提交于 2019-12-11 02:36:02
问题 I have defined the following Interface [ServiceContract] public interface IHealthProducts { [OperationContract()] ResponseClass OrderSelfSignedHealthCertificate(); } Which returns the following type [MessageContract] public class ResponseClass { [MessageBodyMember] public string AnimalSpeciesCode { get; set; } [MessageBodyMember] public int VBN { get; set; } } I expected that the generated client code would expose the OrderSelfSignedHealthCertificate method in the following way:

WCF Message Contract and Streaming

自闭症网瘾萝莉.ら 提交于 2019-12-08 10:20:07
问题 I'm going boarder line crazy, I have been working with this for over a day and still have no idea why it doesn't work, I have a MessageContract that I'm using to send out a stream, but I get the following error, Type 'System.IO.FileStream' with data contract name 'FileStream:http://schemas.datacontract.org/2004/07/System.IO' is not expected. Add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of

Customize SOAP Header namespace prefixes in WCF

人走茶凉 提交于 2019-12-05 10:18:50
I have wrote about a way to customize namespaces and namespace prefixes in a SOAP message generated by wcf here . However, I can't find a proper method to override in the Message class in order to customize the SOAP headers of the messages. I want to make this message: <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"> <s:Header> <h:Protocol xmlns="http://www.xyz.de/Protocol" xmlns:h="http://www.xzy.de/Protocol"> <version>IFD_1.4</version> </h:Protocol> </s:Header> <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> </s:Body>

WCF DataContractSerializer doesn't pick up contract attributes… why not?

随声附和 提交于 2019-12-05 02:00:04
问题 I have the following type which I use as a message contract in WCF: [MessageContract(IsWrapped = true, WrapperNamespace = "http://example.com/services", WrapperName = "EchoRequest")] public class EchoRequest { public EchoRequest() { } public EchoRequest(String value) { Value = value; } [MessageBodyMember(Name = "Value", Namespace = "http://example.com/services", Order = 0)] public String Value { get; set; } } When I generate a proxy to this type using svcutil.exe , I get a client which is