Java Code Examples for javax.xml.soap.SOAPMessage#saveRequired()

The following examples show how to use javax.xml.soap.SOAPMessage#saveRequired() . 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: SoapRequestBean.java    From openxds with Apache License 2.0 6 votes vote down vote up
private static void printMessage(SOAPMessage message, String headerType) throws IOException, SOAPException {
    if (message != null) {
        //get the mime headers and print them
        System.out.println("\n\nHeader: " + headerType);
        if (message.saveRequired()) {
            message.saveChanges();
        }
        MimeHeaders headers = message.getMimeHeaders();
        printHeaders(headers);
        
        //print the message itself
        System.out.println("\n\nMessage: " + headerType);
        message.writeTo(System.out);
        System.out.println();
    }
}
 
Example 2
Source File: SAAJFactory.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public SOAPMessage readAsSOAPMessageSax2Dom(final SOAPVersion soapVersion, final Message message) throws SOAPException {
    SOAPMessage msg = soapVersion.getMessageFactory().createMessage();
    SAX2DOMEx s2d = new SAX2DOMEx(msg.getSOAPPart());
    try {
        message.writeTo(s2d, XmlUtil.DRACONIAN_ERROR_HANDLER);
    } catch (SAXException e) {
        throw new SOAPException(e);
    }
    addAttachmentsToSOAPMessage(msg, message);
    if (msg.saveRequired())
        msg.saveChanges();
    return msg;
}
 
Example 3
Source File: SAAJFactory.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Reads Message as SOAPMessage.  After this call message is consumed.
 * @param soapVersion SOAP version
 * @param message Message
 * @return Created SOAPMessage
 * @throws SOAPException if SAAJ processing fails
 */
public SOAPMessage readAsSOAPMessage(final SOAPVersion soapVersion, final Message message) throws SOAPException {
SOAPMessage msg = soapVersion.getMessageFactory().createMessage();
SaajStaxWriter writer = new SaajStaxWriter(msg);
try {
    message.writeTo(writer);
} catch (XMLStreamException e) {
    throw (e.getCause() instanceof SOAPException) ? (SOAPException) e.getCause() : new SOAPException(e);
}
msg = writer.getSOAPMessage();
addAttachmentsToSOAPMessage(msg, message);
if (msg.saveRequired())
        msg.saveChanges();
return msg;
}
 
Example 4
Source File: AbstractMessageImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private void transportHeaders(Packet packet, boolean inbound, SOAPMessage msg) throws SOAPException {
    Map<String, List<String>> headers = getTransportHeaders(packet, inbound);
    if (headers != null) {
        addSOAPMimeHeaders(msg.getMimeHeaders(), headers);
    }
    if (msg.saveRequired()) msg.saveChanges();
}
 
Example 5
Source File: SAAJFactory.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public SOAPMessage readAsSOAPMessageSax2Dom(final SOAPVersion soapVersion, final Message message) throws SOAPException {
    SOAPMessage msg = soapVersion.getMessageFactory().createMessage();
    SAX2DOMEx s2d = new SAX2DOMEx(msg.getSOAPPart());
    try {
        message.writeTo(s2d, XmlUtil.DRACONIAN_ERROR_HANDLER);
    } catch (SAXException e) {
        throw new SOAPException(e);
    }
    addAttachmentsToSOAPMessage(msg, message);
    if (msg.saveRequired())
        msg.saveChanges();
    return msg;
}
 
Example 6
Source File: SAAJFactory.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Reads Message as SOAPMessage.  After this call message is consumed.
 * @param soapVersion SOAP version
 * @param message Message
 * @return Created SOAPMessage
 * @throws SOAPException if SAAJ processing fails
 */
public SOAPMessage readAsSOAPMessage(final SOAPVersion soapVersion, final Message message) throws SOAPException {
SOAPMessage msg = soapVersion.getMessageFactory().createMessage();
SaajStaxWriter writer = new SaajStaxWriter(msg);
try {
    message.writeTo(writer);
} catch (XMLStreamException e) {
    throw (e.getCause() instanceof SOAPException) ? (SOAPException) e.getCause() : new SOAPException(e);
}
msg = writer.getSOAPMessage();
addAttachmentsToSOAPMessage(msg, message);
if (msg.saveRequired())
        msg.saveChanges();
return msg;
}
 
