Added header items disappears when versioning

Jun 14, 2008 at 7:42 PM
I have followed the Calculator Tutorial successfully. Then I added my own endpoint behavior implementation using XAML as a policy. My new behavior adds two new header items. All is fine when calling the advanced calculator operations. Then I call the retired AddIntegers 1.0.0.0 version and the header items dissapear. Why is that?
Developer
Jun 17, 2008 at 7:59 PM
As I understand you want the custom headers to be sent to the service implementation (in this case one of the two calculator services). 
Are you saying when you invoke the published 1.1.0.0 version of AddIntegers (which routes to the advanced calculator) the header is sent along, but when you send a message for the the Active but not published 1.0.0.0 version of AddIntegers the headers are not sent to the Basic Calculator service?

I ran a test where I added a message inspector via policy on an endpoint that added a custom header.  The header flowed through to the service implementation regardless of which version of AddIntegers was invoked.  Note, that the reply does not include the custom header for either invocation.  It would be up to the message inspector to add the header back into the reply message if it is to be sent down to the original caller.




casperd wrote:
I have followed the Calculator Tutorial successfully. Then I added my own endpoint behavior implementation using XAML as a policy. My new behavior adds two new header items. All is fine when calling the advanced calculator operations. Then I call the retired AddIntegers 1.0.0.0 version and the header items dissapear. Why is that?


Jun 19, 2008 at 11:05 AM

Yes you described my scenario correctly. For me all operations except the 1.0.0.0 version are working as expected.

botto wrote:
As I understand you want the custom headers to be sent to the service implementation (in this case one of the two calculator services). 
Are you saying when you invoke the published 1.1.0.0 version of AddIntegers (which routes to the advanced calculator) the header is sent along, but when you send a message for the the Active but not published 1.0.0.0 version of AddIntegers the headers are not sent to the Basic Calculator service?

I ran a test where I added a message inspector via policy on an endpoint that added a custom header.  The header flowed through to the service implementation regardless of which version of AddIntegers was invoked.  Note, that the reply does not include the custom header for either invocation.  It would be up to the message inspector to add the header back into the reply message if it is to be sent down to the original caller.




casperd wrote:
I have followed the Calculator Tutorial successfully. Then I added my own endpoint behavior implementation using XAML as a policy. My new behavior adds two new header items. All is fine when calling the advanced calculator operations. Then I call the retired AddIntegers 1.0.0.0 version and the header items dissapear. Why is that?





Developer
Jun 20, 2008 at 9:59 PM
So have you created your own Calculator service implementation or attached a message inspector to the existing implementation?  If you created your own, in the AddIntegers method you'd be looking at OperationContext.Current.IncommingMessageHeaders to find your custom header.

 

foreach (MessageHeaderInfo header in OperationContext.Current.IncomingMessageHeaders)
{
   Console.WriteLine("Header: " + header.Name);   //or do something else with the header
}

 


If you attached an IDispatchMessageInspector to the existing calculator service, you'd do the following to look at all the headers (in AfterReceiveRequest):

 

foreach (MessageHeaderInfo header in request.Headers)
{
   Console.WriteLine("Header: " + header.Name);  //or do something else with the header
}

 

We don't treat the message headers any differently between the two scenarios of calling AddIntgers, so I'm not sure why one would work for you and the other wouldn't.  I assume you are using the June 2008 CTP release?

What bindings are you using for the calculator services?


 


casperd wrote:

Yes you described my scenario correctly. For me all operations except the 1.0.0.0 version are working as expected.

botto wrote:
As I understand you want the custom headers to be sent to the service implementation (in this case one of the two calculator services). 
Are you saying when you invoke the published 1.1.0.0 version of AddIntegers (which routes to the advanced calculator) the header is sent along, but when you send a message for the the Active but not published 1.0.0.0 version of AddIntegers the headers are not sent to the Basic Calculator service?

I ran a test where I added a message inspector via policy on an endpoint that added a custom header.  The header flowed through to the service implementation regardless of which version of AddIntegers was invoked.  Note, that the reply does not include the custom header for either invocation.  It would be up to the message inspector to add the header back into the reply message if it is to be sent down to the original caller.




casperd wrote:
I have followed the Calculator Tutorial successfully. Then I added my own endpoint behavior implementation using XAML as a policy. My new behavior adds two new header items. All is fine when calling the advanced calculator operations. Then I call the retired AddIntegers 1.0.0.0 version and the header items dissapear. Why is that?








Jun 27, 2008 at 9:01 AM

I'm using the existing calculator service implementations. I modified the .config files to be able to inspect the messages and headers.

The only thing I've done is to add a policy to the endpoint with the 2 versions of the AddIntegers method, where all other methods work as expected, but not the version 1.0.0.0 of AddIntegers. The one with the transformation added.

 

 

class SSOPolicyDispatchinspector : IDispatchMessageInspector
{
   ...

 

   public

object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext)
  {
      ...
      MessageHeader header1 = MessageHeader.CreateHeader("UserName", "urn://mycomp.se/sso", cred.UserName);

 

      request.Headers.Add(header1);

 

 

 

I'm using the June CTP. All configuration has been done based on the walkthrough guide.


botto wrote:
So have you created your own Calculator service implementation or attached a message inspector to the existing implementation?  If you created your own, in the AddIntegers method you'd be looking at OperationContext.Current.IncommingMessageHeaders to find your custom header.

 

foreach (MessageHeaderInfo header in OperationContext.Current.IncomingMessageHeaders)
{
   Console.WriteLine("Header: " + header.Name);   //or do something else with the header
}

 

 


If you attached an IDispatchMessageInspector to the existing calculator service, you'd do the following to look at all the headers (in AfterReceiveRequest):

 

foreach (MessageHeaderInfo header in request.Headers)
{
   Console.WriteLine("Header: " + header.Name);  //or do something else with the header
}

 

 

We don't treat the message headers any differently between the two scenarios of calling AddIntgers, so I'm not sure why one would work for you and the other wouldn't.  I assume you are using the June 2008 CTP release?

What bindings are you using for the calculator services?


 


casperd wrote:

Yes you described my scenario correctly. For me all operations except the 1.0.0.0 version are working as expected.

botto wrote:
As I understand you want the custom headers to be sent to the service implementation (in this case one of the two calculator services). 
Are you saying when you invoke the published 1.1.0.0 version of AddIntegers (which routes to the advanced calculator) the header is sent along, but when you send a message for the the Active but not published 1.0.0.0 version of AddIntegers the headers are not sent to the Basic Calculator service?

I ran a test where I added a message inspector via policy on an endpoint that added a custom header.  The header flowed through to the service implementation regardless of which version of AddIntegers was invoked.  Note, that the reply does not include the custom header for either invocation.  It would be up to the message inspector to add the header back into the reply message if it is to be sent down to the original caller.




casperd wrote:
I have followed the Calculator Tutorial successfully. Then I added my own endpoint behavior implementation using XAML as a policy. My new behavior adds two new header items. All is fine when calling the advanced calculator operations. Then I call the retired AddIntegers 1.0.0.0 version and the header items dissapear. Why is that?











Developer
Jun 29, 2008 at 7:36 PM
I had some time to test this out a bit and am able to repro your scenario.  I still need to dig into the cause, but I wanted to let you know I experience the same thing.
Developer
Jun 29, 2008 at 8:15 PM
Edited Jun 29, 2008 at 8:25 PM
Ok, I've confirmed this is a bug.  If you specify a transform for incoming messages, any custom headers will be removed before the message is delivered to the service implementation.  If no request transform is specified, the custom headers flow through just fine.

I'll file this as an issue.