Example usage for javax.xml.stream XMLStreamWriter writeEmptyElement

List of usage examples for javax.xml.stream XMLStreamWriter writeEmptyElement

Introduction

In this page you can find the example usage for javax.xml.stream XMLStreamWriter writeEmptyElement.

Prototype

public void writeEmptyElement(String namespaceURI, String localName) throws XMLStreamException;

Source Link

Document

Writes an empty element tag to the output

Usage

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  ww w. j  ava  2s . c  o 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());
    {/*w  w  w  .j av a2s .  c om*/
        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)));
    {//from ww w. j  av  a 2s . com
        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 writeSoapHeader(XMLStreamWriter w, String root, QName headerElement, boolean isHeaderOptional)
        throws XMLStreamException, IOException {
    if (headerElement != null) {
        w.writeEmptyElement(soapNamespace, "header");
        w.writeAttribute("part", "Part_" + headerElement.getLocalPart());
        w.writeAttribute("use", "literal");
        w.writeAttribute("message", getTargetNamespacePrefix() + ":" + "Message_" + root
                + (isHeaderOptional ? "_" + headerElement.getLocalPart() : ""));
    }//from w w w .ja v a 2  s. c om
}

From source file:nl.nn.adapterframework.soap.Wsdl.java

protected void writeSoapBody(XMLStreamWriter w, QName bodyElement) throws XMLStreamException, IOException {
    if (bodyElement != null) {
        w.writeEmptyElement(soapNamespace, "body");
        w.writeAttribute("parts", "Part_" + bodyElement.getLocalPart());
        w.writeAttribute("use", "literal");
    }//from  ww  w  .  j  a  v  a  2  s. c  om
}

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   w w w  .  j  a  v  a 2  s.  c  o  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()));
    {//  ww  w. j a v a 2 s  . co  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 w  ww  .j a v a2 s  .  co 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:org.apache.flex.compiler.config.Configuration.java

/**
 * Write information about the compiler that compiled the swf.
 * /*from ww  w  . j a v  a  2 s  .co  m*/
 * @param writer
 * @throws XMLStreamException
 */
private void writeCompiledBy(XMLStreamWriter writer) throws XMLStreamException {
    writer.writeEmptyElement(VersionInfo.COMPILER_NAMESPACE_URI, VersionInfo.COMPILER_ELEMENT);
    writer.writeAttribute(VersionInfo.COMPILER_NAME_ATTRIBUTE, VersionInfo.getCompilerName());
    writer.writeAttribute(VersionInfo.COMPILER_VERSION_ATTRIBUTE, VersionInfo.getCompilerVersion());
    writer.writeAttribute(VersionInfo.COMPILER_BUILD_ATTRIBUTE, VersionInfo.getCompilerBuild());

    writer.writeEndElement(); // compiledBy
}