4

My ASP.NET web application uses the WSE 3.0 protocol by referencing the assembly Microsoft.Web.Services3.dll, v2.0.50727

namespace Microsoft.Web.Services3
{
    public class WebServicesClientProtocol : SoapHttpClientProtocol
    {
        public WebServicesClientProtocol();

        ............
        public void SetPolicy(Policy policy);
        public void SetPolicy(string policyName);
        ............
    }
}

My question is specific to SetPolicy(string policyName) Currently the string is gotten from the config file specfic for this policy.

<policies xmlns="http://schemas.microsoft.com/wse/2005/06/policy">
  <extensions>
    <extension name="CertificateOverTransportSecurityAssertion" type="ABCD.ApplicationBlocks.WSSecurity.CertificateOverTransportSecurityAssertion, AAAA.ApplicationBlocks.WSSecurity" />
  </extensions>
  <policy name="ClientPolicy">
    <CertificateOverTransportSecurityAssertion clientCertificateSubjectDistinguishedName="E=xxxxx, CN=yyyyy, OU=zzzz, O=ssss, L=hhhhh, S=ee, C=ii"/>
  </policy>
</policies>

I would like to configure from within the code.

//current -- where "ClientPolicy" is gotten from config. file. 
theServiceWse.SetPolicy("ClientPolicy");

//proposed usage of
    public void SetPolicy(Policy policy);

How should I go about this?

GilliVilla
  • 4,998
  • 11
  • 55
  • 96
  • what is speccific and specfic? :) – spajce Jan 21 '13 at 21:56
  • Just to check: were you aware that WSE is obsolete and has been replaced with WCF? – John Saunders Jan 21 '13 at 22:29
  • @JohnSaunders Yes. The current objective however is to avoid using a WSE config file rather than migrating to WCF. – GilliVilla Jan 21 '13 at 22:33
  • Can't you just do `theServiceWse.SetPolicy(new Policy(new CertificateOverTransportSecurityAssertion()))` (since CertificateOverTransportSecurityAssertion is specific to your app, you'll have to know how to set a clientCertificateSubjectDistinguishedName to it) – Simon Mourier Jan 27 '13 at 11:10

0 Answers0