OMFactory omFactory = OMAbstractFactory.getOMFactory(); OMElement omSecurityElement = omFactory.createOMElement(new QName( "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", "Security", "wsse"), null); OMElement omusertoken = omFactory.createOMElement(new QName("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd", "UsernameToken", "wsu"), null); OMElement omuserName = omFactory.createOMElement(new QName("", "Username", "wsse"), null); omuserName.setText("myusername"); OMElement omPassword = omFactory.createOMElement(new QName("", "Password", "wsse"), null); omPassword.addAttribute("Type","http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText",null ); omPassword.setText("mypassword"); omusertoken.addChild(omuserName); omusertoken.addChild(omPassword); omSecurityElement.addChild(omusertoken); stub._getServiceClient().addHeader(omSecurityElement);
public Token(String id, OMElement tokenElem, Date created, Date expires) throws TrustException { this.id = id; OMMetaFactory metaFactory = OMAbstractFactory.getMetaFactory(OMAbstractFactory.FEATURE_DOM); OMXMLStreamReaderConfiguration configuration = new OMXMLStreamReaderConfiguration(); configuration.setNamespaceURIInterning(true); this.token = OMXMLBuilderFactory.createStAXOMBuilder(metaFactory.getOMFactory(), tokenElem.getXMLStreamReader(true, configuration)).getDocumentElement(); this.created = created; this.expires = expires; }
/** * @param attachedReference The attachedReference to set. */ public void setAttachedReference(OMElement attachedReference) { if (attachedReference != null) { OMMetaFactory metaFactory = OMAbstractFactory.getMetaFactory(OMAbstractFactory.FEATURE_DOM); this.attachedReference = OMXMLBuilderFactory.createStAXOMBuilder(metaFactory.getOMFactory(), attachedReference.getXMLStreamReader()).getDocumentElement(); } }
private static OMElement getPingOMBlock(String text) { OMFactory fac = OMAbstractFactory.getOMFactory(); OMNamespace namespace = fac.createOMNamespace(applicationNamespaceName,"ns1"); OMElement pingElem = fac.createOMElement(ping, namespace); OMElement textElem = fac.createOMElement(Text, namespace); textElem.setText(text); pingElem.addChild(textElem); return pingElem; }
@Override public Object wrap(OMElement template, OMElement os) { OMElement wrapper; if (os != null) { OMNamespace ns = os.declareNamespace(template.getNamespace().getNamespaceURI(), ""); wrapper = factory.createOMElement(template.getLocalName(), ns); wrapper.addChild(os); } else { wrapper = template.cloneOMElement(); } return wrapper; }
private OMElement createElement() { OMFactory factory = OMAbstractFactory.getOMFactory(); OMText textNode = factory.createOMText(genericContent, true); OMElement wrapperElement = factory.createOMElement(unknownContentQName); wrapperElement.addChild(textNode); return wrapperElement; } }
protected void setMustUnderstand(OMElement headerElement, OMNamespace omNamespace) { OMFactory omFactory = OMAbstractFactory.getOMFactory(); OMAttribute mustUnderstandAttribute = omFactory.createOMAttribute(SOAP12Constants.ATTR_MUSTUNDERSTAND, omNamespace, "true"); headerElement.addAttribute(mustUnderstandAttribute); }
public OMElement convert(XMLStreamReader s) { return OMXMLBuilderFactory .createStAXOMBuilder(OMAbstractFactory.getOMFactory(), s) .getDocumentElement(); }
String getNamespaceURI(String prefix) { if (currentEvent == START_ELEMENT || currentEvent == END_ELEMENT) { if (node instanceof OMElement) { OMNamespace namespaceURI = ((OMElement) node).findNamespaceURI(prefix); return namespaceURI != null ? namespaceURI.getNamespaceURI() : null; } } return null; }
protected String getAttribute(OMElement elt, QName qName) { OMAttribute a = elt.getAttribute(qName); if (a != null) { return a.getAttributeValue(); } return null; }
/** * Create an object model builder for SOAP that reads a message from the provided {@link Source}. * The method will select the appropriate {@link SOAPFactory} based on the namespace URI of * the SOAP envelope. * * @param source * the source of the SOAP message * @return the builder */ public static SOAPModelBuilder createSOAPModelBuilder(Source source) { return createSOAPModelBuilder(OMAbstractFactory.getMetaFactory(), source); }
/** * Get the default OM factory instance. This method has the same effect as calling * {@link OMMetaFactory#getOMFactory()} on the {@link OMMetaFactory} instance returned by * {@link #getMetaFactory()}. * * @return the default OM factory instance * @throws OMException if the factory's implementation class can't be found * or if the class can't be instantiated */ public static OMFactory getOMFactory() { return getMetaFactory().getOMFactory(); }
/** * Get the default SOAP 1.1 OM factory instance. This method has the same effect as calling * {@link OMMetaFactory#getSOAP11Factory()} on the {@link OMMetaFactory} instance returned by * {@link #getMetaFactory()}. * * @return the default SOAP 1.1 OM factory instance * @throws OMException if the factory's implementation class can't be found * or if the class can't be instantiated */ public static SOAPFactory getSOAP11Factory() { return getMetaFactory().getSOAP11Factory(); }
private static OMElement getPingOMBlock(String text) { OMFactory fac = OMAbstractFactory.getOMFactory(); OMNamespace namespace = fac.createOMNamespace(applicationNamespaceName,"ns1"); OMElement pingElem = fac.createOMElement(ping, namespace); OMElement textElem = fac.createOMElement(Text, namespace); textElem.setText(text); pingElem.addChild(textElem); return pingElem; }
/** * @param presivousToken The presivousToken to set. */ public void setPreviousToken(OMElement presivousToken) { OMMetaFactory metaFactory = OMAbstractFactory.getMetaFactory(OMAbstractFactory.FEATURE_DOM); this.previousToken = OMXMLBuilderFactory.createStAXOMBuilder(metaFactory.getOMFactory(), presivousToken.getXMLStreamReader()).getDocumentElement(); }
public Token(String id, OMElement tokenElem, OMElement lifetimeElem) throws TrustException { this.id = id; OMMetaFactory metaFactory = OMAbstractFactory.getMetaFactory(OMAbstractFactory.FEATURE_DOM); OMXMLStreamReaderConfiguration configuration = new OMXMLStreamReaderConfiguration(); configuration.setNamespaceURIInterning(true); this.token = OMXMLBuilderFactory.createStAXOMBuilder(metaFactory.getOMFactory(), tokenElem.getXMLStreamReader(true, configuration)).getDocumentElement(); this.processLifeTime(lifetimeElem); }
public OMElement toOM() throws RMMessageBuildingException { OMFactory omFactory = OMAbstractFactory.getOMFactory(); OMElement offerElement = omFactory.createOMElement( MercuryConstants.OFFER, this.rmNamespace, MercuryConstants.RM_1_0_NAMESPACE_PREFIX); OMElement identiferElement = omFactory.createOMElement( MercuryConstants.IDENTIFIER,this.rmNamespace,MercuryConstants.RM_1_0_NAMESPACE_PREFIX); identiferElement.setText(identifer); offerElement.addChild(identiferElement); return offerElement; }
/** * @param unattachedReference The unattachedReference to set. */ public void setUnattachedReference(OMElement unattachedReference) { if (unattachedReference != null) { OMMetaFactory metaFactory = OMAbstractFactory.getMetaFactory(OMAbstractFactory.FEATURE_DOM); this.unattachedReference = OMXMLBuilderFactory.createStAXOMBuilder(metaFactory.getOMFactory(), unattachedReference.getXMLStreamReader()).getDocumentElement(); } }
private static OMElement getPingOMBlock(String text) { OMFactory fac = OMAbstractFactory.getOMFactory(); OMNamespace namespace = fac.createOMNamespace(applicationNamespaceName,"ns1"); OMElement pingElem = fac.createOMElement(ping, namespace); OMElement textElem = fac.createOMElement(Text, namespace); textElem.setText(text); pingElem.addChild(textElem); return pingElem; } }
public Element convert(OMElement s) { try { return (Element) OMXMLBuilderFactory.createStAXOMBuilder( OMAbstractFactory.getMetaFactory(OMAbstractFactory.FEATURE_DOM).getOMFactory(), s.getXMLStreamReader()).getDocumentElement(); } catch (OMException err) { // likely no DOOM return new StaxToDOMConverter().convert(s.getXMLStreamReader()); } }