messagecontract

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

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 = valu...

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...

Webservice Response is turned into ref parameter when using MessageContract

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; ...

Problem with MessageContract, Generic return types and clientside naming

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", Wrappe...

Can a WCF Operation that takes a single array as a parameter use MessageContracts?

I am trying to replace an asmx WebService with a WCF service. My primary goal is to keep the SOAP message the same. The caller is not .NET, and would require significant re-work to take minor changes to the contract. My pain point is that the web methods I am trying to replace webmethod uses the the following Attribute deceleration: [S...

WCF Serialising Enums using Message Contracts

I have some web services that use Message contracts. It's probably worth mentioning that for these services, I cannot shift to Data contracts... One of my types specifies a property whose type happens to be an enum: [SerializableAttribute()] [MessageContract(IsWrapped = false)] [KnownType(typeof(RiskTypeCode))] public partial class Ris...

MessageContract serialization with DCS

Is there a way to make the DataContractSerializer serialize a [MessageContract] the same way it appears when transmitted over SOAP? I have a class that appears as follows on the wire for a WCF call: <TestRequest xmlns="http://webservices.test.com/ServiceTest/1.1"&gt; <Name>Just Me</Name> </TestRequest> When serializing using the DCS...

WCF DataContractSerializer Behavior

I'm seeing some unusual behavior when using the DataContractSerializer. I have defined a message contract like so: namespace MyNamespace.DataContracts { [MessageContract(WrapperName = "order", WrapperNamespace = @"http://example.com/v1/order")] public class MyOrder { [MessageBodyMember(Namespace = @"http://example.com/v1/order", Ord...

WCF Message Contract and Streaming

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' i...

WCF: Data contract being converted to message contract

My WCF service exports a single operation, marked with the catch-all action and reply action so that it represents a common entry point to the service: [ServiceContract] public interface IService { [OperationContract (Action="*", ReplyAction="*")] Message MyMethod (Message msg); } Client proxies are still generated as data con...

How do I work directly with the XML in WCF Message Contracts?

I'm working with WCF, implementing a very (VERY) complex set of interactions (that we've been handed by a committee controlled by people who have never heard of computers) over SOAP. I will be receiving a message that looks like this: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"&gt; <s:Header> ... (lots of "standar...

WCF "Always generate message contracts" does not generate MessageContract

I'm importing a WSDL as a service definition (inbound to my service), and for whatever reason the client is formatting the request such that WCF cannot deserialize it without the proxy classes having MessageContract decorations. I've gotten it to work this way by adding the MessageContract attribute on the main container class, which ...

Send information in Soap Header to WCF service in C#

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...

WCF MesageContract - customizing outgoing SOAP message - multiple bodies

I have to call a Web service that is extremely demanding (unstandard) regarding the SOAP message format that it chooses to process. I have no control over the server side implementation and there is no WSDL available, all I have is an intercepted message attached bellow. My first thought was WCF+MessageContract, but whatever I do with t...

Why is my service method getting the wrong XML element?

Given the following service contract: [ServiceContract] public interface IMyInterface { [OperationContract(Action = "urn:myns:inputaction", ReplyAction = "urn:myns:replyaction")] Reply Method(Request request); } With this message contract (the reply is, as yet, inconsequential): [MessageContract(Is...

How can I convert an XML file to an instance of a MessageContract class?

I'm attempting to test a [MessageContract] class against an existing sample message, and I'm looking for a way to simplify development by reading the sample message file into an instance of my [MessageContract] class and seeing how it worked out (I'm dealing with a particularly complex contract here, of non-WCF origin). My [MessageContr...

Sending Soap Header from WCF service

Hello, I do migration from ASP.NET web service to WCF. Current code is like this: Server Side public class MyType { public int x; public string s; } public class MyService : WebService { public MyType myObj; [WebMethod] [SoapHeader("myObj", Direction=SoapHeaderDirection.InOut)] public string SomeMethod() // NO P...

WCF MessageContract List Serialization

I have the following MessageContracts to use as a request: <MessageContract(WrapperName:="get")> _ Public Class GetRequest Inherits BaseAuthenticatedRequest Protected _typeName As cEnum.eType Protected _id As Integer <MessageBodyMember()> _ Public Property TypeName() As cEnum.eType ... <MessageBodyMember()...

WCF: MessageBodyMember Ignore Order

I'm using MessageContracts to define my web method signatures and return types. Such as: <MessageContract(WrapperName:="get")> _ Public Class GetRequest Inherits BaseAuthenticatedRequest Protected _typeName As cEnum.eType Protected _id As Integer <MessageBodyMember()> _ Public Property TypeName() As cEnum.eType ...