Java Code Examples for com.sun.xml.internal.ws.api.message.Header#writeTo()

The following examples show how to use com.sun.xml.internal.ws.api.message.Header#writeTo() . 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: AbstractMessageImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Writes the whole envelope as SAX events.
 */
@Override
public void writeTo( ContentHandler contentHandler, ErrorHandler errorHandler ) throws SAXException {
    String soapNsUri = soapVersion.nsUri;

    contentHandler.setDocumentLocator(NULL_LOCATOR);
    contentHandler.startDocument();
    contentHandler.startPrefixMapping("S",soapNsUri);
    contentHandler.startElement(soapNsUri,"Envelope","S:Envelope",EMPTY_ATTS);
    if(hasHeaders()) {
        contentHandler.startElement(soapNsUri,"Header","S:Header",EMPTY_ATTS);
        MessageHeaders headers = getHeaders();
        for (Header h : headers.asList()) {
            h.writeTo(contentHandler,errorHandler);
        }
        contentHandler.endElement(soapNsUri,"Header","S:Header");
    }
    // write the body
    contentHandler.startElement(soapNsUri,"Body","S:Body",EMPTY_ATTS);
    writePayloadTo(contentHandler,errorHandler, true);
    contentHandler.endElement(soapNsUri,"Body","S:Body");
    contentHandler.endElement(soapNsUri,"Envelope","S:Envelope");
}
 
Example 2
Source File: AbstractMessageImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Writes the whole envelope as SAX events.
 */
@Override
public void writeTo( ContentHandler contentHandler, ErrorHandler errorHandler ) throws SAXException {
    String soapNsUri = soapVersion.nsUri;

    contentHandler.setDocumentLocator(NULL_LOCATOR);
    contentHandler.startDocument();
    contentHandler.startPrefixMapping("S",soapNsUri);
    contentHandler.startElement(soapNsUri,"Envelope","S:Envelope",EMPTY_ATTS);
    if(hasHeaders()) {
        contentHandler.startElement(soapNsUri,"Header","S:Header",EMPTY_ATTS);
        MessageHeaders headers = getHeaders();
        for (Header h : headers.asList()) {
            h.writeTo(contentHandler,errorHandler);
        }
        contentHandler.endElement(soapNsUri,"Header","S:Header");
    }
    // write the body
    contentHandler.startElement(soapNsUri,"Body","S:Body",EMPTY_ATTS);
    writePayloadTo(contentHandler,errorHandler, true);
    contentHandler.endElement(soapNsUri,"Body","S:Body");
    contentHandler.endElement(soapNsUri,"Envelope","S:Envelope");
}
 
