com.sun.xml.internal.ws.message.AttachmentSetImpl Java Examples

The following examples show how to use com.sun.xml.internal.ws.message.AttachmentSetImpl. 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: Messages.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a {@link Message} from an {@link Element} that represents
 * the whole SOAP message.
 *
 * @param soapEnvelope
 *      The SOAP envelope element.
 */
public static Message create(Element soapEnvelope) {
    SOAPVersion ver = SOAPVersion.fromNsUri(soapEnvelope.getNamespaceURI());
    // find the headers
    Element header = DOMUtil.getFirstChild(soapEnvelope, ver.nsUri, "Header");
    HeaderList headers = null;
    if(header!=null) {
        for( Node n=header.getFirstChild(); n!=null; n=n.getNextSibling() ) {
            if(n.getNodeType()==Node.ELEMENT_NODE) {
                if(headers==null)
                    headers = new HeaderList(ver);
                headers.add(Headers.create((Element)n));
            }
        }
    }

    // find the payload
    Element body = DOMUtil.getFirstChild(soapEnvelope, ver.nsUri, "Body");
    if(body==null)
        throw new WebServiceException("Message doesn't have <S:Body> "+soapEnvelope);
    Element payload = DOMUtil.getFirstChild(soapEnvelope, ver.nsUri, "Body");

    if(payload==null) {
        return new EmptyMessageImpl(headers, new AttachmentSetImpl(), ver);
    } else {
        return new DOMMessage(ver,headers,payload);
    }
}
 
Example #2
Source File: DispatchImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
protected AttachmentSet setOutboundAttachments() {
    HashMap<String, DataHandler> attachments = (HashMap<String, DataHandler>)
            getRequestContext().get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);

    if (attachments != null) {
        List<Attachment> alist = new ArrayList();
        for (Map.Entry<String, DataHandler> att : attachments.entrySet()) {
            DataHandlerAttachment dha = new DataHandlerAttachment(att.getKey(), att.getValue());
            alist.add(dha);
        }
        return new AttachmentSetImpl(alist);
    }
    return new AttachmentSetImpl();
}
 
Example #3
Source File: Messages.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a {@link Message} from an {@link Element} that represents
 * the whole SOAP message.
 *
 * @param soapEnvelope
 *      The SOAP envelope element.
 */
public static Message create(Element soapEnvelope) {
    SOAPVersion ver = SOAPVersion.fromNsUri(soapEnvelope.getNamespaceURI());
    // find the headers
    Element header = DOMUtil.getFirstChild(soapEnvelope, ver.nsUri, "Header");
    HeaderList headers = null;
    if(header!=null) {
        for( Node n=header.getFirstChild(); n!=null; n=n.getNextSibling() ) {
            if(n.getNodeType()==Node.ELEMENT_NODE) {
                if(headers==null)
                    headers = new HeaderList(ver);
                headers.add(Headers.create((Element)n));
            }
        }
    }

    // find the payload
    Element body = DOMUtil.getFirstChild(soapEnvelope, ver.nsUri, "Body");
    if(body==null)
        throw new WebServiceException("Message doesn't have <S:Body> "+soapEnvelope);
    Element payload = DOMUtil.getFirstChild(soapEnvelope, ver.nsUri, "Body");

    if(payload==null) {
        return new EmptyMessageImpl(headers, new AttachmentSetImpl(), ver);
    } else {
        return new DOMMessage(ver,headers,payload);
    }
}
 
Example #4
Source File: JAXBMessage.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private JAXBMessage(XMLBridge bridge, Object jaxbObject, SOAPVersion soapVer) {
    super(soapVer);
    // TODO: think about a better way to handle BridgeContext
    this.bridge = bridge;
    this.rawContext = null;
    this.jaxbObject = jaxbObject;
    QName tagName = bridge.getTypeInfo().tagName;
    this.nsUri = tagName.getNamespaceURI();
    this.localName = tagName.getLocalPart();
    this.attachmentSet = new AttachmentSetImpl();
}
 
Example #5
Source File: DispatchImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
protected AttachmentSet setOutboundAttachments() {
    HashMap<String, DataHandler> attachments = (HashMap<String, DataHandler>)
            getRequestContext().get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);

    if (attachments != null) {
        List<Attachment> alist = new ArrayList();
        for (Map.Entry<String, DataHandler> att : attachments.entrySet()) {
            DataHandlerAttachment dha = new DataHandlerAttachment(att.getKey(), att.getValue());
            alist.add(dha);
        }
        return new AttachmentSetImpl(alist);
    }
    return new AttachmentSetImpl();
}
 