Example 7
Source File: AbstractMessageImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private void transportHeaders(Packet packet, boolean inbound, SOAPMessage msg) throws SOAPException {
    Map<String, List<String>> headers = getTransportHeaders(packet, inbound);
    if (headers != null) {
        addSOAPMimeHeaders(msg.getMimeHeaders(), headers);
    }
    if (msg.saveRequired()) msg.saveChanges();
}
 
Example 8
Source File: SAAJFactory.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public SOAPMessage readAsSOAPMessageSax2Dom(final SOAPVersion soapVersion, final Message message) throws SOAPException {
    SOAPMessage msg = soapVersion.getMessageFactory().createMessage();
    SAX2DOMEx s2d = new SAX2DOMEx(msg.getSOAPPart());
    try {
        message.writeTo(s2d, XmlUtil.DRACONIAN_ERROR_HANDLER);
    } catch (SAXException e) {
        throw new SOAPException(e);
    }
    addAttachmentsToSOAPMessage(msg, message);
    if (msg.saveRequired())
        msg.saveChanges();
    return msg;
}
 
Example 9
Source File: SAAJFactory.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Reads Message as SOAPMessage.  After this call message is consumed.
 * @param soapVersion SOAP version
 * @param message Message
 * @return Created SOAPMessage
 * @throws SOAPException if SAAJ processing fails
 */
public SOAPMessage readAsSOAPMessage(final SOAPVersion soapVersion, final Message message) throws SOAPException {
SOAPMessage msg = soapVersion.getMessageFactory().createMessage();
SaajStaxWriter writer = new SaajStaxWriter(msg);
try {
    message.writeTo(writer);
} catch (XMLStreamException e) {
    throw (e.getCause() instanceof SOAPException) ? (SOAPException) e.getCause() : new SOAPException(e);
}
msg = writer.getSOAPMessage();
addAttachmentsToSOAPMessage(msg, message);
if (msg.saveRequired())
        msg.saveChanges();
return msg;
}
 
Example 10
Source File: SAAJFactory.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public SOAPMessage readAsSOAPMessageSax2Dom(final SOAPVersion soapVersion, final Message message) throws SOAPException {
    SOAPMessage msg = soapVersion.getMessageFactory().createMessage();
    SAX2DOMEx s2d = new SAX2DOMEx(msg.getSOAPPart());
    try {
        message.writeTo(s2d, XmlUtil.DRACONIAN_ERROR_HANDLER);
    } catch (SAXException e) {
        throw new SOAPException(e);
    }
    addAttachmentsToSOAPMessage(msg, message);
    if (msg.saveRequired())
        msg.saveChanges();
    return msg;
}
 
Example 11
Source File: AbstractMessageImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private void transportHeaders(Packet packet, boolean inbound, SOAPMessage msg) throws SOAPException {
    Map<String, List<String>> headers = getTransportHeaders(packet, inbound);
    if (headers != null) {
        addSOAPMimeHeaders(msg.getMimeHeaders(), headers);
    }
    if (msg.saveRequired()) msg.saveChanges();
}
 
Example 12
Source File: AbstractMessageImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void transportHeaders(Packet packet, boolean inbound, SOAPMessage msg) throws SOAPException {
    Map<String, List<String>> headers = getTransportHeaders(packet, inbound);
    if (headers != null) {
        addSOAPMimeHeaders(msg.getMimeHeaders(), headers);
    }
    if (msg.saveRequired()) msg.saveChanges();
}
 
Example 13
Source File: SAAJFactory.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public SOAPMessage readAsSOAPMessageSax2Dom(final SOAPVersion soapVersion, final Message message) throws SOAPException {
    SOAPMessage msg = soapVersion.getMessageFactory().createMessage();
    SAX2DOMEx s2d = new SAX2DOMEx(msg.getSOAPPart());
    try {
        message.writeTo(s2d, XmlUtil.DRACONIAN_ERROR_HANDLER);
    } catch (SAXException e) {
        throw new SOAPException(e);
    }
    addAttachmentsToSOAPMessage(msg, message);
    if (msg.saveRequired())
        msg.saveChanges();
    return msg;
}
 
Example 14
Source File: SAAJFactory.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Reads Message as SOAPMessage.  After this call message is consumed.
 * @param soapVersion SOAP version
 * @param message Message
 * @return Created SOAPMessage
 * @throws SOAPException if SAAJ processing fails
 */
