public MessagePolicy getXWSSPolicy() throws PolicyException {
   MessagePolicy mp = null;
   try {
     mp = _policyContainer.getMessagePolicy();
   } catch (PolicyGenerationException ex) {
     logger.log(Level.SEVERE, "" + effectivePolicy, ex);
     throw new PolicyException("Unable to digest SecurityPolicy ");
   }
   // try{
   if (wssAssertion != null) {
     try {
       mp.setWSSAssertion(
           getWssAssertion((com.sun.xml.ws.security.policy.WSSAssertion) wssAssertion));
     } catch (PolicyGenerationException ex) {
       logger.log(
           Level.SEVERE,
           LogStringsMessages.SP_0104_ERROR_SIGNATURE_CONFIRMATION_ELEMENT(ex.getMessage()),
           ex);
       throw new PolicyException(
           LogStringsMessages.SP_0104_ERROR_SIGNATURE_CONFIRMATION_ELEMENT(ex.getMessage()));
     }
   }
   if (policyBinding != null && policyBinding.getAlgorithmSuite() != null) {
     mp.setAlgorithmSuite(getAlgoSuite(policyBinding.getAlgorithmSuite()));
   }
   if (policyBinding != null && policyBinding.getLayout() != null) {
     mp.setLayout(getLayout(policyBinding.getLayout()));
   }
   if (isIncoming && reqElements.size() > 0) {
     try {
       com.sun.xml.ws.security.impl.policyconv.RequiredElementsProcessor rep =
           new com.sun.xml.ws.security.impl.policyconv.RequiredElementsProcessor(reqElements, mp);
       rep.process();
     } catch (PolicyGenerationException ex) {
       logger.log(
           Level.SEVERE, LogStringsMessages.SP_0103_ERROR_REQUIRED_ELEMENTS(ex.getMessage()), ex);
       throw new PolicyException(
           LogStringsMessages.SP_0103_ERROR_REQUIRED_ELEMENTS(ex.getMessage()));
     }
   }
   if (transportBinding) {
     mp.setSSL(transportBinding);
   }
   return mp;
 }
  public void process() throws PolicyException {
    collectPolicies();
    PolicyAssertion binding = (PolicyAssertion) getBinding();
    policyBinding = (Binding) binding;
    if (binding == null) {
      // log error.
      // logger.log(Level.SEVERE,LogStringsMessages.SP_0105_ERROR_BINDING_ASSR_NOT_PRESENT());
      // throw new PolicyException(LogStringsMessages.SP_0105_ERROR_BINDING_ASSR_NOT_PRESENT());
      // We handle this now
      NilBindingProcessor nbp = new NilBindingProcessor(isServer, isIncoming, _policyContainer);
      nbp.process();
      processNonBindingAssertions(nbp);
      return;
    }
    if (PolicyUtil.isTransportBinding(binding, spVersion)) {
      if (logger.isLoggable(Level.FINE)) {
        logger.log(Level.FINE, "TransportBinding was configured in the policy");
      }
      TransportBindingProcessor tbp =
          new TransportBindingProcessor(
              (TransportBinding) binding, isServer, isIncoming, _policyContainer);
      tbp.process();
      processNonBindingAssertions(tbp);
      transportBinding = true;
    } else {

      iAP = new IntegrityAssertionProcessor(_binding.getAlgorithmSuite(), _binding.isSignContent());
      eAP = new EncryptionAssertionProcessor(_binding.getAlgorithmSuite(), false);

      _policyContainer.setPolicyContainerMode(_binding.getLayout());
      if (PolicyUtil.isSymmetricBinding(binding.getName(), spVersion)) {

        if (logger.isLoggable(Level.FINE)) {
          logger.log(Level.FINE, "SymmetricBinding was configured in the policy");
        }
        SymmetricBindingProcessor sbp =
            new SymmetricBindingProcessor(
                (SymmetricBinding) _binding,
                _policyContainer,
                isServer,
                isIncoming,
                signedParts,
                encryptedParts,
                signedElements,
                encryptedElements,
                spVersion);
        if (wssAssertion != null && PolicyUtil.isWSS11(wssAssertion, spVersion)) {
          sbp.setWSS11((WSSAssertion) wssAssertion);
        }
        sbp.process();
        processNonBindingAssertions(sbp);
        sbp.close();

      } else if (PolicyUtil.isAsymmetricBinding(binding.getName(), spVersion)) {

        if (logger.isLoggable(Level.FINE)) {
          logger.log(Level.FINE, "AsymmetricBinding was configured in the policy");
        }
        AsymmetricBindingProcessor abp =
            new AsymmetricBindingProcessor(
                (AsymmetricBinding) _binding,
                _policyContainer,
                isServer,
                isIncoming,
                signedParts,
                encryptedParts,
                signedElements,
                encryptedElements,
                spVersion);
        if (wssAssertion != null && PolicyUtil.isWSS11(wssAssertion, spVersion)) {
          abp.setWSS11((WSSAssertion) wssAssertion);
        }
        abp.process();
        processNonBindingAssertions(abp);
        abp.close();
      }
    }
  }
 public AlgorithmSuite getBindingLevelAlgSuite() {
   if (_binding != null) return _binding.getAlgorithmSuite();
   else return new com.sun.xml.ws.security.impl.policy.AlgorithmSuite();
 }