Java Code Examples for com.sun.xml.internal.ws.util.DOMUtil#serializeNode()

The following examples show how to use com.sun.xml.internal.ws.util.DOMUtil#serializeNode() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SAAJMessage.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void writePayloadTo(XMLStreamWriter sw) throws XMLStreamException {
    access();
    try {
        for (Element part : bodyParts)
            DOMUtil.serializeNode(part, sw);
    } catch (XMLStreamException e) {
        throw new WebServiceException(e);
    }
}
 
Example 2
Source File: SAAJMessage.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void writePayloadTo(XMLStreamWriter sw) throws XMLStreamException {
    access();
    try {
        for (Element part : bodyParts)
            DOMUtil.serializeNode(part, sw);
    } catch (XMLStreamException e) {
        throw new WebServiceException(e);
    }
}
 
Example 3
Source File: SAAJMessage.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void writeTo(XMLStreamWriter writer) throws XMLStreamException {
    try {
        writer.writeStartDocument();
        if (!parsedMessage) {
            DOMUtil.serializeNode(sm.getSOAPPart().getEnvelope(), writer);
        } else {
            SOAPEnvelope env = sm.getSOAPPart().getEnvelope();
            DOMUtil.writeTagWithAttributes(env, writer);
            if (hasHeaders()) {
                if(env.getHeader() != null) {
                    DOMUtil.writeTagWithAttributes(env.getHeader(), writer);
                } else {
                    writer.writeStartElement(env.getPrefix(), "Header", env.getNamespaceURI());
                }
                for (Header h : headers.asList()) {
                    h.writeTo(writer);
                }
                writer.writeEndElement();
            }

            DOMUtil.serializeNode(sm.getSOAPBody(), writer);
            writer.writeEndElement();
        }
        writer.writeEndDocument();
        writer.flush();
    } catch (SOAPException ex) {
        throw new XMLStreamException2(ex);
        //for now. ask jaxws team what to do.
    }
}
 
Example 4
Source File: SAAJMessage.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void writePayloadTo(XMLStreamWriter sw) throws XMLStreamException {
    access();
    try {
        for (Element part : bodyParts)
            DOMUtil.serializeNode(part, sw);
    } catch (XMLStreamException e) {
        throw new WebServiceException(e);
    }
}
 
Example 5
Source File: DOMMessage.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void writePayloadTo(XMLStreamWriter sw) {
    try {
        if (payload != null)
            DOMUtil.serializeNode(payload, sw);
    } catch (XMLStreamException e) {
        throw new WebServiceException(e);
    }
}
 
Example 6
Source File: SAAJMessage.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void writeTo(XMLStreamWriter writer) throws XMLStreamException {
    try {
        writer.writeStartDocument();
        if (!parsedMessage) {
            DOMUtil.serializeNode(sm.getSOAPPart().getEnvelope(), writer);
        } else {
            SOAPEnvelope env = sm.getSOAPPart().getEnvelope();
            DOMUtil.writeTagWithAttributes(env, writer);
            if (hasHeaders()) {
                if(env.getHeader() != null) {
                    DOMUtil.writeTagWithAttributes(env.getHeader(), writer);
                } else {
                    writer.writeStartElement(env.getPrefix(), "Header", env.getNamespaceURI());
                }
                for (Header h : headers.asList()) {
                    h.writeTo(writer);
                }
                writer.writeEndElement();
            }

            DOMUtil.serializeNode(sm.getSOAPBody(), writer);
            writer.writeEndElement();
        }
        writer.writeEndDocument();
        writer.flush();
    } catch (SOAPException ex) {
        throw new XMLStreamException2(ex);
        //for now. ask jaxws team what to do.
    }
}
 
Example 7
Source File: DOMMessage.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void writePayloadTo(XMLStreamWriter sw) {
    try {
        if (payload != null)
            DOMUtil.serializeNode(payload, sw);
    } catch (XMLStreamException e) {
        throw new WebServiceException(e);
    }
}
 
