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