builder.prepare(doc, crypto);
WSEncryptionPart encP = new WSEncryptionPart("definitions", "http://schemas.xmlsoap.org/wsdl/", "Element");
List<WSEncryptionPart> encryptionParts = new ArrayList<WSEncryptionPart>();
encryptionParts.add(encP);
Element ref = builder.encryptForRef(null, encryptionParts);
ref.removeChild(ref.getElementsByTagNameNS("http://www.w3.org/2001/04/xmlenc#", "DataReference").item(0));
builder.addExternalRefElement(ref, secHeader);
builder.prependToHeader(secHeader);
javax.xml.transform.Transformer transformer = TRANSFORMER_FACTORY.newTransformer();