Element timestampElement =
doc.createElementNS(
WSConstants.WSU_NS, WSConstants.WSU_PREFIX + ":" + WSConstants.TIMESTAMP_TOKEN_LN
);
DateFormat zulu = new XmlSchemaDateFormat();
Element elementCreated =
doc.createElementNS(
WSConstants.WSU_NS, WSConstants.WSU_PREFIX + ":" + WSConstants.CREATED_LN
);
Date createdDate = new Date();
long currentTime = createdDate.getTime();
createdDate.setTime(currentTime);
elementCreated.appendChild(doc.createTextNode(zulu.format(createdDate)));
timestampElement.appendChild(elementCreated);
zulu = new XmlSchemaDateFormat();
Element elementExpires =
doc.createElementNS(
WSConstants.WSU_NS, WSConstants.WSU_PREFIX + ":" + WSConstants.EXPIRES_LN
);
createdDate.setTime(currentTime + 300000);
elementExpires.appendChild(doc.createTextNode(zulu.format(createdDate)));
timestampElement.appendChild(elementExpires);
timestampElement.appendChild(elementExpires.cloneNode(true));
secHeader.getSecurityHeader().appendChild(timestampElement);