List of usage examples for javax.xml.stream XMLStreamWriter writeEndElement
public void writeEndElement() throws XMLStreamException;
From source file:nl.nn.adapterframework.soap.Wsdl.java
protected void portType(XMLStreamWriter w) throws XMLStreamException, IOException { w.writeStartElement(WSDL_NAMESPACE, "portType"); w.writeAttribute("name", "PortType_" + getName()); {//from www . j a v a2 s . co m for (IListener listener : WsdlUtils.getListeners(pipeLine.getAdapter())) { if (listener instanceof WebServiceListener || listener instanceof JmsListener) { w.writeStartElement(WSDL_NAMESPACE, "operation"); w.writeAttribute("name", "Operation_" + WsdlUtils.getNCName(getSoapAction(listener))); { if (StringUtils.isNotEmpty(inputRoot)) { w.writeEmptyElement(WSDL_NAMESPACE, "input"); w.writeAttribute("message", getTargetNamespacePrefix() + ":" + "Message_" + inputRoot); } if (StringUtils.isNotEmpty(outputRoot)) { w.writeEmptyElement(WSDL_NAMESPACE, "output"); w.writeAttribute("message", getTargetNamespacePrefix() + ":" + "Message_" + outputRoot); } } w.writeEndElement(); } } } w.writeEndElement(); }
From source file:nl.nn.adapterframework.soap.Wsdl.java
protected void httpBinding(XMLStreamWriter w, String namePrefix) throws XMLStreamException, IOException, ConfigurationException { w.writeStartElement(WSDL_NAMESPACE, "binding"); w.writeAttribute("name", namePrefix + "Binding_" + WsdlUtils.getNCName(getName())); w.writeAttribute("type", getTargetNamespacePrefix() + ":" + "PortType_" + getName()); {//from w w w.java 2s. co m w.writeEmptyElement(soapNamespace, "binding"); w.writeAttribute("transport", SOAP_HTTP_NAMESPACE); w.writeAttribute("style", "document"); for (IListener listener : WsdlUtils.getListeners(pipeLine.getAdapter())) { if (listener instanceof WebServiceListener) { writeSoapOperation(w, listener); } } } w.writeEndElement(); }
From source file:nl.nn.adapterframework.soap.Wsdl.java
protected void writeSoapOperation(XMLStreamWriter w, IListener listener) throws XMLStreamException, IOException, ConfigurationException { w.writeStartElement(WSDL_NAMESPACE, "operation"); w.writeAttribute("name", "Operation_" + WsdlUtils.getNCName(getSoapAction(listener))); {/* w w w. j a v a 2s . c o m*/ w.writeEmptyElement(soapNamespace, "operation"); w.writeAttribute("style", "document"); w.writeAttribute("soapAction", getSoapAction(listener)); w.writeStartElement(WSDL_NAMESPACE, "input"); { writeSoapHeader(w, inputRoot, inputHeaderElement, inputHeaderIsOptional); writeSoapBody(w, inputBodyElement); } w.writeEndElement(); if (outputValidator != null) { w.writeStartElement(WSDL_NAMESPACE, "output"); { writeSoapHeader(w, outputRoot, outputHeaderElement, outputHeaderIsOptional); writeSoapBody(w, outputBodyElement); } w.writeEndElement(); } } w.writeEndElement(); }
From source file:nl.nn.adapterframework.soap.Wsdl.java
protected void jmsBinding(XMLStreamWriter w, String namePrefix) throws XMLStreamException, IOException, ConfigurationException { w.writeStartElement(WSDL_NAMESPACE, "binding"); w.writeAttribute("name", namePrefix + "Binding_" + WsdlUtils.getNCName(getName())); w.writeAttribute("type", getTargetNamespacePrefix() + ":" + "PortType_" + getName()); {//from ww w.j av a2 s .co m w.writeEmptyElement(soapNamespace, "binding"); w.writeAttribute("style", "document"); if (esbSoap) { w.writeAttribute("transport", ESB_SOAP_JMS_NAMESPACE); w.writeEmptyElement(ESB_SOAP_JMS_NAMESPACE, "binding"); w.writeAttribute("messageFormat", "Text"); for (IListener listener : WsdlUtils.getListeners(pipeLine.getAdapter())) { if (listener instanceof JmsListener) { writeSoapOperation(w, listener); } } } else { w.writeAttribute("transport", SOAP_JMS_NAMESPACE); } } w.writeEndElement(); }
From source file:nl.nn.adapterframework.soap.Wsdl.java
protected void httpService(XMLStreamWriter w, String servlet, String namePrefix) throws XMLStreamException { w.writeStartElement(WSDL_NAMESPACE, "service"); w.writeAttribute("name", "Service_" + WsdlUtils.getNCName(getName())); {//w ww . j av a 2 s . c o m w.writeStartElement(WSDL_NAMESPACE, "port"); w.writeAttribute("name", namePrefix + "Port_" + WsdlUtils.getNCName(getName())); w.writeAttribute("binding", getTargetNamespacePrefix() + ":" + namePrefix + "Binding_" + WsdlUtils.getNCName(getName())); { w.writeEmptyElement(soapNamespace, "address"); w.writeAttribute("location", getLocation(servlet)); } w.writeEndElement(); } w.writeEndElement(); }
From source file:nl.nn.adapterframework.soap.Wsdl.java
protected void jmsService(XMLStreamWriter w, JmsListener listener, String namePrefix) throws XMLStreamException, NamingException { w.writeStartElement(WSDL_NAMESPACE, "service"); w.writeAttribute("name", "Service_" + WsdlUtils.getNCName(getName())); {//from ww w.j a v a 2 s . c o m if (!esbSoap) { // Per example of https://docs.jboss.org/author/display/JBWS/SOAP+over+JMS w.writeStartElement(SOAP_JMS_NAMESPACE, "jndiConnectionFactoryName"); w.writeCharacters(listener.getQueueConnectionFactoryName()); } w.writeStartElement(WSDL_NAMESPACE, "port"); w.writeAttribute("name", namePrefix + "Port_" + WsdlUtils.getNCName(getName())); w.writeAttribute("binding", getTargetNamespacePrefix() + ":" + namePrefix + "Binding_" + WsdlUtils.getNCName(getName())); { w.writeEmptyElement(soapNamespace, "address"); String destinationName = listener.getDestinationName(); if (destinationName != null) { w.writeAttribute("location", getLocation(destinationName)); } if (esbSoap) { writeEsbSoapJndiContext(w, listener); w.writeStartElement(ESB_SOAP_JMS_NAMESPACE, "connectionFactory"); { w.writeCharacters("externalJndiName-for-" + listener.getQueueConnectionFactoryName() + "-on-" + AppConstants.getInstance().getResolvedProperty("otap.stage")); w.writeEndElement(); } w.writeStartElement(ESB_SOAP_JMS_NAMESPACE, "targetAddress"); { w.writeAttribute("destination", listener.getDestinationType().toLowerCase()); String queueName = listener.getPhysicalDestinationShortName(); if (queueName == null) { queueName = "queueName-for-" + listener.getDestinationName() + "-on-" + AppConstants.getInstance().getResolvedProperty("otap.stage"); } w.writeCharacters(queueName); w.writeEndElement(); } } } w.writeEndElement(); } w.writeEndElement(); }
From source file:nl.nn.adapterframework.soap.Wsdl.java
protected void writeEsbSoapJndiContext(XMLStreamWriter w, JmsListener listener) throws XMLStreamException, NamingException { w.writeStartElement(ESB_SOAP_JNDI_NAMESPACE, "context"); {//ww w. j a v a 2 s . c o m w.writeStartElement(ESB_SOAP_JNDI_NAMESPACE, "property"); { w.writeAttribute("name", "java.naming.factory.initial"); w.writeAttribute("type", "java.lang.String"); w.writeCharacters("com.tibco.tibjms.naming.TibjmsInitialContextFactory"); w.writeEndElement(); } w.writeStartElement(ESB_SOAP_JNDI_NAMESPACE, "property"); { w.writeAttribute("name", "java.naming.provider.url"); w.writeAttribute("type", "java.lang.String"); String qcf = listener.getQueueConnectionFactoryName(); if (StringUtils.isEmpty(qcf)) { warn("Attribute queueConnectionFactoryName empty for listener '" + listener.getName() + "'"); } else { try { qcf = URLEncoder.encode(qcf, "UTF-8"); } catch (UnsupportedEncodingException e) { warn("Could not encode queueConnectionFactoryName for listener '" + listener.getName() + "'"); } } String stage = AppConstants.getInstance().getResolvedProperty("otap.stage"); if (StringUtils.isEmpty(stage)) { warn("Property otap.stage empty"); } else { try { stage = URLEncoder.encode(stage, "UTF-8"); } catch (UnsupportedEncodingException e) { warn("Could not encode property otap.stage"); } } w.writeCharacters("tibjmsnaming://host-for-" + qcf + "-on-" + stage + ":37222"); w.writeEndElement(); } w.writeStartElement(ESB_SOAP_JNDI_NAMESPACE, "property"); { w.writeAttribute("name", "java.naming.factory.object"); w.writeAttribute("type", "java.lang.String"); w.writeCharacters("com.tibco.tibjms.custom.CustomObjectFactory"); w.writeEndElement(); } } w.writeEndElement(); }
From source file:nz.co.jsrsolutions.ds3.test.RetrieveTestData.java
public static void main(String[] args) { logger.info("Starting application [ rtd ] ..."); try {/*from w w w .j av a 2 s . c o m*/ config.addConfiguration( new XMLConfiguration(RetrieveTestData.class.getClassLoader().getResource(CONFIG_FILENAME))); HierarchicalConfiguration appConfig = config.configurationAt(APPLICATION_CONFIG_ROOT); EodDataProvider eodDataProvider = null; OutputStream out = new FileOutputStream(OUTPUT_FILENAME); XMLOutputFactory factory = XMLOutputFactory.newInstance(); XMLStreamWriter writer = factory.createXMLStreamWriter(out); eodDataProvider = EodDataProviderFactory.create(appConfig, EODDATA_PROVIDER_NAME); writer.writeStartDocument("utf-8", "1.0"); writer.writeCharacters(NEWLINE); writer.writeComment("Test data for running DataScraper unit tests against"); writer.writeCharacters(NEWLINE); writer.setPrefix(XML_PREFIX, XML_NAMESPACE_URI); writer.writeStartElement(XML_NAMESPACE_URI, TESTDATA_LOCALNAME); writer.writeNamespace(XML_PREFIX, XML_NAMESPACE_URI); writer.writeCharacters(NEWLINE); serializeExchanges(eodDataProvider, writer); serializeSymbols(eodDataProvider, writer); serializeQuotes(eodDataProvider, writer); writer.writeEndElement(); writer.writeCharacters(NEWLINE); writer.writeEndDocument(); writer.flush(); writer.close(); } catch (ConfigurationException ce) { logger.error(ce.toString()); ce.printStackTrace(); } catch (Exception e) { logger.error(e.toString()); logger.error(e); } logger.info("Exiting application [ rtd ] ..."); }
From source file:nz.co.jsrsolutions.ds3.test.RetrieveTestData.java
private static void serializeExchanges(EodDataProvider eodDataProvider, XMLStreamWriter writer) { try {//from www . jav a2s .co m writer.writeStartElement(XML_NAMESPACE_URI, EXCHANGES_LOCALNAME); writer.writeCharacters(NEWLINE); serialize(eodDataProvider.getExchanges(), EXCHANGE_QNAME, writer); writer.writeEndElement(); writer.writeCharacters(NEWLINE); } catch (XMLStreamException xse) { logger.error(xse.toString()); logger.error(xse); } catch (EodDataProviderException edpe) { logger.error(edpe.toString()); logger.error(edpe); } finally { if (eodDataProvider != null) { // eodDataProvider.close(); } } }
From source file:nz.co.jsrsolutions.ds3.test.RetrieveTestData.java
private static void serializeSymbols(EodDataProvider eodDataProvider, XMLStreamWriter writer) { try {// w ww. j a v a 2 s . c om writer.writeStartElement(XML_NAMESPACE_URI, SYMBOLS_LOCALNAME); writer.writeAttribute(XML_NAMESPACE_URI, TESTEXCHANGE_ATTRNAME, TEST_EXCHANGE); writer.writeCharacters(NEWLINE); serialize(eodDataProvider.getSymbols(TEST_EXCHANGE), SYMBOL_QNAME, writer); writer.writeEndElement(); writer.writeCharacters(NEWLINE); } catch (XMLStreamException xse) { logger.error(xse.toString()); logger.error(xse); } catch (EodDataProviderException edpe) { logger.error(edpe.toString()); logger.error(edpe); } finally { if (eodDataProvider != null) { // eodDataProvider.close(); } } }