1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.springframework.ws.test.client;
18
19 import java.io.IOException;
20 import java.net.URI;
21
22 import org.springframework.ws.WebServiceMessage;
23 import org.springframework.ws.soap.SoapBody;
24 import org.springframework.ws.soap.SoapMessage;
25
26 import static org.springframework.ws.test.support.AssertionErrors.fail;
27
28
29
30
31
32
33
34 abstract class SoapFaultResponseCreator extends AbstractResponseCreator {
35
36 @Override
37 protected void doWithResponse(URI uri, WebServiceMessage request, WebServiceMessage response) throws IOException {
38 if (!(response instanceof SoapMessage)) {
39 fail("Response is not a SOAP message");
40 return;
41 }
42 SoapMessage soapResponse = (SoapMessage) response;
43 SoapBody responseBody = soapResponse.getSoapBody();
44 if (responseBody == null) {
45 fail("SOAP message [" + response + "] does not contain SOAP body");
46 }
47 addSoapFault(responseBody);
48 }
49
50
51
52
53
54
55 protected abstract void addSoapFault(SoapBody soapBody);
56 }