01: /*
02: * Copyright 2005-2007 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.springframework.ws;
18:
19: import java.io.IOException;
20: import java.io.OutputStream;
21: import javax.xml.transform.Result;
22: import javax.xml.transform.Source;
23:
24: /**
25: * Represents a protocol-agnostic XML message.
26: * <p/>
27: * <p>Contains methods that provide access to the payload of the message.
28: *
29: * @author Arjen Poutsma
30: * @see org.springframework.ws.soap.SoapMessage
31: * @see WebServiceMessageFactory
32: * @since 1.0.0
33: */
34: public interface WebServiceMessage {
35:
36: /**
37: * Returns the contents of the message as a {@link Source}. <p> Depending on the implementation, this can be
38: * retrieved multiple times, or just a single time.
39: *
40: * @return the message contents
41: */
42: Source getPayloadSource();
43:
44: /**
45: * Returns the contents of the message as a {@link Result}. <p>Implementations that are read-only will throw an
46: * {@link UnsupportedOperationException}.
47: *
48: * @return the message contents
49: * @throws UnsupportedOperationException if the message is read-only
50: */
51: Result getPayloadResult();
52:
53: /**
54: * Writes the entire message to the given output stream. <p>If the given stream is an instance of {@link
55: * org.springframework.ws.transport.TransportOutputStream}, the corresponding headers will be written as well.
56: *
57: * @param outputStream the stream to write to
58: * @throws IOException if an I/O exception occurs
59: */
60: void writeTo(OutputStream outputStream) throws IOException;
61:
62: }
|