List of usage examples for javax.xml.bind JAXBElement getValue
public T getValue()
Return the content model and attribute values for this element.
See #isNil() for a description of a property constraint when this value is null
From source file:edu.harvard.i2b2.eclipse.plugins.workplace.util.XmlUtil.java
public String writeQueryXML(String resultOptions) throws Exception { // String domString = edu.harvard.i2b2.common.util.xml.XMLUtil // .convertDOMElementToString(element); JAXBContext jc1 = JAXBContext.newInstance(edu.harvard.i2b2.crcxmljaxb.datavo.psm.query.ObjectFactory.class); Unmarshaller unMarshaller = jc1.createUnmarshaller(); JAXBElement queryDefinitionJaxbElement = (JAXBElement) unMarshaller .unmarshal(new StringReader(resultOptions)); QueryDefinitionType queryDefinitionType = (QueryDefinitionType) queryDefinitionJaxbElement.getValue(); //Document queryDefinitionType = edu.harvard.i2b2.common.util.xml.XMLUtil..convertStringToDOM(resultOptions); //new QueryDefinitionType(); ResultOutputOptionListType resultOutputOptionListType = new ResultOutputOptionListType(); // /loop thru the options ResultOutputOptionType resultOutputOptionType = new ResultOutputOptionType(); resultOutputOptionType.setName("patient_count_xml"); // );// www.j a va2s . com resultOutputOptionType.setPriorityIndex(1); resultOutputOptionListType.getResultOutput().add(resultOutputOptionType); QueryDefinitionRequestType queryDefinitionRequestType = new QueryDefinitionRequestType(); // create header PsmQryHeaderType headerType = new PsmQryHeaderType(); UserType userType = new UserType(); // userType.setLogin(UserInfoBean.getInstance().getUserName()); // userType.setGroup(System.getProperty("projectName")); // userType.setValue(UserInfoBean.getInstance().getUserName()); headerType.setUser(userType); headerType.setRequestType(PsmRequestTypeType.CRC_QRY_RUN_QUERY_INSTANCE_FROM_QUERY_DEFINITION); queryDefinitionRequestType.setQueryDefinition(queryDefinitionType); queryDefinitionRequestType.setResultOutputList(resultOutputOptionListType); RequestHeaderType requestHeader = new RequestHeaderType(); if (System.getProperty("QueryToolMaxWaitingTime") != null) { requestHeader .setResultWaittimeMs((Integer.parseInt(System.getProperty("QueryToolMaxWaitingTime"))) * 1000); } else { requestHeader.setResultWaittimeMs(180000); } BodyType bodyType = new BodyType(); edu.harvard.i2b2.crcxmljaxb.datavo.psm.query.ObjectFactory psmOf = new edu.harvard.i2b2.crcxmljaxb.datavo.psm.query.ObjectFactory(); bodyType.getAny().add(psmOf.createPsmheader(headerType)); bodyType.getAny().add(psmOf.createRequest(queryDefinitionRequestType)); ExportChildRequestMessage reqMsg = new ExportChildRequestMessage(); MessageHeaderType messageHeader = reqMsg.getMessageHeader(); SecurityType security = messageHeader.getSecurity(); security.setPassword(null); messageHeader.setSecurity(security); RequestMessageType requestMessageType = new RequestMessageType(); requestMessageType.setMessageBody(bodyType); requestMessageType.setMessageHeader(messageHeader); requestMessageType.setRequestHeader(requestHeader); edu.harvard.i2b2.common.util.jaxb.JAXBUtil jaxbUtil = WorkplaceJAXBUtil.getJAXBUtil(); StringWriter strWriter = new StringWriter(); try { edu.harvard.i2b2.wkplclient.datavo.i2b2message.ObjectFactory of = new edu.harvard.i2b2.wkplclient.datavo.i2b2message.ObjectFactory(); jaxbUtil.marshaller(of.createRequest(requestMessageType), strWriter); } catch (Exception e) { e.printStackTrace(); } return strWriter.toString(); }
From source file:edu.harvard.i2b2.eclipse.plugins.query.utils.XmlUtil.java
public String writeQueryXML(String resultOptions) throws Exception { // String domString = edu.harvard.i2b2.common.util.xml.XMLUtil // .convertDOMElementToString(element); JAXBContext jc1 = JAXBContext.newInstance(edu.harvard.i2b2.crcxmljaxb.datavo.psm.query.ObjectFactory.class); Unmarshaller unMarshaller = jc1.createUnmarshaller(); JAXBElement queryDefinitionJaxbElement = (JAXBElement) unMarshaller .unmarshal(new StringReader(resultOptions)); QueryDefinitionType queryDefinitionType = (QueryDefinitionType) queryDefinitionJaxbElement.getValue(); //Document queryDefinitionType = edu.harvard.i2b2.common.util.xml.XMLUtil..convertStringToDOM(resultOptions); //new QueryDefinitionType(); ResultOutputOptionListType resultOutputOptionListType = new ResultOutputOptionListType(); // /loop thru the options ResultOutputOptionType resultOutputOptionType = new ResultOutputOptionType(); resultOutputOptionType.setName("patient_count_xml"); // );//from www .j a v a 2 s . c o m resultOutputOptionType.setPriorityIndex(1); resultOutputOptionListType.getResultOutput().add(resultOutputOptionType); QueryDefinitionRequestType queryDefinitionRequestType = new QueryDefinitionRequestType(); // create header PsmQryHeaderType headerType = new PsmQryHeaderType(); UserType userType = new UserType(); // userType.setLogin(UserInfoBean.getInstance().getUserName()); // userType.setGroup(System.getProperty("projectName")); // userType.setValue(UserInfoBean.getInstance().getUserName()); headerType.setUser(userType); headerType.setRequestType(PsmRequestTypeType.CRC_QRY_RUN_QUERY_INSTANCE_FROM_QUERY_DEFINITION); queryDefinitionRequestType.setQueryDefinition(queryDefinitionType); queryDefinitionRequestType.setResultOutputList(resultOutputOptionListType); RequestHeaderType requestHeader = new RequestHeaderType(); if (System.getProperty("QueryToolMaxWaitingTime") != null) { requestHeader .setResultWaittimeMs((Integer.parseInt(System.getProperty("QueryToolMaxWaitingTime"))) * 1000); } else { requestHeader.setResultWaittimeMs(180000); } BodyType bodyType = new BodyType(); edu.harvard.i2b2.crcxmljaxb.datavo.psm.query.ObjectFactory psmOf = new edu.harvard.i2b2.crcxmljaxb.datavo.psm.query.ObjectFactory(); bodyType.getAny().add(psmOf.createPsmheader(headerType)); bodyType.getAny().add(psmOf.createRequest(queryDefinitionRequestType)); ExportChildRequestMessage reqMsg = new ExportChildRequestMessage(); MessageHeaderType messageHeader = reqMsg.getMessageHeader(); SecurityType security = messageHeader.getSecurity(); security.setPassword(null); messageHeader.setSecurity(security); RequestMessageType requestMessageType = new RequestMessageType(); requestMessageType.setMessageBody(bodyType); requestMessageType.setMessageHeader(messageHeader); requestMessageType.setRequestHeader(requestHeader); edu.harvard.i2b2.common.util.jaxb.JAXBUtil jaxbUtil = QueryJAXBUtil.getJAXBUtil(); StringWriter strWriter = new StringWriter(); try { edu.harvard.i2b2.crcxmljaxb.datavo.i2b2message.ObjectFactory of = new edu.harvard.i2b2.crcxmljaxb.datavo.i2b2message.ObjectFactory(); jaxbUtil.marshaller(of.createRequest(requestMessageType), strWriter); } catch (Exception e) { e.printStackTrace(); } return strWriter.toString(); }
From source file:edu.harvard.i2b2.patientSet.data.XmlUtil.java
public String writeQueryXML(String resultOptions) throws Exception { // String domString = edu.harvard.i2b2.common.util.xml.XMLUtil // .convertDOMElementToString(element); JAXBContext jc1 = JAXBContext.newInstance(edu.harvard.i2b2.crcxmljaxb.datavo.psm.query.ObjectFactory.class); Unmarshaller unMarshaller = jc1.createUnmarshaller(); JAXBElement queryDefinitionJaxbElement = (JAXBElement) unMarshaller .unmarshal(new StringReader(resultOptions)); QueryDefinitionType queryDefinitionType = (QueryDefinitionType) queryDefinitionJaxbElement.getValue(); //Document queryDefinitionType = edu.harvard.i2b2.common.util.xml.XMLUtil..convertStringToDOM(resultOptions); //new QueryDefinitionType(); ResultOutputOptionListType resultOutputOptionListType = new ResultOutputOptionListType(); // /loop thru the options ResultOutputOptionType resultOutputOptionType = new ResultOutputOptionType(); resultOutputOptionType.setName("patient_count_xml"); // );// www. j a v a2 s.co m resultOutputOptionType.setPriorityIndex(1); resultOutputOptionListType.getResultOutput().add(resultOutputOptionType); QueryDefinitionRequestType queryDefinitionRequestType = new QueryDefinitionRequestType(); // create header PsmQryHeaderType headerType = new PsmQryHeaderType(); UserType userType = new UserType(); // userType.setLogin(UserInfoBean.getInstance().getUserName()); // userType.setGroup(System.getProperty("projectName")); // userType.setValue(UserInfoBean.getInstance().getUserName()); headerType.setUser(userType); headerType.setRequestType(PsmRequestTypeType.CRC_QRY_RUN_QUERY_INSTANCE_FROM_QUERY_DEFINITION); queryDefinitionRequestType.setQueryDefinition(queryDefinitionType); queryDefinitionRequestType.setResultOutputList(resultOutputOptionListType); RequestHeaderType requestHeader = new RequestHeaderType(); if (System.getProperty("QueryToolMaxWaitingTime") != null) { requestHeader .setResultWaittimeMs((Integer.parseInt(System.getProperty("QueryToolMaxWaitingTime"))) * 1000); } else { requestHeader.setResultWaittimeMs(180000); } BodyType bodyType = new BodyType(); edu.harvard.i2b2.crcxmljaxb.datavo.psm.query.ObjectFactory psmOf = new edu.harvard.i2b2.crcxmljaxb.datavo.psm.query.ObjectFactory(); bodyType.getAny().add(psmOf.createPsmheader(headerType)); bodyType.getAny().add(psmOf.createRequest(queryDefinitionRequestType)); ExportChildRequestMessage reqMsg = new ExportChildRequestMessage(); MessageHeaderType messageHeader = reqMsg.getMessageHeader(); SecurityType security = messageHeader.getSecurity(); security.setPassword(null); messageHeader.setSecurity(security); RequestMessageType requestMessageType = new RequestMessageType(); requestMessageType.setMessageBody(bodyType); requestMessageType.setMessageHeader(messageHeader); requestMessageType.setRequestHeader(requestHeader); edu.harvard.i2b2.common.util.jaxb.JAXBUtil jaxbUtil = PatientSetJAXBUtil.getJAXBUtil(); StringWriter strWriter = new StringWriter(); try { edu.harvard.i2b2.crcxmljaxb.datavo.i2b2message.ObjectFactory of = new edu.harvard.i2b2.crcxmljaxb.datavo.i2b2message.ObjectFactory(); jaxbUtil.marshaller(of.createRequest(requestMessageType), strWriter); } catch (Exception e) { e.printStackTrace(); } return strWriter.toString(); }
From source file:eu.europa.esig.dss.tsl.service.TSLParser.java
@SuppressWarnings("rawtypes") private List<TSLServiceExtension> extractExtensions(ExtensionsListType serviceInformationExtensions) { if ((serviceInformationExtensions != null) && CollectionUtils.isNotEmpty(serviceInformationExtensions.getExtension())) { List<TSLServiceExtension> extensions = new ArrayList<TSLServiceExtension>(); for (ExtensionType extensionType : serviceInformationExtensions.getExtension()) { List<Object> content = extensionType.getContent(); if (CollectionUtils.isNotEmpty(content)) { List<TSLConditionsForQualifiers> conditionsForQualifiers = new ArrayList<TSLConditionsForQualifiers>(); for (Object object : content) { if (object instanceof JAXBElement) { JAXBElement jaxbElement = (JAXBElement) object; Object objectValue = jaxbElement.getValue(); if (objectValue instanceof QualificationsType) { QualificationsType qt = (QualificationsType) jaxbElement.getValue(); if ((qt != null) && CollectionUtils.isNotEmpty(qt.getQualificationElement())) { for (QualificationElementType qualificationElement : qt .getQualificationElement()) { List<String> qualifiers = extractQualifiers(qualificationElement); Condition condition = getCondition(qualificationElement.getCriteriaList()); if (CollectionUtils.isNotEmpty(qualifiers) && (condition != null)) { conditionsForQualifiers .add(new TSLConditionsForQualifiers(qualifiers, condition)); }/*ww w . j a v a 2 s . c o m*/ } } } } } if (CollectionUtils.isNotEmpty(conditionsForQualifiers)) { TSLServiceExtension extension = new TSLServiceExtension(); extension.setCritical(extensionType.isCritical()); extension.setConditionsForQualifiers(conditionsForQualifiers); extensions.add(extension); } } } return extensions; } return null; }
From source file:gov.nih.nci.integration.caaers.CaAERSParticipantServiceClientIntegrationTest.java
/** * Testcase for marshlling participant type * /* w w w .j a v a 2 s . co m*/ * @throws JAXBException - JAXBException * @throws DatatypeConfigurationException - DatatypeConfigurationException */ @Test public void marshalParticipantType() throws JAXBException, DatatypeConfigurationException { final ParticipantType pt = new ParticipantType(); pt.setFirstName("fn"); pt.setLastName("ln"); pt.setEthnicity(EthnicityType.NOT_HISPANIC_OR_LATINO); pt.setGender(GenderType.MALE); final DatatypeFactory df = DatatypeFactory.newInstance(); final GregorianCalendar gc = new GregorianCalendar(); gc.setTimeInMillis(new Date().getTime()); pt.setBirthDate(df.newXMLGregorianCalendar(gc)); pt.setRace(RaceType.WHITE); final OrganizationAssignedIdentifierType orgId = new OrganizationAssignedIdentifierType(); orgId.setType(ParticipantIdentifierType.MRN); orgId.setValue("123456"); orgId.setPrimaryIndicator(true); final OrganizationType ot = new OrganizationType(); ot.setName("UCSF)"); ot.setNciInstituteCode("UCSF"); orgId.setOrganization(ot); final ParticipantType.Identifiers ids = new ParticipantType.Identifiers(); ids.getOrganizationAssignedIdentifier().add(orgId); pt.setIdentifiers(ids); final AssignmentType at = new AssignmentType(); at.setStudySubjectIdentifier("456"); final StudySiteType sst = new StudySiteType(); final OrganizationType ot2 = new OrganizationType(); ot2.setName("UCSF)"); ot2.setNciInstituteCode("UCSF"); sst.setOrganization(ot2); final StudyType st = new StudyType(); final ReducedIdentifierType rit = new ReducedIdentifierType(); rit.setType(StudyIdentifierType.SITE_IDENTIFIER); rit.setValue("1.2.3.4.5"); final StudyType.Identifiers sids = new StudyType.Identifiers(); sids.setIdentifier(rit); st.setIdentifiers(sids); sst.setStudy(st); at.setStudySite(sst); final Assignments ass = new Assignments(); ass.getAssignment().add(at); pt.setAssignments(ass); final QName qname = new QName("http://webservice.caaers.cabig.nci.nih.gov/participant", "participant"); final JAXBElement<ParticipantType> ptJaxbEle = new JAXBElement<ParticipantType>(qname, ParticipantType.class, pt); final StringWriter sw = new StringWriter(); getMarshaller().marshal(ptJaxbEle, sw); Assert.assertNotNull(sw.toString()); JAXBElement<ParticipantType> jaxbEle = (JAXBElement<ParticipantType>) getUnMarshaller() .unmarshal(new StreamSource(new StringReader(sw.toString())), ParticipantType.class); Assert.assertNotNull(jaxbEle); Assert.assertNotNull(jaxbEle.getValue()); jaxbEle = (JAXBElement<ParticipantType>) getUnMarshaller() .unmarshal(new StreamSource(new StringReader(getPStr())), ParticipantType.class); Assert.assertNotNull(jaxbEle); final ParticipantType ptn = jaxbEle.getValue(); Assert.assertNotNull(ptn); }
From source file:com.evolveum.midpoint.wf.impl.processors.primary.user.AddAccountAssignmentAspect.java
private String getPermissionSetDisplayName(AssignmentType a) { if (a == null) { throw new IllegalArgumentException("Invalid parameter: " + a); }//from w ww .j a v a 2 s .co m ConstructionType construction = a.getConstruction(); List<ResourceAttributeDefinitionType> attrs = construction.getAttribute(); for (ResourceAttributeDefinitionType attr : attrs) { String attrName = attr.getRef().getLocalPart(); if (attrName.equals("psetDisplayName")) { List<JAXBElement<?>> values = attr.getOutbound().getExpression().getExpressionEvaluator(); JAXBElement<?> firstElement = values.iterator().next(); RawType val = (RawType) firstElement.getValue(); XNode xnode = val.getXnode(); PrimitiveXNode pxNode = (PrimitiveXNode) xnode; return String.valueOf(pxNode.getValue()); } else { continue; } } return null; }
From source file:it.cnr.icar.eric.server.cms.CanonicalXMLCatalogingService.java
public ServiceOutput invoke(ServerRequestContext context, ServiceInput input, ServiceType service, InvocationController invocationController, UserType user) throws RegistryException { if (log.isTraceEnabled()) { log.trace("CanonicalXMLCatalogingService.invoke()"); }/* ww w .j a va2s .c o m*/ ServiceOutput so = new ServiceOutput(); so.setOutput(context); RepositoryItem repositoryItem = input.getRepositoryItem(); // The RI is optional per the [ebRS] spec. Return empty ServiceOutput. if (repositoryItem != null) { @SuppressWarnings("unused") String roId = input.getRegistryObject().getId(); ServerRequestContext outputContext = null; try { outputContext = context; // new RequestContext(null); StreamSource inputSrc = getAsStreamSource((ExtrinsicObjectType) input.getRegistryObject()); StreamSource invocationControlFileSrc = rm.getAsStreamSource(invocationController.getEoId()); // dumpStream(invocationControlFileSrc); TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = initTransformer(tFactory, invocationControlFileSrc); // Use CatalogingService URIResolver to resolve RIs submitted in // the // ServiceInput object transformer.setURIResolver(getURIResolver(context)); // Set respository item as parameter transformer.setParameter("repositoryItem", input.getRegistryObject().getId()); // Create the output file with catalogedMetadata File outputFile = File.createTempFile("CanonicalXMLCatalogingService_OutputFile", ".xml"); outputFile.deleteOnExit(); log.debug("Tempfile= " + outputFile.getAbsolutePath()); StreamResult sr = new StreamResult(outputFile); transformer.transform(inputSrc, sr); @SuppressWarnings("unchecked") JAXBElement<RegistryObjectListType> ebRegistryObjectList = (JAXBElement<RegistryObjectListType>) bu .getJAXBContext().createUnmarshaller().unmarshal(outputFile); // take ComplexType from Element RegistryObjectListType catalogedMetadata = ebRegistryObjectList.getValue(); // RegistryObjectListType catalogedMetadata = (RegistryObjectListType) bu.getJAXBContext() // .createUnmarshaller().unmarshal(outputFile); // TODO: User should refer to "Service object for the // Content Management Service that generated the // Cataloged Content." outputContext.setUser(user); bu.getObjectRefsAndRegistryObjects(catalogedMetadata, outputContext.getTopLevelRegistryObjectTypeMap(), outputContext.getObjectRefTypeMap()); } catch (Exception e) { if (outputContext != context) { outputContext.rollback(); } throw new RegistryException(e); } so.setOutput(outputContext); // Setting this error list is redundant, but Content Validation // Services // currently output a Boolean and a RegistryErrorList, so using // same mechanism to report errors from Content Cataloging Services. so.setErrorList(outputContext.getErrorList()); if (outputContext != context) { outputContext.commit(); } } return so; }
From source file:org.apache.taverna.scufl2.rdfxml.WorkflowParser.java
@SuppressWarnings("unchecked") protected void readWorkflow(URI wfUri, URI source) throws ReaderException, IOException { if (source.isAbsolute()) throw new ReaderException("Can't read external workflow source " + source); InputStream bundleStream = getParserState().getUcfPackage().getResourceAsInputStream(source.getRawPath()); JAXBElement<WorkflowDocument> elem; try {/*w w w.j a v a 2 s. c o m*/ elem = (JAXBElement<WorkflowDocument>) unmarshaller.unmarshal(bundleStream); } catch (JAXBException e) { throw new ReaderException("Can't parse workflow document " + source, e); } URI base = getParserState().getLocation().resolve(source); if (elem.getValue().getBase() != null) base = base.resolve(elem.getValue().getBase()); if (elem.getValue().getAny().size() != 1) throw new ReaderException("Expects only a <Workflow> element in " + source); org.apache.taverna.scufl2.xml.Workflow workflow = (org.apache.taverna.scufl2.xml.Workflow) elem.getValue() .getAny().get(0); getParserState().setCurrentBase(base); parseWorkflow(workflow, wfUri); }
From source file:com.vmware.identity.sts.ws.SignatureValidator.java
/** * Evaluates if the provided list contains a single instance of a JAXBElement * which is of the given type/*from ww w.j a v a 2s.co m*/ * * @param list * @param valueType * @return */ @SuppressWarnings("unchecked") private <T> T getTheValue(List<?> list, Class<T> valueType, FaultKey key, String cause) { if (list == null) { throw new WSFaultException(key, cause); } JAXBElement<?> theOnlyElement = getSingleJaxbElement(list); if (theOnlyElement == null || !valueType.isInstance(theOnlyElement.getValue())) { throw new WSFaultException(key, cause); } return (T) theOnlyElement.getValue(); }
From source file:be.agiv.security.client.SecureConversationClient.java
/** * Gives back a secure conversation token using the given R-STS security * token. The R-STS security token should apply to this web service. * /*from w w w . j a va 2 s. co m*/ * @param rStsSecurityToken * the R-STS security token. * @return the secure conversation token to be used to secure the web * service calls. */ public SecurityToken getSecureConversationToken(SecurityToken rStsSecurityToken) { RequestSecurityTokenType requestSecurityToken = this.objectFactory.createRequestSecurityTokenType(); List<Object> requestSecurityTokenContent = requestSecurityToken.getAny(); requestSecurityTokenContent .add(this.objectFactory.createTokenType(WSConstants.SECURE_CONVERSATION_TOKEN_TYPE)); requestSecurityTokenContent.add(this.objectFactory.createRequestType(WSConstants.ISSUE_REQUEST_TYPE)); EntropyType entropy = this.objectFactory.createEntropyType(); requestSecurityTokenContent.add(this.objectFactory.createEntropy(entropy)); BinarySecretType binarySecret = this.objectFactory.createBinarySecretType(); entropy.getAny().add(this.objectFactory.createBinarySecret(binarySecret)); binarySecret.setType(WSConstants.SECRET_TYPE_NONCE); byte[] entropyData = new byte[256 / 8]; this.secureRandom.setSeed(System.currentTimeMillis()); this.secureRandom.nextBytes(entropyData); binarySecret.setValue(entropyData); requestSecurityTokenContent.add(this.objectFactory.createKeySize(256L)); BindingProvider bindingProvider = (BindingProvider) this.port; this.wsAddressingHandler.setAddressing(WSConstants.SEC_CONV_ISSUE_ACTION, this.location); this.wsSecurityHandler.setKey(rStsSecurityToken.getKey(), rStsSecurityToken.getAttachedReference(), rStsSecurityToken.getToken()); RequestSecurityTokenResponseCollectionType requestSecurityTokenResponseCollection = this.port .requestSecurityToken(requestSecurityToken); SecurityToken securityToken = new SecurityToken(); List<RequestSecurityTokenResponseType> requestSecurityTokenResponseList = requestSecurityTokenResponseCollection .getRequestSecurityTokenResponse(); RequestSecurityTokenResponseType requestSecurityTokenResponse = requestSecurityTokenResponseList.get(0); List<Object> requestSecurityTokenResponseContent = requestSecurityTokenResponse.getAny(); for (Object contentObject : requestSecurityTokenResponseContent) { LOG.debug("content object: " + contentObject.getClass().getName()); if (contentObject instanceof Element) { Element contentElement = (Element) contentObject; LOG.debug("element name: " + contentElement.getLocalName()); } if (contentObject instanceof JAXBElement) { JAXBElement jaxbElement = (JAXBElement) contentObject; QName qname = jaxbElement.getName(); if (WSConstants.ENTROPY_QNAME.equals(qname)) { LOG.debug("trust:Entropy"); EntropyType serverEntropy = (EntropyType) jaxbElement.getValue(); List<Object> entropyContent = serverEntropy.getAny(); for (Object entropyObject : entropyContent) { if (entropyObject instanceof JAXBElement) { JAXBElement entropyElement = (JAXBElement) entropyObject; if (WSConstants.BINARY_SECRET_QNAME.equals(entropyElement.getName())) { BinarySecretType serverBinarySecret = (BinarySecretType) entropyElement.getValue(); byte[] serverSecret = serverBinarySecret.getValue(); P_SHA1 p_SHA1 = new P_SHA1(); byte[] key; try { key = p_SHA1.createKey(entropyData, serverSecret, 0, 256 / 8); } catch (ConversationException e) { LOG.error(e); return null; } LOG.debug("client secret size: " + entropyData.length); LOG.debug("server secret size: " + serverSecret.length); LOG.debug("key size: " + key.length); securityToken.setKey(key); } } } } else if (WSConstants.LIFETIME_QNAME.equals(qname)) { LOG.debug("trust:Lifetime"); LifetimeType lifetime = (LifetimeType) jaxbElement.getValue(); String createdValue = lifetime.getCreated().getValue(); DateTimeFormatter dateTimeFormatter = ISODateTimeFormat.dateTimeParser(); DateTime created = dateTimeFormatter.parseDateTime(createdValue); securityToken.setCreated(created.toDate()); String expiresString = lifetime.getExpires().getValue(); DateTime expires = dateTimeFormatter.parseDateTime(expiresString); securityToken.setExpires(expires.toDate()); } else if (WSConstants.REQUESTED_ATTACHED_REFERENCE_QNAME.equals(qname)) { RequestedReferenceType requestedReference = (RequestedReferenceType) jaxbElement.getValue(); SecurityTokenReferenceType securityTokenReference = requestedReference .getSecurityTokenReference(); List<Object> securityTokenReferenceContent = securityTokenReference.getAny(); for (Object securityTokenReferenceObject : securityTokenReferenceContent) { LOG.debug("SecurityTokenReference object: " + securityTokenReferenceObject.getClass().getName()); if (securityTokenReferenceObject instanceof JAXBElement) { JAXBElement securityTokenReferenceElement = (JAXBElement) securityTokenReferenceObject; LOG.debug("SecurityTokenReference element: " + securityTokenReferenceElement.getName()); if (WSConstants.REFERENCE_QNAME.equals(securityTokenReferenceElement.getName())) { ReferenceType reference = (ReferenceType) securityTokenReferenceElement.getValue(); String tokenIdentifier = reference.getURI().substring(1); securityToken.setAttachedReference(tokenIdentifier); } } } } else if (WSConstants.REQUESTED_UNATTACHED_REFERENCE_QNAME.equals(qname)) { RequestedReferenceType requestedReference = (RequestedReferenceType) jaxbElement.getValue(); SecurityTokenReferenceType securityTokenReference = requestedReference .getSecurityTokenReference(); List<Object> securityTokenReferenceContent = securityTokenReference.getAny(); for (Object securityTokenReferenceObject : securityTokenReferenceContent) { LOG.debug("SecurityTokenReference object: " + securityTokenReferenceObject.getClass().getName()); if (securityTokenReferenceObject instanceof JAXBElement) { JAXBElement securityTokenReferenceElement = (JAXBElement) securityTokenReferenceObject; LOG.debug("SecurityTokenReference element: " + securityTokenReferenceElement.getName()); if (WSConstants.REFERENCE_QNAME.equals(securityTokenReferenceElement.getName())) { ReferenceType reference = (ReferenceType) securityTokenReferenceElement.getValue(); String tokenIdentifier = reference.getURI(); securityToken.setUnattachedReference(tokenIdentifier); } } } } } } Element requestedSecurityToken = this.wsTrustHandler.getRequestedSecurityToken(); securityToken.setToken(requestedSecurityToken); securityToken.setStsLocation(this.location); securityToken.setRealm(this.location); // what else? securityToken.setParentSecurityToken(rStsSecurityToken); return securityToken; }