Package org.apache.ws.policy.util

Examples of org.apache.ws.policy.util.PolicyWriter


  
   protected void addPolicyDefinition(Policy policy)
   {
      try
      {
         PolicyWriter writer = PolicyFactory.getPolicyWriter(PolicyFactory.StAX_POLICY_WRITER);
         ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
         writer.writePolicy(policy, outputStream);
         Element element = DOMUtils.parse(outputStream.toString(Constants.DEFAULT_XML_CHARSET));
         WSDLExtensibilityElement ext = new WSDLExtensibilityElement(Constants.WSDL_ELEMENT_POLICY, element);
         wsdl.addExtensibilityElement(ext);
         //optional: to obtain a better looking wsdl, register ws-policy
         //prefix in wsdl:definitions if it is not defined there yet
View Full Code Here


   
  public static void writePolicy(PolicyInclude policy, OutputStream out) {
    if (policy != null) {
      Policy pl = policy.getEffectivePolicy();
      if (pl != null) {
        PolicyWriter write = PolicyFactory
            .getPolicyWriter(PolicyFactory.StAX_POLICY_WRITER);
        write.writePolicy(pl, out);
        try {
          out.close();
        } catch (IOException e) {
          e.printStackTrace();
        }
      } else {
        PrintWriter write = new PrintWriter(out);
        write.write("<policy>no policy found</policy>");
        write.flush();
        write.close();
      }
    } else {
      PrintWriter write = new PrintWriter(out);
      write.write("<policy>no policy found</policy>");
      write.flush();
      write.close();
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.ws.policy.util.PolicyWriter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.