Welcome to Windows Communication Foundation (WCF)
Top Tasks :

WCF Team Bloggers

Browse by Tags

All Tags » Answers » Addressing   (RSS)

  • You Are Here

    Inside of a service method, how do I know where the message was delivered? Without defining what distinguishes a location it's hard to explain where 'here' is. I've got a few guesses though based on the most common variations of this question: OperationContext.Current.IncomingMessageHeaders.To OperationContext.Current.IncomingMessageProperties.Via HostingEnvironment.ApplicationVirtualPath Assembly.GetExecutingAssembly().Location HostingEnvironment.ApplicationPhysicalPath Next time: Serialization Temporary Assemblies Read More...
  • Mystery of the Disappearing Addressing Headers

    Why do the messages logged by my service show addressing headers but those headers disappear when the message is sent? This is easy to explain once you actually look at the messages. Here's a quick test program that generates some SOAP 1.1 messages with all of the different addressing permutations. using System; using System.Collections.Generic; using System.ServiceModel.Channels; using System.Xml; class MyBodyWriter : BodyWriter { public MyBodyWriter() : base ( true ) { } protected override void OnWriteBodyContents(XmlDictionaryWriter writer) { } } class Program { static IEnumerable<MessageVersion> Versions { get { yield return MessageVersion.Soap11; yield return MessageVersion.Soap11WSAddressing10; yield return MessageVersion.Soap11WSAddressingAugust2004; } } static void Main( string [] args) { foreach (MessageVersion version in Versions) { Message m = Message.CreateMessage(version, "http://MyApplication/Action" , new MyBodyWriter()); m.Headers.To = new Uri( "http://localhost/service" ); Console.WriteLine( "MessageVersion: {0}\n{1}\n" , version, m.ToString()); } Console.ReadLine(); } } That generates the following set of messages: MessageVersion: Soap11 (http://schemas.xmlsoap.org/soap/envelope/) AddressingNone (http://schemas.microsoft.com/ws/2005/05/addressing/none) < s:Envelope xmlns:s ="http://schemas.xmlsoap.org/soap/envelope/" > < s:Header > < Action s:mustUnderstand ="1" xmlns ="http://schemas.microsoft.com/ws/2005/05/addressing/none" > http://MyApplication/Action </ Action > < To s:mustUnderstand ="1" xmlns ="http://schemas.microsoft.com/ws/2005/05/addressing/none" > http://localhost/service </ To > </ s:Header > < s:Body /> </ s:Envelope > MessageVersion: Soap11 (http://schemas.xmlsoap.org/soap/envelope/) Addressing10 (http://www.w3.org/2005/08/addressing) < s:Envelope xmlns:a ="http://www.w3.org/2005/08/addressing" xmlns:s ="http://schemas.xmlsoap.org/soap/envelope/" > < s:Header > < a:Action s:mustUnderstand ="1" > http://MyApplication/Action </ a:Action > < a:To s:mustUnderstand ="1" > http://localhost/service </ a:To > </ s:Header > < s:Body /> </ s:Envelope > MessageVersion: Soap11 (http://schemas.xmlsoap.org/soap/envelope/) Addressing200408 (http://schemas.xmlsoap.org/ws/2004/08/addressing) < s:Envelope xmlns:a ="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:s ="http://schemas.xmlsoap.org/soap/envelope/" > < s:Header Read More...
  • Setting a User Principal on the Endpoint

    How do I set the user principal name that the client will use when calling the service? The user principal name can be set through either code or configuration, and it's considered a part of the endpoint address used by the client. That means that physically you'll find the user principal name and the description of the endpoint collocated. In configuration that looks like: < client > < endpoint address ="..." binding ="..." bindingConfiguration ="..." contract ="..." name ="..." > < identity > < userPrincipalName value ="name@address.com" /> </ identity > </ endpoint > </ client > And, in code that looks like: EndpointAddress address = new EndpointAddress( "..." , UpnEndpointIdentity.CreateUpnIdentity( "name@address.com" ), null ); Next time: Differences Between WSDL and XSD Read More...

Copyright © 2006 Microsoft Corporation. All Rights Reserved. | Terms of Use | Privacy Statement | Contact Us