Example #6
Source File: Messages.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a {@link Message} from an {@link Element} that represents
 * the whole SOAP message.
 *
 * @param soapEnvelope
 *      The SOAP envelope element.
 */
public static Message create(Element soapEnvelope) {
    SOAPVersion ver = SOAPVersion.fromNsUri(soapEnvelope.getNamespaceURI());
    // find the headers
    Element header = DOMUtil.getFirstChild(soapEnvelope, ver.nsUri, "Header");
    HeaderList headers = null;
    if(header!=null) {
        for( Node n=header.getFirstChild(); n!=null; n=n.getNextSibling() ) {
            if(n.getNodeType()==Node.ELEMENT_NODE) {
                if(headers==null)
                    headers = new HeaderList(ver);
                headers.add(Headers.create((Element)n));
            }
        }
    }

    // find the payload
    Element body = DOMUtil.getFirstChild(soapEnvelope, ver.nsUri, "Body");
    if(body==null)
        throw new WebServiceException("Message doesn't have <S:Body> "+soapEnvelope);
    Element payload = DOMUtil.getFirstChild(soapEnvelope, ver.nsUri, "Body");

    if(payload==null) {
        return new EmptyMessageImpl(headers, new AttachmentSetImpl(), ver);
    } else {
        return new DOMMessage(ver,headers,payload);
    }
}
 
Example #7
Source File: DispatchImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
protected AttachmentSet setOutboundAttachments() {
    HashMap<String, DataHandler> attachments = (HashMap<String, DataHandler>)
            getRequestContext().get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);

    if (attachments != null) {
        List<Attachment> alist = new ArrayList();
        for (Map.Entry<String, DataHandler> att : attachments.entrySet()) {
            DataHandlerAttachment dha = new DataHandlerAttachment(att.getKey(), att.getValue());
            alist.add(dha);
        }
        return new AttachmentSetImpl(alist);
    }
    return new AttachmentSetImpl();
}
 
Example #8
Source File: Messages.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a {@link Message} from an {@link Element} that represents
 * the whole SOAP message.
 *
 * @param soapEnvelope
 *      The SOAP envelope element.
 */
public static Message create(Element soapEnvelope) {
    SOAPVersion ver = SOAPVersion.fromNsUri(soapEnvelope.getNamespaceURI());
    // find the headers
    Element header = DOMUtil.getFirstChild(soapEnvelope, ver.nsUri, "Header");
    HeaderList headers = null;
    if(header!=null) {
        for( Node n=header.getFirstChild(); n!=null; n=n.getNextSibling() ) {
            if(n.getNodeType()==Node.ELEMENT_NODE) {
                if(headers==null)
                    headers = new HeaderList(ver);
                headers.add(Headers.create((Element)n));
            }
        }
    }

    // find the payload
    Element body = DOMUtil.getFirstChild(soapEnvelope, ver.nsUri, "Body");
    if(body==null)
        throw new WebServiceException("Message doesn't have <S:Body> "+soapEnvelope);
    Element payload = DOMUtil.getFirstChild(soapEnvelope, ver.nsUri, "Body");

    if(payload==null) {
        return new EmptyMessageImpl(headers, new AttachmentSetImpl(), ver);
    } else {
        return new DOMMessage(ver,headers,payload);
    }
}
 
Example #9
Source File: DispatchImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
protected AttachmentSet setOutboundAttachments() {
    HashMap<String, DataHandler> attachments = (HashMap<String, DataHandler>)
            getRequestContext().get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);

    if (attachments != null) {
        List<Attachment> alist = new ArrayList();
        for (Map.Entry<String, DataHandler> att : attachments.entrySet()) {
            DataHandlerAttachment dha = new DataHandlerAttachment(att.getKey(), att.getValue());
            alist.add(dha);
        }
        return new AttachmentSetImpl(alist);
    }
    return new AttachmentSetImpl();
}
 
