001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one
003: * or more contributor license agreements. See the NOTICE file
004: * distributed with this work for additional information
005: * regarding copyright ownership. The ASF licenses this file
006: * to you under the Apache License, Version 2.0 (the
007: * "License"); you may not use this file except in compliance
008: * with the License. You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing,
013: * software distributed under the License is distributed on an
014: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015: * KIND, either express or implied. See the License for the
016: * specific language governing permissions and limitations
017: * under the License.
018: */
019: package org.apache.axis2.jaxws.message;
020:
021: import org.apache.axis2.jaxws.core.MessageContext;
022: import org.apache.axis2.jaxws.message.factory.BlockFactory;
023:
024: import javax.activation.DataHandler;
025: import javax.xml.soap.SOAPMessage;
026: import javax.xml.ws.WebServiceException;
027:
028: import java.util.List;
029: import java.util.Map;
030:
031: /**
032: * Message
033: * <p/>
034: * A Message represents the XML + Attachments
035: * <p/>
036: * Most of the methods available on a message are only applicable to the XML part of the Message.
037: * See the XMLPart interface for an explantation of these methods.
038: *
039: * @see XMLPart
040: * @see Attachment
041: */
042: public interface Message extends XMLPart {
043:
044: /**
045: * Get the protocol for this Message (soap11, soap12, etc.)
046: *
047: * @return Protocl
048: */
049: public Protocol getProtocol();
050:
051: /**
052: * getAsSOAPMessage Get the xml part as a read/write SOAPEnvelope
053: *
054: * @return SOAPEnvelope
055: */
056: public SOAPMessage getAsSOAPMessage() throws WebServiceException;
057:
058: /**
059: * Add Attachment
060: * @param dh DataHandler (type of Attachment is inferred from dh.getContentType)
061: * @param id String which is the Attachment content id
062: * @see addAttachment(Attachment)
063: */
064: public void addDataHandler(DataHandler dh, String id);
065:
066: /**
067: * Get the list of attachment content ids for the message
068: * @return List<String>
069: */
070: public List<String> getAttachmentIDs();
071:
072: /**
073: * Get the indicated (non-soap part) attachment id
074: * @param index
075: * @return CID or null if not present
076: */
077: public String getAttachmentID(int index);
078:
079: /**
080: * Get the attachment identified by the contentID
081: * @param cid
082: * @return
083: */
084: public DataHandler getDataHandler(String cid);
085:
086: /**
087: * Indicate that an SWA DataHandler was added to the message.
088: * This information will be used to trigger SWA serialization.
089: * @param value
090: */
091: public void setDoingSWA(boolean value);
092:
093: /**
094: * @return true if SWA DataHandler is present
095: */
096: public boolean isDoingSWA();
097:
098: /**
099: * Get the attachment and remove it from the Message
100: * @param cid
101: */
102: public DataHandler removeDataHandler(String cid);
103:
104: /**
105: * A message is MTOM enabled if the
106: * associated dispatch/client/impl/provider has a binding type
107: * that enables MTOM.
108: * @return if this is an MTOM message
109: */
110: public boolean isMTOMEnabled();
111:
112: /**
113: * A message is MTOM enabled if the
114: * associated dispatch/client/impl/provider has a binding type
115: * that enables MTOM.
116: * Indicate whether this is an MTOM message
117: * @param b
118: */
119: public void setMTOMEnabled(boolean b);
120:
121: /**
122: * @return get the transport headers map.
123: */
124: public Map getMimeHeaders();
125:
126: /**
127: * Set the transport headers
128: * @param map Map
129: */
130: public void setMimeHeaders(Map map);
131:
132: /**
133: * Indicate that this message is passed the pivot point. For example, this is set in the JAX-WS
134: * Dispatcher to indicate
135: */
136: public void setPostPivot();
137:
138: /** @return true if post pivot */
139: public boolean isPostPivot();
140:
141: /**
142: * JAX-WS Message Context that owns the Message
143: * @param messageContext
144: */
145: public void setMessageContext(MessageContext messageContext);
146:
147: /**
148: * @return JAX-WS MessageContext
149: */
150: public MessageContext getMessageContext();
151:
152: /*
153: * Get the entire message rendered in a certain type of value (i.e. String, Source, SOAPMessage, etc.)
154: * @param context
155: * @param blockFactory blockfactory associated with the kind of rendering
156: */
157: public Object getValue(Object context, BlockFactory blockFactory)
158: throws WebServiceException;
159: }
|