Example 8
Source File: SAAJMessage.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void writeTo(XMLStreamWriter writer) throws XMLStreamException {
    try {
        writer.writeStartDocument();
        if (!parsedMessage) {
            DOMUtil.serializeNode(sm.getSOAPPart().getEnvelope(), writer);
        } else {
            SOAPEnvelope env = sm.getSOAPPart().getEnvelope();
            DOMUtil.writeTagWithAttributes(env, writer);
            if (hasHeaders()) {
                if(env.getHeader() != null) {
                    DOMUtil.writeTagWithAttributes(env.getHeader(), writer);
                } else {
                    writer.writeStartElement(env.getPrefix(), "Header", env.getNamespaceURI());
                }
                for (Header h : headers.asList()) {
                    h.writeTo(writer);
                }
                writer.writeEndElement();
            }

            DOMUtil.serializeNode(sm.getSOAPBody(), writer);
            writer.writeEndElement();
        }
        writer.writeEndDocument();
        writer.flush();
    } catch (SOAPException ex) {
        throw new XMLStreamException2(ex);
        //for now. ask jaxws team what to do.
    }
}
 
Example 9
Source File: SAAJMessage.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void writePayloadTo(XMLStreamWriter sw) throws XMLStreamException {
    access();
    try {
        for (Element part : bodyParts)
            DOMUtil.serializeNode(part, sw);
    } catch (XMLStreamException e) {
        throw new WebServiceException(e);
    }
}
 
Example 10
Source File: DOMMessage.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void writePayloadTo(XMLStreamWriter sw) {
    try {
        if (payload != null)
            DOMUtil.serializeNode(payload, sw);
    } catch (XMLStreamException e) {
        throw new WebServiceException(e);
    }
}
 
Example 11
Source File: DOMMessage.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void writePayloadTo(XMLStreamWriter sw) {
    try {
        if (payload != null)
            DOMUtil.serializeNode(payload, sw);
    } catch (XMLStreamException e) {
        throw new WebServiceException(e);
    }
}
 
Example 12
Source File: SAAJMessage.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void writePayloadTo(XMLStreamWriter sw) throws XMLStreamException {
    access();
    try {
        for (Element part : bodyParts)
            DOMUtil.serializeNode(part, sw);
    } catch (XMLStreamException e) {
        throw new WebServiceException(e);
    }
}
 
Example 13
Source File: SAAJMessage.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void writeTo(XMLStreamWriter writer) throws XMLStreamException {
    try {
        writer.writeStartDocument();
        if (!parsedMessage) {
            DOMUtil.serializeNode(sm.getSOAPPart().getEnvelope(), writer);
        } else {
            SOAPEnvelope env = sm.getSOAPPart().getEnvelope();
            DOMUtil.writeTagWithAttributes(env, writer);
            if (hasHeaders()) {
                if(env.getHeader() != null) {
                    DOMUtil.writeTagWithAttributes(env.getHeader(), writer);
                } else {
                    writer.writeStartElement(env.getPrefix(), "Header", env.getNamespaceURI());
                }
                for (Header h : headers.asList()) {
                    h.writeTo(writer);
                }
                writer.writeEndElement();
            }

            DOMUtil.serializeNode(sm.getSOAPBody(), writer);
            writer.writeEndElement();
        }
        writer.writeEndDocument();
        writer.flush();
    } catch (SOAPException ex) {
        throw new XMLStreamException2(ex);
        //for now. ask jaxws team what to do.
    }
}
 
Example 14
Source File: DOMMessage.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void writePayloadTo(XMLStreamWriter sw) {
    try {
        if (payload != null)
            DOMUtil.serializeNode(payload, sw);
    } catch (XMLStreamException e) {
        throw new WebServiceException(e);
    }
}
 