Example #10
Source File: JAXBMessage.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private JAXBMessage(XMLBridge bridge, Object jaxbObject, SOAPVersion soapVer) {
    super(soapVer);
    // TODO: think about a better way to handle BridgeContext
    this.bridge = bridge;
    this.rawContext = null;
    this.jaxbObject = jaxbObject;
    QName tagName = bridge.getTypeInfo().tagName;
    this.nsUri = tagName.getNamespaceURI();
    this.localName = tagName.getLocalPart();
    this.attachmentSet = new AttachmentSetImpl();
}
 
Example #11
Source File: JAXBMessage.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private JAXBMessage(XMLBridge bridge, Object jaxbObject, SOAPVersion soapVer) {
    super(soapVer);
    // TODO: think about a better way to handle BridgeContext
    this.bridge = bridge;
    this.rawContext = null;
    this.jaxbObject = jaxbObject;
    QName tagName = bridge.getTypeInfo().tagName;
    this.nsUri = tagName.getNamespaceURI();
    this.localName = tagName.getLocalPart();
    this.attachmentSet = new AttachmentSetImpl();
}
 
Example #12
Source File: Messages.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a {@link Message} from an {@link Element} that represents
 * the whole SOAP message.
 *
 * @param soapEnvelope
 *      The SOAP envelope element.
 */
public static Message create(Element soapEnvelope) {
    SOAPVersion ver = SOAPVersion.fromNsUri(soapEnvelope.getNamespaceURI());
    // find the headers
    Element header = DOMUtil.getFirstChild(soapEnvelope, ver.nsUri, "Header");
    HeaderList headers = null;
    if(header!=null) {
        for( Node n=header.getFirstChild(); n!=null; n=n.getNextSibling() ) {
            if(n.getNodeType()==Node.ELEMENT_NODE) {
                if(headers==null)
                    headers = new HeaderList(ver);
                headers.add(Headers.create((Element)n));
            }
        }
    }

    // find the payload
    Element body = DOMUtil.getFirstChild(soapEnvelope, ver.nsUri, "Body");
    if(body==null)
        throw new WebServiceException("Message doesn't have <S:Body> "+soapEnvelope);
    Element payload = DOMUtil.getFirstChild(soapEnvelope, ver.nsUri, "Body");

    if(payload==null) {
        return new EmptyMessageImpl(headers, new AttachmentSetImpl(), ver);
    } else {
        return new DOMMessage(ver,headers,payload);
    }
}
 
Example #13
Source File: Messages.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a {@link Message} from an {@link Element} that represents
 * the whole SOAP message.
 *
 * @param soapEnvelope
 *      The SOAP envelope element.
 */
public static Message create(Element soapEnvelope) {
    SOAPVersion ver = SOAPVersion.fromNsUri(soapEnvelope.getNamespaceURI());
    // find the headers
    Element header = DOMUtil.getFirstChild(soapEnvelope, ver.nsUri, "Header");
    HeaderList headers = null;
    if(header!=null) {
        for( Node n=header.getFirstChild(); n!=null; n=n.getNextSibling() ) {
            if(n.getNodeType()==Node.ELEMENT_NODE) {
                if(headers==null)
                    headers = new HeaderList(ver);
                headers.add(Headers.create((Element)n));
            }
        }
    }

    // find the payload
    Element body = DOMUtil.getFirstChild(soapEnvelope, ver.nsUri, "Body");
    if(body==null)
        throw new WebServiceException("Message doesn't have <S:Body> "+soapEnvelope);
    Element payload = DOMUtil.getFirstChild(soapEnvelope, ver.nsUri, "Body");

    if(payload==null) {
        return new EmptyMessageImpl(headers, new AttachmentSetImpl(), ver);
    } else {
        return new DOMMessage(ver,headers,payload);
    }
}
 
Example #14
Source File: JAXBMessage.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private JAXBMessage(XMLBridge bridge, Object jaxbObject, SOAPVersion soapVer) {
    super(soapVer);
    // TODO: think about a better way to handle BridgeContext
    this.bridge = bridge;
    this.rawContext = null;
    this.jaxbObject = jaxbObject;
    QName tagName = bridge.getTypeInfo().tagName;
    this.nsUri = tagName.getNamespaceURI();
    this.localName = tagName.getLocalPart();
    this.attachmentSet = new AttachmentSetImpl();
}
 
