el.setRequired(addressing.required());
bindingInfo.addExtensor(el);
StringBuilder polRefId = new StringBuilder(bindingInfo.getName().getLocalPart());
polRefId.append("_WSAM_Addressing_Policy");
UnknownExtensibilityElement uel = new UnknownExtensibilityElement();
W3CDOMStreamWriter writer = new W3CDOMStreamWriter();
writer.writeStartElement("wsp", "PolicyReference", PolicyConstants.NAMESPACE_WS_POLICY);
writer.writeAttribute("URI", "#" + polRefId.toString());
writer.writeEndElement();
Element pr = writer.getDocument().getDocumentElement();
uel.setElement(pr);
uel.setElementType(DOMUtils.getElementQName(pr));
bindingInfo.addExtensor(uel);
writer = new W3CDOMStreamWriter();
writer.writeStartElement("wsp", "Policy", PolicyConstants.NAMESPACE_WS_POLICY);
writer.writeAttribute("wsu", PolicyConstants.WSU_NAMESPACE_URI,
PolicyConstants.WSU_ID_ATTR_NAME, polRefId.toString());
writer.writeStartElement("wsam", "Addressing", JAXWSAConstants.NS_WSAM);
if (!addressing.required()) {
writer.writeAttribute("wsp", PolicyConstants.NAMESPACE_WS_POLICY,
"Optional", "true");
}
writer.writeStartElement("wsp", "Policy", PolicyConstants.NAMESPACE_WS_POLICY);
String s = getAddressingRequirement(addressing);
if (s != null) {
writer.writeEmptyElement("wsam", s, JAXWSAConstants.NS_WSAM);
}
writer.writeEndElement();
writer.writeEndElement();
writer.writeEndElement();
pr = writer.getDocument().getDocumentElement();
uel = new UnknownExtensibilityElement();
uel.setElement(pr);
uel.setElementType(DOMUtils.getElementQName(pr));
if (bindingInfo.getService().getDescription() == null) {
DescriptionInfo description = new DescriptionInfo();
description.setName(bindingInfo.getService().getName());
bindingInfo.getService().setDescription(description);
bindingInfo.setDescription(description);