Example 15
Source File: WSEndpointReference.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
private static void writePartialEPRInfoset(StreamWriterBufferCreator writer, AddressingVersion version, String address, List<Element> referenceParameters, QName service, QName port, QName portType,
                                           List<Element> metadata, String wsdlAddress, String wsdlTargetNamespace, @Nullable Map<QName, String> attributes) throws XMLStreamException {
    //add extensibile attributes on the EPR element
    if (attributes != null) {
        for (Map.Entry<QName, String> entry : attributes.entrySet()) {
            QName qname = entry.getKey();
            writer.writeAttribute(qname.getPrefix(), qname.getNamespaceURI(), qname.getLocalPart(), entry.getValue());
        }
    }

    writer.writeStartElement(version.getPrefix(), version.eprType.address, version.nsUri);
    writer.writeCharacters(address);
    writer.writeEndElement();
    //When the size of ReferenceParametes is zero, the ReferenceParametes element will not be written.
    if(referenceParameters != null && referenceParameters.size() > 0) {
        writer.writeStartElement(version.getPrefix(), version.eprType.referenceParameters, version.nsUri);
        for (Element e : referenceParameters) {
            DOMUtil.serializeNode(e, writer);
        }
        writer.writeEndElement();
    }

    switch (version) {
        case W3C:
            writeW3CMetaData(writer, service, port, portType, metadata, wsdlAddress, wsdlTargetNamespace);
            break;

        case MEMBER:
            writeMSMetaData(writer, service, port, portType, metadata);
            if (wsdlAddress != null) {
                //Inline the wsdl as extensibility element
                //Write mex:Metadata wrapper
                writer.writeStartElement(MemberSubmissionAddressingConstants.MEX_METADATA.getPrefix(),
                        MemberSubmissionAddressingConstants.MEX_METADATA.getLocalPart(),
                        MemberSubmissionAddressingConstants.MEX_METADATA.getNamespaceURI());
                writer.writeStartElement(MemberSubmissionAddressingConstants.MEX_METADATA_SECTION.getPrefix(),
                        MemberSubmissionAddressingConstants.MEX_METADATA_SECTION.getLocalPart(),
                        MemberSubmissionAddressingConstants.MEX_METADATA_SECTION.getNamespaceURI());
                writer.writeAttribute(MemberSubmissionAddressingConstants.MEX_METADATA_DIALECT_ATTRIBUTE,
                        MemberSubmissionAddressingConstants.MEX_METADATA_DIALECT_VALUE);

                writeWsdl(writer, service, wsdlAddress);

                writer.writeEndElement();
                writer.writeEndElement();
            }

            break;
    }
}
 
Example 16
Source File: DOMHeader.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public void writeTo(XMLStreamWriter w) throws XMLStreamException {
    DOMUtil.serializeNode(node, w);
}
 
Example 17
Source File: DOMHeader.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public void writeTo(XMLStreamWriter w) throws XMLStreamException {
    DOMUtil.serializeNode(node, w);
}
 
Example 18
Source File: DOMHeader.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public void writeTo(XMLStreamWriter w) throws XMLStreamException {
    DOMUtil.serializeNode(node, w);
}
 