public SOAPMessage readAsSOAPMessage(final SOAPVersion soapVersion, final Message message) throws SOAPException {
SOAPMessage msg = soapVersion.getMessageFactory().createMessage();
SaajStaxWriter writer = new SaajStaxWriter(msg);
try {
    message.writeTo(writer);
} catch (XMLStreamException e) {
    throw (e.getCause() instanceof SOAPException) ? (SOAPException) e.getCause() : new SOAPException(e);
}
msg = writer.getSOAPMessage();
addAttachmentsToSOAPMessage(msg, message);
if (msg.saveRequired())
        msg.saveChanges();
return msg;
}
 
Example 15
Source File: AbstractMessageImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void transportHeaders(Packet packet, boolean inbound, SOAPMessage msg) throws SOAPException {
    Map<String, List<String>> headers = getTransportHeaders(packet, inbound);
    if (headers != null) {
        addSOAPMimeHeaders(msg.getMimeHeaders(), headers);
    }
    if (msg.saveRequired()) msg.saveChanges();
}
 
Example 16
Source File: SAAJFactory.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public SOAPMessage readAsSOAPMessageSax2Dom(final SOAPVersion soapVersion, final Message message) throws SOAPException {
    SOAPMessage msg = soapVersion.getMessageFactory().createMessage();
    SAX2DOMEx s2d = new SAX2DOMEx(msg.getSOAPPart());
    try {
        message.writeTo(s2d, XmlUtil.DRACONIAN_ERROR_HANDLER);
    } catch (SAXException e) {
        throw new SOAPException(e);
    }
    addAttachmentsToSOAPMessage(msg, message);
    if (msg.saveRequired())
        msg.saveChanges();
    return msg;
}
 
Example 17
Source File: SAAJFactory.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Reads Message as SOAPMessage.  After this call message is consumed.
 * @param soapVersion SOAP version
 * @param message Message
 * @return Created SOAPMessage
 * @throws SOAPException if SAAJ processing fails
 */
public SOAPMessage readAsSOAPMessage(final SOAPVersion soapVersion, final Message message) throws SOAPException {
SOAPMessage msg = soapVersion.getMessageFactory().createMessage();
SaajStaxWriter writer = new SaajStaxWriter(msg);
try {
    message.writeTo(writer);
} catch (XMLStreamException e) {
    throw (e.getCause() instanceof SOAPException) ? (SOAPException) e.getCause() : new SOAPException(e);
}
msg = writer.getSOAPMessage();
addAttachmentsToSOAPMessage(msg, message);
if (msg.saveRequired())
        msg.saveChanges();
return msg;
}
 
Example 18
Source File: AbstractMessageImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void transportHeaders(Packet packet, boolean inbound, SOAPMessage msg) throws SOAPException {
    Map<String, List<String>> headers = getTransportHeaders(packet, inbound);
    if (headers != null) {
        addSOAPMimeHeaders(msg.getMimeHeaders(), headers);
    }
    if (msg.saveRequired()) msg.saveChanges();
}
 
Example 19
Source File: SAAJFactory.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public SOAPMessage readAsSOAPMessageSax2Dom(final SOAPVersion soapVersion, final Message message) throws SOAPException {
    SOAPMessage msg = soapVersion.getMessageFactory().createMessage();
    SAX2DOMEx s2d = new SAX2DOMEx(msg.getSOAPPart());
    try {
        message.writeTo(s2d, XmlUtil.DRACONIAN_ERROR_HANDLER);
    } catch (SAXException e) {
        throw new SOAPException(e);
    }
    addAttachmentsToSOAPMessage(msg, message);
    if (msg.saveRequired())
        msg.saveChanges();
    return msg;
}
 
Example 20
Source File: SAAJFactory.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Reads Message as SOAPMessage.  After this call message is consumed.
 * @param soapVersion SOAP version
 * @param message Message
 * @return Created SOAPMessage
 * @throws SOAPException if SAAJ processing fails
 */
public SOAPMessage readAsSOAPMessage(final SOAPVersion soapVersion, final Message message) throws SOAPException {
SOAPMessage msg = soapVersion.getMessageFactory().createMessage();
SaajStaxWriter writer = new SaajStaxWriter(msg);
try {
    message.writeTo(writer);
} catch (XMLStreamException e) {
    throw (e.getCause() instanceof SOAPException) ? (SOAPException) e.getCause() : new SOAPException(e);
}
msg = writer.getSOAPMessage();
addAttachmentsToSOAPMessage(msg, message);
if (msg.saveRequired())
        msg.saveChanges();
return msg;
}