Example 3
Source File: AbstractMessageImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Default implementation that relies on {@link #writePayloadTo(XMLStreamWriter)}
 */
@Override
public void writeTo(XMLStreamWriter w) throws XMLStreamException {
    String soapNsUri = soapVersion.nsUri;
    w.writeStartDocument();
    w.writeStartElement("S","Envelope",soapNsUri);
    w.writeNamespace("S",soapNsUri);
    if(hasHeaders()) {
        w.writeStartElement("S","Header",soapNsUri);
        MessageHeaders headers = getHeaders();
        for (Header h : headers.asList()) {
            h.writeTo(w);
        }
        w.writeEndElement();
    }
    // write the body
    w.writeStartElement("S","Body",soapNsUri);

    writePayloadTo(w);

    w.writeEndElement();
    w.writeEndElement();
    w.writeEndDocument();
}
 
Example 4
Source File: SAAJMessageHeaders.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean add(Header header) {
    try {
        header.writeTo(sm);
    } catch (SOAPException e) {
        //TODO log exception
        return false;
    }

    //the newly added header is not understood by default
    notUnderstood(new QName(header.getNamespaceURI(), header.getLocalPart()));

    //track non saaj headers so that they can be retrieved later
    if (isNonSAAJHeader(header)) {
        //TODO assumes only one header with that name?
        addNonSAAJHeader(find(header.getNamespaceURI(), header.getLocalPart()),
                header);
    }

    return true;
}
 
Example 5
Source File: AbstractMessageImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Writes the whole envelope as SAX events.
 */
@Override
public void writeTo( ContentHandler contentHandler, ErrorHandler errorHandler ) throws SAXException {
    String soapNsUri = soapVersion.nsUri;

    contentHandler.setDocumentLocator(NULL_LOCATOR);
    contentHandler.startDocument();
    contentHandler.startPrefixMapping("S",soapNsUri);
    contentHandler.startElement(soapNsUri,"Envelope","S:Envelope",EMPTY_ATTS);
    if(hasHeaders()) {
        contentHandler.startElement(soapNsUri,"Header","S:Header",EMPTY_ATTS);
        MessageHeaders headers = getHeaders();
        for (Header h : headers.asList()) {
            h.writeTo(contentHandler,errorHandler);
        }
        contentHandler.endElement(soapNsUri,"Header","S:Header");
    }
    // write the body
    contentHandler.startElement(soapNsUri,"Body","S:Body",EMPTY_ATTS);
    writePayloadTo(contentHandler,errorHandler, true);
    contentHandler.endElement(soapNsUri,"Body","S:Body");
    contentHandler.endElement(soapNsUri,"Envelope","S:Envelope");
}
 
Example 6
Source File: AbstractMessageImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Default implementation that relies on {@link #writePayloadTo(XMLStreamWriter)}
 */
@Override
public void writeTo(XMLStreamWriter w) throws XMLStreamException {
    String soapNsUri = soapVersion.nsUri;
    w.writeStartDocument();
    w.writeStartElement("S","Envelope",soapNsUri);
    w.writeNamespace("S",soapNsUri);
    if(hasHeaders()) {
        w.writeStartElement("S","Header",soapNsUri);
        MessageHeaders headers = getHeaders();
        for (Header h : headers.asList()) {
            h.writeTo(w);
        }
        w.writeEndElement();
    }
    // write the body
    w.writeStartElement("S","Body",soapNsUri);

    writePayloadTo(w);

    w.writeEndElement();
    w.writeEndElement();
    w.writeEndDocument();
}
 
Example 7
Source File: SAAJMessageHeaders.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean add(Header header) {
    try {
        header.writeTo(sm);
    } catch (SOAPException e) {
        //TODO log exception
        return false;
    }

    //the newly added header is not understood by default
    notUnderstood(new QName(header.getNamespaceURI(), header.getLocalPart()));

    //track non saaj headers so that they can be retrieved later
    if (isNonSAAJHeader(header)) {
        //TODO assumes only one header with that name?
        addNonSAAJHeader(find(header.getNamespaceURI(), header.getLocalPart()),
                header);
    }

    return true;
}
 
Example 8
Source File: AbstractMessageImpl.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Writes the whole envelope as SAX events.
 */
@Override
public void writeTo( ContentHandler contentHandler, ErrorHandler errorHandler ) throws SAXException {
    String soapNsUri = soapVersion.nsUri;

    contentHandler.setDocumentLocator(NULL_LOCATOR);
    contentHandler.startDocument();
    contentHandler.startPrefixMapping("S",soapNsUri);
    contentHandler.startElement(soapNsUri,"Envelope","S:Envelope",EMPTY_ATTS);
    if(hasHeaders()) {
        contentHandler.startElement(soapNsUri,"Header","S:Header",EMPTY_ATTS);
        MessageHeaders headers = getHeaders();
        for (Header h : headers.asList()) {
            h.writeTo(contentHandler,errorHandler);
        }
        contentHandler.endElement(soapNsUri,"Header","S:Header");
    }
    // write the body
    contentHandler.startElement(soapNsUri,"Body","S:Body",EMPTY_ATTS);
    writePayloadTo(contentHandler,errorHandler, true);
    contentHandler.endElement(soapNsUri,"Body","S:Body");
    contentHandler.endElement(soapNsUri,"Envelope","S:Envelope");
}
 
Example 9
Source File: AbstractMessageImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public void writeToBodyStart(XMLStreamWriter w) throws XMLStreamException {
    String soapNsUri = soapVersion.nsUri;
    w.writeStartDocument();
    w.writeStartElement("S","Envelope",soapNsUri);
    w.writeNamespace("S",soapNsUri);
    if(hasHeaders()) {
        w.writeStartElement("S","Header",soapNsUri);
        MessageHeaders headers = getHeaders();
        for (Header h : headers.asList()) {
            h.writeTo(w);
        }
        w.writeEndElement();
    }
    // write the body
    w.writeStartElement("S","Body",soapNsUri);
}
 
Example 10
Source File: SAAJMessageHeaders.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean add(Header header) {
    try {
        header.writeTo(sm);
    } catch (SOAPException e) {
        //TODO log exception
        return false;
    }

    //the newly added header is not understood by default
    notUnderstood(new QName(header.getNamespaceURI(), header.getLocalPart()));

    //track non saaj headers so that they can be retrieved later
    if (isNonSAAJHeader(header)) {
        //TODO assumes only one header with that name?
        addNonSAAJHeader(find(header.getNamespaceURI(), header.getLocalPart()),
                header);
    }

    return true;
}
 
Example 11
Source File: SAAJMessageHeaders.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean add(Header header) {
    try {
        header.writeTo(sm);
    } catch (SOAPException e) {
        //TODO log exception
        return false;
    }

    //the newly added header is not understood by default
    notUnderstood(new QName(header.getNamespaceURI(), header.getLocalPart()));

    //track non saaj headers so that they can be retrieved later
    if (isNonSAAJHeader(header)) {
        //TODO assumes only one header with that name?
        addNonSAAJHeader(find(header.getNamespaceURI(), header.getLocalPart()),
                header);
    }

    return true;
}
 
Example 12
Source File: AbstractMessageImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Default implementation that relies on {@link #writePayloadTo(XMLStreamWriter)}
 */
@Override
public void writeTo(XMLStreamWriter w) throws XMLStreamException {
    String soapNsUri = soapVersion.nsUri;
    w.writeStartDocument();
    w.writeStartElement("S","Envelope",soapNsUri);
    w.writeNamespace("S",soapNsUri);
    if(hasHeaders()) {
        w.writeStartElement("S","Header",soapNsUri);
        MessageHeaders headers = getHeaders();
        for (Header h : headers.asList()) {
            h.writeTo(w);
        }
        w.writeEndElement();
    }
    // write the body
    w.writeStartElement("S","Body",soapNsUri);

    writePayloadTo(w);

    w.writeEndElement();
    w.writeEndElement();
    w.writeEndDocument();
}
 
Example 13
Source File: SAAJMessageHeaders.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean add(Header header) {
    try {
        header.writeTo(sm);
    } catch (SOAPException e) {
        //TODO log exception
        return false;
    }

    //the newly added header is not understood by default
    notUnderstood(new QName(header.getNamespaceURI(), header.getLocalPart()));

    //track non saaj headers so that they can be retrieved later
    if (isNonSAAJHeader(header)) {
        //TODO assumes only one header with that name?
        addNonSAAJHeader(find(header.getNamespaceURI(), header.getLocalPart()),
                header);
    }

    return true;
}
 
Example 14
Source File: AbstractMessageImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Writes the whole envelope as SAX events.
 */
@Override
public void writeTo( ContentHandler contentHandler, ErrorHandler errorHandler ) throws SAXException {
    String soapNsUri = soapVersion.nsUri;

    contentHandler.setDocumentLocator(NULL_LOCATOR);
    contentHandler.startDocument();
    contentHandler.startPrefixMapping("S",soapNsUri);
    contentHandler.startElement(soapNsUri,"Envelope","S:Envelope",EMPTY_ATTS);
    if(hasHeaders()) {
        contentHandler.startElement(soapNsUri,"Header","S:Header",EMPTY_ATTS);
        MessageHeaders headers = getHeaders();
        for (Header h : headers.asList()) {
            h.writeTo(contentHandler,errorHandler);
        }
        contentHandler.endElement(soapNsUri,"Header","S:Header");
    }
    // write the body
    contentHandler.startElement(soapNsUri,"Body","S:Body",EMPTY_ATTS);
    writePayloadTo(contentHandler,errorHandler, true);
    contentHandler.endElement(soapNsUri,"Body","S:Body");
    contentHandler.endElement(soapNsUri,"Envelope","S:Envelope");
}
 
Example 15
Source File: AbstractMessageImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Default implementation that relies on {@link #writePayloadTo(XMLStreamWriter)}
 */
@Override
public void writeTo(XMLStreamWriter w) throws XMLStreamException {
    String soapNsUri = soapVersion.nsUri;
    w.writeStartDocument();
    w.writeStartElement("S","Envelope",soapNsUri);
    w.writeNamespace("S",soapNsUri);
    if(hasHeaders()) {
        w.writeStartElement("S","Header",soapNsUri);
        MessageHeaders headers = getHeaders();
        for (Header h : headers.asList()) {
            h.writeTo(w);
        }
        w.writeEndElement();
    }
    // write the body
    w.writeStartElement("S","Body",soapNsUri);

    writePayloadTo(w);

    w.writeEndElement();
    w.writeEndElement();
    w.writeEndDocument();
}
 
Example 16
Source File: SAAJMessageHeaders.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean add(Header header) {
    try {
        header.writeTo(sm);
    } catch (SOAPException e) {
        //TODO log exception
        return false;
    }

    //the newly added header is not understood by default
    notUnderstood(new QName(header.getNamespaceURI(), header.getLocalPart()));

    //track non saaj headers so that they can be retrieved later
    if (isNonSAAJHeader(header)) {
        //TODO assumes only one header with that name?
        addNonSAAJHeader(find(header.getNamespaceURI(), header.getLocalPart()),
                header);
    }

    return true;
}
 
Example 17
Source File: AbstractMessageImpl.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Default implementation that relies on {@link #writePayloadTo(XMLStreamWriter)}
 */
@Override
public void writeTo(XMLStreamWriter w) throws XMLStreamException {
    String soapNsUri = soapVersion.nsUri;
    w.writeStartDocument();
    w.writeStartElement("S","Envelope",soapNsUri);
    w.writeNamespace("S",soapNsUri);
    if(hasHeaders()) {
        w.writeStartElement("S","Header",soapNsUri);
        MessageHeaders headers = getHeaders();
        for (Header h : headers.asList()) {
            h.writeTo(w);
        }
        w.writeEndElement();
    }
    // write the body
    w.writeStartElement("S","Body",soapNsUri);

    writePayloadTo(w);

    w.writeEndElement();
    w.writeEndElement();
    w.writeEndDocument();
}
 
Example 18
Source File: AbstractMessageImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Default implementation that relies on {@link #writePayloadTo(XMLStreamWriter)}
 */
@Override
public void writeTo(XMLStreamWriter w) throws XMLStreamException {
    String soapNsUri = soapVersion.nsUri;
    w.writeStartDocument();
    w.writeStartElement("S","Envelope",soapNsUri);
    w.writeNamespace("S",soapNsUri);
    if(hasHeaders()) {
        w.writeStartElement("S","Header",soapNsUri);
        MessageHeaders headers = getHeaders();
        for (Header h : headers.asList()) {
            h.writeTo(w);
        }
        w.writeEndElement();
    }
    // write the body
    w.writeStartElement("S","Body",soapNsUri);

    writePayloadTo(w);

    w.writeEndElement();
    w.writeEndElement();
    w.writeEndDocument();
}
 
Example 19
Source File: SAAJMessageHeaders.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean add(Header header) {
    try {
        header.writeTo(sm);
    } catch (SOAPException e) {
        //TODO log exception
        return false;
    }

    //the newly added header is not understood by default
    notUnderstood(new QName(header.getNamespaceURI(), header.getLocalPart()));

    //track non saaj headers so that they can be retrieved later
    if (isNonSAAJHeader(header)) {
        //TODO assumes only one header with that name?
        addNonSAAJHeader(find(header.getNamespaceURI(), header.getLocalPart()),
                header);
    }

    return true;
}
 
Example 20
Source File: AbstractMessageImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Writes the whole envelope as SAX events.
 */
@Override
public void writeTo( ContentHandler contentHandler, ErrorHandler errorHandler ) throws SAXException {
    String soapNsUri = soapVersion.nsUri;

    contentHandler.setDocumentLocator(NULL_LOCATOR);
    contentHandler.startDocument();
    contentHandler.startPrefixMapping("S",soapNsUri);
    contentHandler.startElement(soapNsUri,"Envelope","S:Envelope",EMPTY_ATTS);
    if(hasHeaders()) {
        contentHandler.startElement(soapNsUri,"Header","S:Header",EMPTY_ATTS);
        MessageHeaders headers = getHeaders();
        for (Header h : headers.asList()) {
            h.writeTo(contentHandler,errorHandler);
        }
        contentHandler.endElement(soapNsUri,"Header","S:Header");
    }
    // write the body
    contentHandler.startElement(soapNsUri,"Body","S:Body",EMPTY_ATTS);
    writePayloadTo(contentHandler,errorHandler, true);
    contentHandler.endElement(soapNsUri,"Body","S:Body");
    contentHandler.endElement(soapNsUri,"Envelope","S:Envelope");
}