public GetCurrentMessageResponse(Element xml) throws SoapFault { Element messageXML = XmlUtils.getFirstElement(xml); if (messageXML != null) _message = new SimpleNotificationMessage(messageXML); }
/** * * @param rmd * An XML document containing a root element named wsrmd:Definitions. * * @param name * The value of the <em>name</em> attribute for the desired * metadata descriptor. * * @return The metadata descriptor in the document that has the given name, * or null if the name is not found. * */ public static Element getMetadataDescriptor(Document rmd, String name) { Element root = XmlUtils.getFirstElement(rmd); // wsrmd:Definitions Element[] descriptors = XmlUtils.getElements(root, WsrmdConstants.DESCRIPTOR_QNAME); for (int n = 0; n < descriptors.length; ++n) { String nextAttr = descriptors[n].getAttribute(WsrmdConstants.NAME); if (nextAttr != null && nextAttr.equals(name)) return descriptors[n]; } return null; } }
public Element putResourcePropertyDocument(Element wsrpDoc) throws SoapFault { Element request = XmlUtils.createElement(XmlUtils.EMPTY_DOC, WsrpConstants.PUT_DOCUMENT_QNAME, wsrpDoc, false); Element response = invoke(WsrpConstants.PUT_RP_DOCUMENT_URI, request); return XmlUtils.getFirstElement(response); }
public Element getResourcePropertyDocument() throws SoapFault { Element request = XmlUtils.createElement(WsrpConstants.GET_DOCUMENT_QNAME); Element response = invoke(WsrpConstants.GET_RP_DOCUMENT_URI, request); return XmlUtils.getFirstElement(response); }
/** * * Gathers the target namespaces for each schema in the WSDL's * <em>types</em> section. * * @param wsdl * * @return The set of schema namespaces declared in the <em>types</em> * section. * */ public static Set getSchemaNamespaces(Document wsdl) { Element root = XmlUtils.getFirstElement(wsdl); Element types = XmlUtils.getElement(root, TYPES_QNAME); Element[] schemas = XmlUtils.getElements(types, XsdUtils.SCHEMA_QNAME); Set namespaces = new HashSet(); // // each schema should have a targetNamespace attribute // for (int n = 0; n < schemas.length; ++n) namespaces.add(schemas[n].getAttribute(XmlUtils.TARGET_NS)); return namespaces; }
root = XmlUtils.getFirstElement(wsdl);
Element root = XmlUtils.getFirstElement(xmlDoc); Resource resource = reloadResource(contextPath, root);
/** * * This is a convenience method that resolves all of the schema imports * referenced in a WSDL. It iterates over every schema in the WSDL's * <em>types</em> section and processes it via XsdUtils.addImports(). * * @return The given WSDL, now with the imported schemas added to its * <em>types</em> section. * */ public static Document addSchemaImports(Document wsdl, String wsdlPath, Environment environment, Set namespaces) { Element root = XmlUtils.getFirstElement(wsdl); Element types = XmlUtils.getElement(root, TYPES_QNAME); Element[] schemas = XmlUtils.getElements(types, XsdUtils.SCHEMA_QNAME); for (int n = 0; n < schemas.length; ++n) addSchemaImports(types, schemas[n], wsdlPath, environment, namespaces); return wsdl; }
private Element parseResponse( XMLStreamReader reader ) throws AxisFault { try { XmlObject parsedResult = XmlObject.Factory.parse( reader ); if ( parsedResult.getDomNode() instanceof Document ) { return XmlUtils.getFirstElement( parsedResult.getDomNode() ); } if ( parsedResult.getDomNode() instanceof Element ) { return (Element) parsedResult.getDomNode(); } String message = "Response document is not of type document or element or null."; throw new AxisFault( message ); } catch ( Exception e ) { String message = "Error in deserializing the Axis response."; throw new AxisFault( message, e ); } }
/** * * This is a convenience method that resolves all of the schema includes * referenced in a WSDL. It iterates over every schema in the WSDL's * <em>types</em> section and processes it via XsdUtils.addIncludes(). * * @return The given WSDL, now with the included schemas added to its * <em>types</em> section. * */ public static Document addSchemaIncludes(Document wsdl, String wsdlPath, Environment environment, Set namespaces) { Element root = XmlUtils.getFirstElement(wsdl); Element types = XmlUtils.getElement(root, TYPES_QNAME); Element[] schemas = XmlUtils.getElements(types, XsdUtils.SCHEMA_QNAME); for (int n = 0; n < schemas.length; ++n) addSchemaIncludes(schemas[n], schemas[n], wsdlPath, environment, namespaces); return wsdl; }
Element root = XmlUtils.getFirstElement(wsdl); Element[] imports = XmlUtils.getElements(root, IMPORT_QNAME);
public Element[] getMetadata(String dialect) throws SoapFault { GetMetadataRequest get = new GetMetadataRequest(dialect); Element response = invoke(WsxConstants.GET_METADATA_URI, get.toXML()); // // each child element is a MetadataSection - we want to dig down // one level deeper and get the actual content for the user // Element[] sections = XmlUtils.getAllElements(response); Element[] metadata = new Element[sections.length]; for (int n = 0; n < sections.length; ++n) metadata[n] = XmlUtils.getFirstElement(sections[n]); return metadata; }
public void load(Document xml, Environment environment) throws SoapFault Element root = XmlUtils.getFirstElement(xml); QName rootName = XmlUtils.getElementQName(root);
Element child = XmlUtils.getFirstElement(xml); Class returnType = getReturnType();
/** * {@inheritDoc} */ public AgreementStateType getState() throws ResourceUnavailableException { try { Element body = XmlUtils.createElement( WsagConstants.WSRF_GET_RESOURCE_PROPERTY_QNAME, "wsag:AgreementState" ); body.setAttribute( WsagConstants.WSAG_PREFIX_DECLARATION, WsagConstants.NAMESPACE_URI ); Element response = client.invoke( WsagConstants.WSRF_GET_RESOURCE_PROPERTY_ACTION, body ); AgreementStateDocument respDoc = (AgreementStateDocument) XmlObject.Factory.parse( XmlUtils.getFirstElement( response ) ); return respDoc.getAgreementState(); } catch ( SoapFault e ) { throw new ResourceUnavailableException( e ); } catch ( XmlException e ) { throw new ResourceUnavailableException( e ); } }
protected Element getWSDL() { Resource owner = getResource(); Environment env = owner.getEnvironment(); String path = owner.getWsdlPath(); Document wsdlDoc = WsdlUtils.createWSDL(env, path, true); Element wsdl = XmlUtils.getFirstElement(wsdlDoc); WsdlUtils.removeWsdlReferences(wsdl); WsdlUtils.removeSchemaReferences(wsdl); return wsdl; }
Element categoryTypeXML = XmlUtils.getFirstElement(categoryXML);
/** * {@inheritDoc} */ public AgreementContextType getContext() throws ResourceUnavailableException { try { Element body = XmlUtils.createElement( WsagConstants.WSRF_GET_RESOURCE_PROPERTY_QNAME, "wsag:Context" ); body.setAttribute( WsagConstants.WSAG_PREFIX_DECLARATION, WsagConstants.NAMESPACE_URI ); Element response = client.invoke( WsagConstants.WSRF_GET_RESOURCE_PROPERTY_ACTION, body ); AgreementContextType respDoc = AgreementContextType.Factory.parse( XmlUtils.getFirstElement( response ), new XmlOptions().setLoadReplaceDocumentElement( null ) ); return respDoc; } catch ( SoapFault e ) { throw new ResourceUnavailableException( e ); } catch ( XmlException e ) { throw new ResourceUnavailableException( e ); } }
/** * {@inheritDoc} */ public TermTreeType getTerms() throws ResourceUnavailableException { try { Element body = XmlUtils.createElement( WsagConstants.WSRF_GET_RESOURCE_PROPERTY_QNAME, "wsag:Terms" ); body.setAttribute( WsagConstants.WSAG_PREFIX_DECLARATION, WsagConstants.NAMESPACE_URI ); Element response = client.invoke( WsagConstants.WSRF_GET_RESOURCE_PROPERTY_ACTION, body ); TermTreeType respDoc = TermTreeType.Factory.parse( XmlUtils.getFirstElement( response ), new XmlOptions().setLoadReplaceDocumentElement( null ) ); return respDoc; } catch ( SoapFault e ) { throw new ResourceUnavailableException( e ); } catch ( XmlException e ) { throw new ResourceUnavailableException( e ); } }
protected void subscribeInitialConsumer() throws SoapFault { String fileName = getInitializationParameter(_CONSUMER_EPR_PARAM); // // pre-existing consumer is optional - other consumers can // still subscribe using WS-N // if (fileName != null) { Environment env = getResource().getEnvironment(); Document eprDoc = env.getDocument(fileName); Element eprXML = XmlUtils.getFirstElement(eprDoc); EndpointReference epr = new EndpointReference(eprXML); NotificationProducer wsn = (NotificationProducer)getResource().getCapability(WsnConstants.PRODUCER_URI); wsn.subscribe(epr, new TopicFilter(MuwsConstants.ADV_ME_CREATION_TOPIC), null, null); wsn.subscribe(epr, new TopicFilter(MuwsConstants.ADV_ME_DESTRUCTION_TOPIC), null, null); } } }