Example 19
Source File: WSEndpointReference.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private static void writePartialEPRInfoset(StreamWriterBufferCreator writer, AddressingVersion version, String address, List<Element> referenceParameters, QName service, QName port, QName portType,
                                           List<Element> metadata, String wsdlAddress, String wsdlTargetNamespace, @Nullable Map<QName, String> attributes) throws XMLStreamException {
    //add extensibile attributes on the EPR element
    if (attributes != null) {
        for (Map.Entry<QName, String> entry : attributes.entrySet()) {
            QName qname = entry.getKey();
            writer.writeAttribute(qname.getPrefix(), qname.getNamespaceURI(), qname.getLocalPart(), entry.getValue());
        }
    }

    writer.writeStartElement(version.getPrefix(), version.eprType.address, version.nsUri);
    writer.writeCharacters(address);
    writer.writeEndElement();
    //When the size of ReferenceParametes is zero, the ReferenceParametes element will not be written.
    if(referenceParameters != null && referenceParameters.size() > 0) {
        writer.writeStartElement(version.getPrefix(), version.eprType.referenceParameters, version.nsUri);
        for (Element e : referenceParameters) {
            DOMUtil.serializeNode(e, writer);
        }
        writer.writeEndElement();
    }

    switch (version) {
        case W3C:
            writeW3CMetaData(writer, service, port, portType, metadata, wsdlAddress, wsdlTargetNamespace);
            break;

        case MEMBER:
            writeMSMetaData(writer, service, port, portType, metadata);
            if (wsdlAddress != null) {
                //Inline the wsdl as extensibility element
                //Write mex:Metadata wrapper
                writer.writeStartElement(MemberSubmissionAddressingConstants.MEX_METADATA.getPrefix(),
                        MemberSubmissionAddressingConstants.MEX_METADATA.getLocalPart(),
                        MemberSubmissionAddressingConstants.MEX_METADATA.getNamespaceURI());
                writer.writeStartElement(MemberSubmissionAddressingConstants.MEX_METADATA_SECTION.getPrefix(),
                        MemberSubmissionAddressingConstants.MEX_METADATA_SECTION.getLocalPart(),
                        MemberSubmissionAddressingConstants.MEX_METADATA_SECTION.getNamespaceURI());
                writer.writeAttribute(MemberSubmissionAddressingConstants.MEX_METADATA_DIALECT_ATTRIBUTE,
                        MemberSubmissionAddressingConstants.MEX_METADATA_DIALECT_VALUE);

                writeWsdl(writer, service, wsdlAddress);

                writer.writeEndElement();
                writer.writeEndElement();
            }

            break;
    }
}
 
Example 20
Source File: WSEndpointReference.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
private static void writePartialEPRInfoset(StreamWriterBufferCreator writer, AddressingVersion version, String address, List<Element> referenceParameters, QName service, QName port, QName portType,
                                           List<Element> metadata, String wsdlAddress, String wsdlTargetNamespace, @Nullable Map<QName, String> attributes) throws XMLStreamException {
    //add extensibile attributes on the EPR element
    if (attributes != null) {
        for (Map.Entry<QName, String> entry : attributes.entrySet()) {
            QName qname = entry.getKey();
            writer.writeAttribute(qname.getPrefix(), qname.getNamespaceURI(), qname.getLocalPart(), entry.getValue());
        }
    }

    writer.writeStartElement(version.getPrefix(), version.eprType.address, version.nsUri);
    writer.writeCharacters(address);
    writer.writeEndElement();
    //When the size of ReferenceParametes is zero, the ReferenceParametes element will not be written.
    if(referenceParameters != null && referenceParameters.size() > 0) {
        writer.writeStartElement(version.getPrefix(), version.eprType.referenceParameters, version.nsUri);
        for (Element e : referenceParameters) {
            DOMUtil.serializeNode(e, writer);
        }
        writer.writeEndElement();
    }

    switch (version) {
        case W3C:
            writeW3CMetaData(writer, service, port, portType, metadata, wsdlAddress, wsdlTargetNamespace);
            break;

        case MEMBER:
            writeMSMetaData(writer, service, port, portType, metadata);
            if (wsdlAddress != null) {
                //Inline the wsdl as extensibility element
                //Write mex:Metadata wrapper
                writer.writeStartElement(MemberSubmissionAddressingConstants.MEX_METADATA.getPrefix(),
                        MemberSubmissionAddressingConstants.MEX_METADATA.getLocalPart(),
                        MemberSubmissionAddressingConstants.MEX_METADATA.getNamespaceURI());
                writer.writeStartElement(MemberSubmissionAddressingConstants.MEX_METADATA_SECTION.getPrefix(),
                        MemberSubmissionAddressingConstants.MEX_METADATA_SECTION.getLocalPart(),
                        MemberSubmissionAddressingConstants.MEX_METADATA_SECTION.getNamespaceURI());
                writer.writeAttribute(MemberSubmissionAddressingConstants.MEX_METADATA_DIALECT_ATTRIBUTE,
                        MemberSubmissionAddressingConstants.MEX_METADATA_DIALECT_VALUE);

                writeWsdl(writer, service, wsdlAddress);

                writer.writeEndElement();
                writer.writeEndElement();
            }

            break;
    }
}