Author: scheu
Date: Tue Sep 21 16:48:06 2010
New Revision: 999495
URL: http://svn.apache.org/viewvc?rev=999495&view=rev
Log:
Axis2-4826
Contributor: Rich Scheuerle
Summary:
Wrote a test to isolate a problem with the marshaller embedding a BOM within
a message.
Provided a fix to the marshaling code to detect this situation and skip the
BOM.
Added:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/datasource/jaxb/BOMOutputStreamFilter.java
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringUTF16Tests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/stringmsg/StringMessageProvider.java
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBDSContext.java
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringUTF16Tests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringUTF16Tests.java?rev=999495&r1=999494&r2=999495&view=diff
==
---
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringUTF16Tests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringUTF16Tests.java
Tue Sep 21 16:48:06 2010
@@ -10,6 +10,7 @@ import javax.xml.ws.WebServiceException;
public class JAXBStringUTF16Tests extends AbstractTestCase {
String axisEndpoint =
"http://localhost:6060/axis2/services/JAXBStringService.JAXBStringPortTypeImplPort";;
+String axis2ProviderEndpoint =
"http://localhost:6060/axis2/services/StringMessageProviderService.StringMessageProviderPort";;
public static Test suite() {
return getTestSetup(new TestSuite(JAXBStringUTF16Tests.class));
@@ -22,6 +23,12 @@ public class JAXBStringUTF16Tests extend
private void runTest16(String value, String value1) {
runTestWithUTF16(value, value1);
}
+
+public void testSimpleString16BOM() throws Exception {
+// Call the Axis2 StringMessageProvider which has a check to ensure
+// that the BOM for UTF-16 is not written inside the message.
+runTestWithEncoding("a simple string", "a simple string", "UTF-16",
axis2ProviderEndpoint);
+}
public void testSimpleString16() throws Exception {
runTest16("a simple string");
@@ -76,13 +83,15 @@ public class JAXBStringUTF16Tests extend
private void runTestWithUTF16(String input, String output) {
runTestWithEncoding(input, output, "UTF-16");
}
-
private void runTestWithEncoding(String input, String output, String
encoding) {
+runTestWithEncoding(input, output, encoding, axisEndpoint);
+}
+private void runTestWithEncoding(String input, String output, String
encoding, String endpoint) {
TestLogger.logger.debug("Test : " + getName());
try {
JAXBStringPortType myPort = (new
JAXBStringService()).getJAXBStringPort();
BindingProvider p = (BindingProvider) myPort;
-
p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
axisEndpoint);
+
p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpoint);
if (encoding != null) {
p.getRequestContext().put(org.apache.axis2.Constants.Configuration.CHARACTER_SET_ENCODING,
encoding);
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/stringmsg/StringMessageProvider.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/stringmsg/StringMessageProvider.java?rev=999495&r1=999494&r2=999495&view=diff
==
---
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/stringmsg/StringMessageProvider.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/stringmsg/StringMessageProvider.java
Tue Sep 21 16:48:06 2010
@@ -23,12 +23,15 @@ import org.apache.axis2.jaxws.TestLogger
import javax.xml.ws.BindingType;
import javax.xml.ws.Provider;
+import javax.xml.ws.Service;
+import javax.xml.ws.ServiceMode;
import javax.xml.ws.WebServiceProvider;
import javax.xml.ws.soap.SOAPBinding;
import javax.xml.ws.http.HTTPBinding;
@WebServiceProvider(serviceName="StringMessageProviderService")
@BindingType(SOAPBinding.SOAP11HTTP_BINDING)
+...@servicemode(value=Service.Mode.MESSAGE)
public class StringMessageProvider implements Provider {
private static String responseGood = "http://schemas.xmlsoap.org/soap/envelope/\";>request
processed";
private st