Example #15
Source File: JAXBMessage.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private JAXBMessage(XMLBridge bridge, Object jaxbObject, SOAPVersion soapVer) {
    super(soapVer);
    // TODO: think about a better way to handle BridgeContext
    this.bridge = bridge;
    this.rawContext = null;
    this.jaxbObject = jaxbObject;
    QName tagName = bridge.getTypeInfo().tagName;
    this.nsUri = tagName.getNamespaceURI();
    this.localName = tagName.getLocalPart();
    this.attachmentSet = new AttachmentSetImpl();
}
 
Example #16
Source File: DispatchImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected AttachmentSet setOutboundAttachments() {
    HashMap<String, DataHandler> attachments = (HashMap<String, DataHandler>)
            getRequestContext().get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);

    if (attachments != null) {
        List<Attachment> alist = new ArrayList();
        for (Map.Entry<String, DataHandler> att : attachments.entrySet()) {
            DataHandlerAttachment dha = new DataHandlerAttachment(att.getKey(), att.getValue());
            alist.add(dha);
        }
        return new AttachmentSetImpl(alist);
    }
    return new AttachmentSetImpl();
}
 
Example #17
Source File: DispatchImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
protected AttachmentSet setOutboundAttachments() {
    HashMap<String, DataHandler> attachments = (HashMap<String, DataHandler>)
            getRequestContext().get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);

    if (attachments != null) {
        List<Attachment> alist = new ArrayList();
        for (Map.Entry<String, DataHandler> att : attachments.entrySet()) {
            DataHandlerAttachment dha = new DataHandlerAttachment(att.getKey(), att.getValue());
            alist.add(dha);
        }
        return new AttachmentSetImpl(alist);
    }
    return new AttachmentSetImpl();
}
 
Example #18
Source File: Messages.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a {@link Message} from an {@link Element} that represents
 * the whole SOAP message.
 *
 * @param soapEnvelope
 *      The SOAP envelope element.
 */
public static Message create(Element soapEnvelope) {
    SOAPVersion ver = SOAPVersion.fromNsUri(soapEnvelope.getNamespaceURI());
    // find the headers
    Element header = DOMUtil.getFirstChild(soapEnvelope, ver.nsUri, "Header");
    HeaderList headers = null;
    if(header!=null) {
        for( Node n=header.getFirstChild(); n!=null; n=n.getNextSibling() ) {
            if(n.getNodeType()==Node.ELEMENT_NODE) {
                if(headers==null)
                    headers = new HeaderList(ver);
                headers.add(Headers.create((Element)n));
            }
        }
    }

    // find the payload
    Element body = DOMUtil.getFirstChild(soapEnvelope, ver.nsUri, "Body");
    if(body==null)
        throw new WebServiceException("Message doesn't have <S:Body> "+soapEnvelope);
    Element payload = DOMUtil.getFirstChild(soapEnvelope, ver.nsUri, "Body");

    if(payload==null) {
        return new EmptyMessageImpl(headers, new AttachmentSetImpl(), ver);
    } else {
        return new DOMMessage(ver,headers,payload);
    }
}
 
Example #19
Source File: JAXBMessage.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private JAXBMessage(XMLBridge bridge, Object jaxbObject, SOAPVersion soapVer) {
    super(soapVer);
    // TODO: think about a better way to handle BridgeContext
    this.bridge = bridge;
    this.rawContext = null;
    this.jaxbObject = jaxbObject;
    QName tagName = bridge.getTypeInfo().tagName;
    this.nsUri = tagName.getNamespaceURI();
    this.localName = tagName.getLocalPart();
    this.attachmentSet = new AttachmentSetImpl();
}
 
Example #20
Source File: JAXBMessage.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private JAXBMessage(XMLBridge bridge, Object jaxbObject, SOAPVersion soapVer) {
    super(soapVer);
    // TODO: think about a better way to handle BridgeContext
    this.bridge = bridge;
    this.rawContext = null;
    this.jaxbObject = jaxbObject;
    QName tagName = bridge.getTypeInfo().tagName;
    this.nsUri = tagName.getNamespaceURI();
    this.localName = tagName.getLocalPart();
    this.attachmentSet = new AttachmentSetImpl();
}
 
Example #21
Source File: Messages.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a {@link Message} from an {@link Element} that represents
 * the whole SOAP message.
 *
 * @param soapEnvelope
 *      The SOAP envelope element.
 */
