01: /*
02: * Copyright 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.soap.saaj;
18:
19: import javax.xml.soap.SOAPBody;
20: import javax.xml.soap.SOAPElement;
21: import javax.xml.transform.Result;
22: import javax.xml.transform.Source;
23:
24: import org.springframework.ws.soap.SoapBody;
25:
26: /**
27: * SAAJ-specific abstract base class of the <code>SoapBody</code> interface. Wraps a {@link javax.xml.soap.SOAPBody}.
28: *
29: * @author Arjen Poutsma
30: * @since 1.0.0
31: */
32: abstract class SaajSoapBody extends SaajSoapElement implements SoapBody {
33:
34: public SaajSoapBody(SOAPBody body) {
35: super (body);
36: }
37:
38: public Source getPayloadSource() {
39: SOAPElement bodyElement = getImplementation()
40: .getFirstBodyElement(getSaajBody());
41: return bodyElement == null ? null : getImplementation()
42: .getSource(bodyElement);
43: }
44:
45: public Result getPayloadResult() {
46: getImplementation().removeContents(getSaajBody());
47: return getImplementation().getResult(getSaajBody());
48: }
49:
50: public boolean hasFault() {
51: return getImplementation().hasFault(getSaajBody());
52: }
53:
54: protected SOAPBody getSaajBody() {
55: return (SOAPBody) getSaajElement();
56: }
57:
58: }
|