Skip to content

Commit 10f4a3b

Browse files
committed
Review reference guide
Closes gh-1475
1 parent ae1029e commit 10f4a3b

File tree

16 files changed

+275
-308
lines changed

16 files changed

+275
-308
lines changed

gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ version=4.0.12-SNAPSHOT
22

33
org.gradle.caching=true
44
org.gradle.parallel=true
5+
6+
springFrameworkVersion=6.0.23

spring-ws-core/src/main/java/org/springframework/ws/soap/SoapMessage.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
import org.springframework.ws.mime.MimeMessage;
2323

2424
/**
25-
* Represents an abstraction for SOAP messages, providing access to a SOAP Envelope. The
26-
* contents of the SOAP body can be retrieved by {@code getPayloadSource()} and
27-
* {@code getPayloadResult()} on {@code WebServiceMessage}, the super-interface of this
28-
* interface.
25+
* Represents an abstraction for SOAP messages, providing access to a
26+
* {@linkplain #getEnvelope() SOAP Envelope}. The contents of the SOAP body can be
27+
* retrieved by {@link #getPayloadSource()} and {@link #getPayloadResult()} on
28+
* {@code WebServiceMessage}, the super-interface of this interface.
2929
*
3030
* @author Arjen Poutsma
3131
* @see #getPayloadSource()
@@ -35,7 +35,9 @@
3535
*/
3636
public interface SoapMessage extends MimeMessage, FaultAwareWebServiceMessage {
3737

38-
/** Returns the {@code SoapEnvelope} associated with this {@code SoapMessage}. */
38+
/**
39+
* Returns the {@link SoapEnvelope} associated with this message.
40+
*/
3941
SoapEnvelope getEnvelope() throws SoapEnvelopeException;
4042

4143
/**
@@ -51,15 +53,15 @@ public interface SoapMessage extends MimeMessage, FaultAwareWebServiceMessage {
5153
void setSoapAction(String soapAction);
5254

5355
/**
54-
* Returns the {@code SoapBody} associated with this {@code SoapMessage}. This is a
55-
* convenience method for {@code getEnvelope().getBody()}.
56+
* Returns the {@link SoapBody} associated with this message. This is a convenience
57+
* method for {@code getEnvelope().getBody()}.
5658
* @see SoapEnvelope#getBody()
5759
*/
5860
SoapBody getSoapBody() throws SoapBodyException;
5961

6062
/**
61-
* Returns the {@code SoapHeader} associated with this {@code SoapMessage}. This is a
62-
* convenience method for {@code getEnvelope().getHeader()}.
63+
* Returns the {@link SoapHeader} associated with this message. This is a convenience
64+
* method for {@code getEnvelope().getHeader()}.
6365
* @see SoapEnvelope#getHeader()
6466
*/
6567
SoapHeader getSoapHeader() throws SoapHeaderException;

spring-ws-core/src/main/java/org/springframework/ws/transport/http/CommonsHttpMessageSender.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
* @see HttpClient
5353
* @see #setCredentials(Credentials)
5454
* @since 1.0.0
55-
* @deprecated In favor of {@link HttpComponentsMessageSender}
55+
* @deprecated In favor of {@link HttpComponents5MessageSender}
5656
*/
5757
@Deprecated
5858
public class CommonsHttpMessageSender extends AbstractHttpWebServiceMessageSender

spring-ws-core/src/main/java/org/springframework/ws/transport/http/HttpUrlConnectionMessageSender.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
* execute POST requests, without support for HTTP authentication or advanced
3131
* configuration options.
3232
* <p>
33-
* Consider {@link HttpComponentsMessageSender} for more sophisticated needs: this class
33+
* Consider {@link HttpComponents5MessageSender} for more sophisticated needs: this class
3434
* is rather limited in its capabilities.
3535
*
3636
* @author Arjen Poutsma

spring-ws-docs/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ asciidoctorj {
2727
attributes = [
2828
"allow-uri-read": true,
2929
"numbered": true,
30+
"spring-framework-version": springFrameworkVersion,
31+
"spring-ws-version": project.version,
3032
"toclevels": 4
3133
]
3234
options = [

spring-ws-docs/src/docs/asciidoc/client.adoc

Lines changed: 76 additions & 75 deletions
Large diffs are not rendered by default.

spring-ws-docs/src/docs/asciidoc/common.adoc

Lines changed: 20 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This section describes the messages and message factories that Spring-WS uses.
1313
[[web-service-message]]
1414
=== `WebServiceMessage`
1515

16-
One of the core interfaces of Spring Web Services is the `WebServiceMessage`. This interface represents a protocol-agnostic XML message. The interface contains methods that provide access to the payload of the message, in the form of a `javax.xml.transform.Source` or a `javax.xml.transform.Result`. `Source` and `Result` are tagging interfaces that represent an abstraction over XML input and output. Concrete implementations wrap various XML representations, as indicated in the following table:
16+
One of the core interfaces of Spring-WS is the `WebServiceMessage`. This interface represents a protocol-agnostic XML message. The interface contains methods that provide access to the payload of the message, in the form of a `javax.xml.transform.Source` or a `javax.xml.transform.Result`. `Source` and `Result` are tagging interfaces that represent an abstraction over XML input and output. Concrete implementations wrap various XML representations, as indicated in the following table:
1717

1818
[cols="2", options="header"]
1919
|===
@@ -49,7 +49,7 @@ In addition to reading from and writing to the payload, a web service message ca
4949
[[message-factories]]
5050
=== Message Factories
5151

52-
Concrete message implementations are created by a `WebServiceMessageFactory`. This factory can create an empty message or read a message from an input stream. There are two concrete implementations of `WebServiceMessageFactory`. One is based on SAAJ, the SOAP with Attachments API for Java. The other is based on Axis 2's AXIOM (AXis Object Model).
52+
Concrete message implementations are created by a `WebServiceMessageFactory`. This factory can create an empty message or read a message from an input stream. One concrete implementations of `WebServiceMessageFactory` is provided based on SAAJ, the SOAP with Attachments API for Java.
5353

5454
==== `SaajSoapMessageFactory`
5555

@@ -72,7 +72,7 @@ The `SaajSoapMessageFactory` uses the SOAP with Attachments API for Java (SAAJ)
7272
| SUN Glassfish 1
7373
| 1.3
7474

75-
2+|^1^Weblogic 9 has a known bug in the SAAJ 1.2 implementation: it implements all the 1.2 interfaces but throws an `UnsupportedOperationException` when called. Spring Web Services has a workaround: It uses SAAJ 1.1 when operating on WebLogic 9.
75+
2+|^1^Weblogic 9 has a known bug in the SAAJ 1.2 implementation: it implements all the 1.2 interfaces but throws an `UnsupportedOperationException` when called. Spring-WS has a workaround: It uses SAAJ 1.1 when operating on WebLogic 9.
7676
|===
7777

7878
Additionally, Java SE 6 includes SAAJ 1.3. You can wire up a `SaajSoapMessageFactory` as follows:
@@ -84,35 +84,12 @@ Additionally, Java SE 6 includes SAAJ 1.3. You can wire up a `SaajSoapMessageFac
8484
----
8585
====
8686

87-
NOTE: SAAJ is based on DOM, the Document Object Model. This means that all SOAP messages are stored in memory. For larger SOAP messages, this may not be performant. In that case, the `AxiomSoapMessageFactory` might be more applicable.
88-
89-
==== `AxiomSoapMessageFactory`
90-
91-
The `AxiomSoapMessageFactory` uses the AXis 2 Object Model (AXIOM) to create `SoapMessage` implementations. AXIOM is based on StAX, the Streaming API for XML. StAX provides a pull-based mechanism for reading XML messages, which can be more efficient for larger messages.
92-
93-
To increase reading performance on the `AxiomSoapMessageFactory`, you can set the `payloadCaching` property to false (default is true). Doing so causesthe contents of the SOAP body to be read directly from the socket stream. When this setting is enabled, the payload can be read only once. This means that you have to make sure that any pre-processing (logging or other work) of the message does not consume it.
94-
95-
You can use the `AxiomSoapMessageFactory` as follows:
96-
97-
====
98-
[source,xml]
99-
----
100-
<bean id="messageFactory" class="org.springframework.ws.soap.axiom.AxiomSoapMessageFactory">
101-
<property name="payloadCaching" value="true"/>
102-
</bean>
103-
----
104-
====
105-
106-
In addition to payload caching, AXIOM supports full streaming messages, as defined in the `StreamingWebServiceMessage`. This means that you can directly set the payload on the response message, rather than writing it to a DOM tree or buffer.
107-
108-
Full streaming for AXIOM is used when a handler method returns a JAXB2-supported object. It automatically sets this marshalled object into the response message and writes it out to the outgoing socket stream when the response is going out.
109-
110-
For more information about full streaming, see the class-level Javadoc for `StreamingWebServiceMessage` and `StreamingPayload`.
87+
NOTE: SAAJ is based on DOM, the Document Object Model. This means that all SOAP messages are stored in memory. For larger SOAP messages, this may not be performant.
11188

11289
[[soap_11_or_12]]
11390
==== SOAP 1.1 or 1.2
11491

115-
Both the `SaajSoapMessageFactory` and the `AxiomSoapMessageFactory` have a `soapVersion` property, where you can inject a `SoapVersion` constant. By default, the version is 1.1, but you can set it to 1.2:
92+
`SaajSoapMessageFactory` has a `soapVersion` property, where you can inject a `SoapVersion` constant. By default, the version is 1.1, but you can set it to 1.2:
11693

11794
====
11895
[source,xml]
@@ -149,14 +126,14 @@ One important thing to note with SOAP version numbers (or WS-* specification ver
149126

150127
Typically, messages come in pairs: a request and a response. A request is created on the client-side, which is sent over some transport to the server-side, where a response is generated. This response gets sent back to the client, where it is read.
151128

152-
In Spring Web Services, such a conversation is contained in a `MessageContext`, which has properties to get request and response messages. On the client-side, the message context is created by the <<client-web-service-template,`WebServiceTemplate`>>. On the server-side, the message context is read from the transport-specific input stream. For example, in HTTP, it is read from the `HttpServletRequest`, and the response is written back to the `HttpServletResponse`.
129+
In Spring-WS, such a conversation is contained in a `MessageContext`, which has properties to get request and response messages. On the client-side, the message context is created by the <<client-web-service-template,`WebServiceTemplate`>>. On the server-side, the message context is read from the transport-specific input stream. For example, in HTTP, it is read from the `HttpServletRequest`, and the response is written back to the `HttpServletResponse`.
153130

154131
[[transport-context]]
155132
== `TransportContext`
156133

157134
One of the key properties of the SOAP protocol is that it tries to be transport-agnostic. This is why, for instance, Spring-WS does not support mapping messages to endpoints by HTTP request URL but rather by message content.
158135

159-
However, it is sometimes necessary to get access to the underlying transport, either on the client or the server side. For this, Spring Web Services has the `TransportContext`. The transport context allows access to the underlying `WebServiceConnection`, which typically is a `HttpServletConnection` on the server side or a `HttpUrlConnection` or `CommonsHttpConnection` on the client side. For example, you can obtain the IP address of the current request in a server-side endpoint or interceptor:
136+
However, it is sometimes necessary to get access to the underlying transport, either on the client or the server side. For this, Spring-WS has the `TransportContext`. The transport context allows access to the underlying `WebServiceConnection`, which typically is a `HttpServletConnection` on the server side or a `HttpUrlConnection` or `CommonsHttpConnection` on the client side. For example, you can obtain the IP address of the current request in a server-side endpoint or interceptor:
160137

161138
====
162139
[source,java]
@@ -176,7 +153,7 @@ One of the best ways to handle XML is to use XPath. Quoting <<effective-xml>>, i
176153
[quote, Elliotte Rusty Harold]
177154
XPath is a fourth generation declarative language that allows you to specify which nodes you want to process without specifying exactly how the processor is supposed to navigate to those nodes. XPath's data model is very well designed to support exactly what almost all developers want from XML. For instance, it merges all adjacent text including that in CDATA sections, allows values to be calculated that skip over comments and processing instructions` and include text from child and descendant elements, and requires all external entity references to be resolved. In practice, XPath expressions tend to be much more robust against unexpected but perhaps insignificant changes in the input document.
178155

179-
Spring Web Services has two ways to use XPath within your application: the faster `XPathExpression` or the more flexible `XPathTemplate`.
156+
Spring-WS has two ways to use XPath within your application: the faster `XPathExpression` or the more flexible `XPathOperations`.
180157

181158
[[xpath-expression]]
182159
=== `XPathExpression`
@@ -261,9 +238,9 @@ public class MyXPathClass {
261238
Similar to mapping rows in Spring JDBC's `RowMapper`, each result node is mapped by using an anonymous inner class. In this case, we create a `Contact` object, which we use later on.
262239

263240
[[xpath-template]]
264-
=== `XPathTemplate`
241+
=== `XPathOperations`
265242

266-
The `XPathExpression` lets you evaluate only a single, pre-compiled expression. A more flexible, though slower, alternative is the `XpathTemplate`. This class follows the common template pattern used throughout Spring (`JdbcTemplate`, `JmsTemplate`, and others). The following listing shows an example:
243+
The `XPathExpression` lets you evaluate only a single, pre-compiled expression. A more flexible, though slower, alternative is the `XPathOperations`. This class follows the common template pattern used throughout Spring (`JdbcTemplate`, `JmsTemplate`, and others). The following listing shows an example:
267244

268245
====
269246
[source,java,subs="verbatim,quotes"]
@@ -286,28 +263,27 @@ public class MyXPathClass {
286263
[[logging]]
287264
== Message Logging and Tracing
288265

289-
When developing or debugging a web service, it can be quite useful to look at the content of a (SOAP) message when it arrives or before it is sent. Spring Web Services offer this functionality, through the standard Commons Logging interface.
290-
291-
WARNING: Make sure to use Commons Logging version 1.1 or higher. Earlier versions have class loading issues and do not integrate with the Log4J TRACE level.
266+
When developing or debugging a web service, it can be quite useful to look at the content of a (SOAP) message when it arrives or before it is sent. Spring-WS offer this functionality, through the standard Commons Logging interface.
292267

293268
To log all server-side messages, set the `org.springframework.ws.server.MessageTracing` logger level to `DEBUG` or `TRACE`. On the `DEBUG` level, only the payload root element is logged. On the `TRACE` level, the entire message content is logged. If you want to log only sent messages, use the `org.springframework.ws.server.MessageTracing.sent` logger. Similarly, you can use `org.springframework.ws.server.MessageTracing.received` to log only received messages.
294269

295270
On the client-side, similar loggers exist: `org.springframework.ws.client.MessageTracing.sent` and `org.springframework.ws.client.MessageTracing.received`.
296271

297-
The following example of a `log4j.properties` configuration file logs the full content of sent messages on the client side and only the payload root element for client-side received messages. On the server-side, the payload root is logged for both sent and received messages:
272+
The following example of a `log4j2.properties` configuration file logs the full content of sent messages on the client side and only the payload root element for client-side received messages. On the server-side, the payload root is logged for both sent and received messages:
298273

299274
====
300275
[source]
301276
----
302-
log4j.rootCategory=INFO, stdout
303-
log4j.logger.org.springframework.ws.client.MessageTracing.sent=TRACE
304-
log4j.logger.org.springframework.ws.client.MessageTracing.received=DEBUG
277+
appender.console.name=STDOUT
278+
appender.console.type=Console
279+
appender.console.layout.type=PatternLayout
280+
appender.console.layout.pattern=%-5p [%c{3}] %m%n
305281
306-
log4j.logger.org.springframework.ws.server.MessageTracing=DEBUG
282+
rootLogger=DEBUG,STDOUT
283+
logger.org.springframework.ws.client.MessageTracing.sent=TRACE
284+
logger.org.springframework.ws.client.MessageTracing.received=DEBUG
285+
logger.org.springframework.ws.server.MessageTracing=DEBUG
307286
308-
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
309-
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
310-
log4j.appender.stdout.layout.ConversionPattern=%p [%c{3}] %m%n
311287
----
312288
====
313289

spring-ws-docs/src/docs/asciidoc/index.adoc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
= Spring Web Services Reference Documentation
2-
Arjen Poutsma, Rick Evans, Tareq Abed Rabbo, Greg Turnquist, Jay Bryant, Corneil du Plessis
2+
Arjen Poutsma, Rick Evans, Tareq Abed Rabbo, Greg Turnquist, Jay Bryant, Corneil du Plessis, Stéphane Nicoll
33
:doctype: book
44
:revnumber: {gradle-project-version}
55
:revdate: {localdate}
66
:toc: left
77
:toclevels: 4
88
:source-highlighter: prettify
99
:sectnumlevels: 3
10-
11-
(C) 2005-2020 The original authors.
10+
:docs-site: https://docs.spring.io
11+
:spring-framework-docs-root: {docs-site}/spring-framework/docs
12+
:spring-framework-api: {spring-framework-docs-root}/{spring-framework-version}/javadoc-api/org/springframework
13+
:spring-framework-docs: https://docs.spring.io/spring-framework/reference
14+
:spring-ws-docs-root: {docs-site}/spring-ws/docs
15+
:spring-ws-api: {spring-ws-docs-root}/{spring-ws-version}/api/org/springframework/ws
1216

1317
NOTE: Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically.
1418

@@ -21,7 +25,7 @@ include::preface.adoc[leveloffset=+1]
2125
= I. Introduction
2226
:sectnums:
2327

24-
This first part of the reference documentation <<what-is-spring-ws,is an overview>> of Spring Web Services and the underlying concepts. Spring-WS is then introduced, and <<why-contract-first,the concepts>> behind contract-first web service development are explained.
28+
This first part of the reference documentation <<what-is-spring-ws,is an overview>> of Spring Web Services and the underlying concepts. Then, <<why-contract-first,the concepts>> behind contract-first web service development are explained. Finally, the third section provides <<tutorial,a tutorial>>.
2529

2630
include::what-is-spring-ws.adoc[leveloffset=+1]
2731

spring-ws-docs/src/docs/asciidoc/preface.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
In the current age of Service Oriented Architectures, more and more people use web services to connect previously unconnected systems. Initially, web services were considered to be just another way to do a Remote Procedure Call (RPC). Over time, however, people found out that there is a big difference between RPCs and web services. Especially when interoperability with other platforms is important, it is often better to send encapsulated XML documents that contain all the data necessary to process the request. Conceptually, XML-based web services are better compared to message queues than to remoting solutions. Overall, XML should be considered the platform-neutral representation of data, the _common language_ of SOA. When developing or using web services, the focus should be on this XML and not on Java.
66

7-
Spring Web Services focuses on creating these document-driven web services. Spring Web Services facilitates contract-first SOAP service development, allowing for the creation of flexible web services by using one of the many ways to manipulate XML payloads. Spring-WS provides a powerful <<server,message dispatching framework>>, a <<security,WS-Security>> solution that integrates with your existing application security solution, and a <<client,Client-side API>> that follows the familiar Spring template pattern.
7+
Spring-WS focuses on creating these document-driven web services. Spring-WS facilitates contract-first SOAP service development, allowing for the creation of flexible web services by using one of the many ways to manipulate XML payloads. Spring-WS provides a powerful <<server,message dispatching framework>>, a <<security,WS-Security>> solution that integrates with your existing application security solution, and a <<client,Client-side API>> that follows the familiar Spring template pattern.

0 commit comments

Comments
 (0)