public static Message create(Element soapEnvelope) {
    SOAPVersion ver = SOAPVersion.fromNsUri(soapEnvelope.getNamespaceURI());
    // find the headers
    Element header = DOMUtil.getFirstChild(soapEnvelope, ver.nsUri, "Header");
    HeaderList headers = null;
    if(header!=null) {
        for( Node n=header.getFirstChild(); n!=null; n=n.getNextSibling() ) {
            if(n.getNodeType()==Node.ELEMENT_NODE) {
                if(headers==null)
                    headers = new HeaderList(ver);
                headers.add(Headers.create((Element)n));
            }
        }
    }

    // find the payload
    Element body = DOMUtil.getFirstChild(soapEnvelope, ver.nsUri, "Body");
    if(body==null)
        throw new WebServiceException("Message doesn't have <S:Body> "+soapEnvelope);
    Element payload = DOMUtil.getFirstChild(soapEnvelope, ver.nsUri, "Body");

    if(payload==null) {
        return new EmptyMessageImpl(headers, new AttachmentSetImpl(), ver);
    } else {
        return new DOMMessage(ver,headers,payload);
    }
}
 
Example #22
Source File: DispatchImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
protected AttachmentSet setOutboundAttachments() {
    HashMap<String, DataHandler> attachments = (HashMap<String, DataHandler>)
            getRequestContext().get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);

    if (attachments != null) {
        List<Attachment> alist = new ArrayList();
        for (Map.Entry<String, DataHandler> att : attachments.entrySet()) {
            DataHandlerAttachment dha = new DataHandlerAttachment(att.getKey(), att.getValue());
            alist.add(dha);
        }
        return new AttachmentSetImpl(alist);
    }
    return new AttachmentSetImpl();
}
 
Example #23
Source File: DispatchImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
protected AttachmentSet setOutboundAttachments() {
    HashMap<String, DataHandler> attachments = (HashMap<String, DataHandler>)
            getRequestContext().get(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);

    if (attachments != null) {
        List<Attachment> alist = new ArrayList();
        for (Map.Entry<String, DataHandler> att : attachments.entrySet()) {
            DataHandlerAttachment dha = new DataHandlerAttachment(att.getKey(), att.getValue());
            alist.add(dha);
        }
        return new AttachmentSetImpl(alist);
    }
    return new AttachmentSetImpl();
}
 
Example #24
Source File: JAXBMessage.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private JAXBMessage(XMLBridge bridge, Object jaxbObject, SOAPVersion soapVer) {
    super(soapVer);
    // TODO: think about a better way to handle BridgeContext
    this.bridge = bridge;
    this.rawContext = null;
    this.jaxbObject = jaxbObject;
    QName tagName = bridge.getTypeInfo().tagName;
    this.nsUri = tagName.getNamespaceURI();
    this.localName = tagName.getLocalPart();
    this.attachmentSet = new AttachmentSetImpl();
}
 
Example #25
Source File: PayloadSourceMessage.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public PayloadSourceMessage(Source s, SOAPVersion soapVer) {
    this(null, s, new AttachmentSetImpl(), soapVer);
}
 
Example #26
Source File: PayloadStreamReaderMessage.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public PayloadStreamReaderMessage(XMLStreamReader reader, SOAPVersion soapVer) {
    this(null, reader,new AttachmentSetImpl(), soapVer);
}
 
Example #27
Source File: StreamSOAPCodec.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public void decode(InputStream in, String contentType, Packet packet) throws IOException {
    decode(in, contentType, packet, new AttachmentSetImpl());
}
 
Example #28
Source File: PayloadStreamReaderMessage.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public PayloadStreamReaderMessage(XMLStreamReader reader, SOAPVersion soapVer) {
    this(null, reader,new AttachmentSetImpl(), soapVer);
}
 
Example #29
Source File: StreamSOAPCodec.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public void decode(InputStream in, String contentType, Packet packet) throws IOException {
    decode(in, contentType, packet, new AttachmentSetImpl());
}
 
Example #30
Source File: PayloadStreamReaderMessage.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public PayloadStreamReaderMessage(XMLStreamReader reader, SOAPVersion soapVer) {
    this(null, reader,new AttachmentSetImpl(), soapVer);
}