Click here to Skip to main content
11,720,547 members (66,940 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# WCF .NET4
I have a WCF service with the below service\operation\data contracts.



namespace Enrollment
   {
       [ServiceContract(Namespace = "http://docs.oasis-open.org/ws-sx/ws-trust/200512")]
       public interface wstep
       {
 
           [OperationContract(Action = "http://schemas.microsoft.com/windows/pki/2009/01/enrollment/RST/wstep", Name = "RequestSecurityToken")]
           RequestSecurityTokenResponseCollection RequestSecurityToken(string TokenType, string RequestType, BinarySecurityToken binarySecurityToken, AdditionalContext additionalContext);
 
       }
 
   [DataContract(Namespace = "http://schemas.xmlsoap.org/ws/2006/12/authorization")]
       public class AdditionalContext
       {
           [DataMember]
           public List<ContextItem> contextItem { get; set; }
       }
 
   [DataContract(Namespace = "http://schemas.xmlsoap.org/ws/2006/12/authorization")]
       public class ContextItem
       {
           [DataMember]
           public string Name { get; set; }
 
           [DataMember(Name="Value")]
           public object Item { get; set; }
 
       }
 
       [XmlRoot("BinarySecurityToken")]
       [DataContract(Namespace = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", Name = "BinarySecurityToken")]
       public class BinarySecurityToken
       {
           [XmlAttribute("ValueType")]
           [DataMember(Name = "ValueType",Order=1)]
           public string ValueType { get; set; }
 
           [XmlAttribute("EncodingType")]
           [DataMember(Name = "EncodingType", Order = 2)]
           public string EncodingType { get; set; }
       }
   }

However, I see that the client connects to the service but the last two parameters of the Operation - BinarySecurityToken and AdditionalContext are null when I check their values in the service. I have traced the client request, and I see the values are sent by the client correctly. The below mentioned is the SOAP body.

<s:Body>
           <wst:RequestSecurityToken>
               <wst:TokenType>http://schemas.microsoft.com/5.0.0.0/ConfigurationManager/Enrollment/DeviceEnrollmentToken</wst:TokenType>
               <wst:RequestType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/Issue</wst:RequestType>
               <wsse:BinarySecurityToken ValueType="http://schemas.microsoft.com/windows/pki/2009/01/enrollment#PKCS10" EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd#base64binary">MIICcTCCAV0CAQAwMDEuMCwGA1UEAxMlQj=</wsse:BinarySecurityToken>
               <ac:AdditionalContext xmlns="http://schemas.xmlsoap.org/ws/2006/12/authorization">
                   <ac:ContextItem Name="DeviceType">
                       <ac:Value>MyDevice</ac:Value>
                   </ac:ContextItem>
                   <ac:ContextItem Name="ApplicationVersion">
                       <ac:Value>18.10.6603.101</ac:Value>
                   </ac:ContextItem>
               </ac:AdditionalContext>
           </wst:RequestSecurityToken>
       </s:Body>



The first two parameters are showing up correctly. No idea what is going on.
Posted 27-Jan-13 21:30pm
Edited 27-Jan-13 23:19pm
(no name)38.2K
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 2,129
1 OriginalGriff 884
2 F-ES Sitecore 640
3 Maciej Los 609
4 Richard MacCutchan 540


Advertise | Privacy | Mobile
Web04 | 2.8.150901.1 | Last Updated 28 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100