1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.springframework.ws.soap.saaj;
18
19 import java.util.Locale;
20 import javax.xml.soap.MessageFactory;
21 import javax.xml.soap.SOAPBody;
22 import javax.xml.soap.SOAPConstants;
23 import javax.xml.soap.SOAPMessage;
24
25 import org.springframework.ws.soap.SoapBody;
26 import org.springframework.ws.soap.soap11.AbstractSoap11BodyTestCase;
27
28 public class SaajSoap11BodyTest extends AbstractSoap11BodyTestCase {
29
30 protected SoapBody createSoapBody() throws Exception {
31 MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
32 SOAPMessage saajMessage = messageFactory.createMessage();
33 return new SaajSoap11Body(saajMessage.getSOAPPart().getEnvelope().getBody(), true);
34 }
35
36 public void testLangAttributeOnSoap11FaultString() throws Exception {
37 MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
38 SOAPMessage saajMessage = messageFactory.createMessage();
39
40 SOAPBody saajSoapBody = saajMessage.getSOAPPart().getEnvelope().getBody();
41 SaajSoap11Body soapBody = new SaajSoap11Body(saajSoapBody, true);
42
43 soapBody.addClientOrSenderFault("Foo", Locale.ENGLISH);
44 assertNotNull("No Language set", saajSoapBody.getFault().getFaultStringLocale());
45
46 saajSoapBody = saajMessage.getSOAPPart().getEnvelope().getBody();
47 soapBody = new SaajSoap11Body(saajSoapBody, false);
48
49 soapBody.addClientOrSenderFault("Foo", Locale.ENGLISH);
50 assertNull("Language set", saajSoapBody.getFault().getFaultStringLocale());
51 }
52
53
54 }