You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by wo...@apache.org on 2009/09/05 15:53:09 UTC

svn commit: r811649 - in /webservices/axis2/trunk/java/modules: jaxws-integration/ jaxws-integration/test/org/apache/axis2/jaxws/jaxb/ jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/ jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/...

Author: woodroy
Date: Sat Sep  5 13:53:08 2009
New Revision: 811649

URL: http://svn.apache.org/viewvc?rev=811649&view=rev
Log:
Set a property on the marshaller to enable proper handling of encoding

Added:
    webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/
    webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/
    webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/Echo.java
    webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/EchoResponse.java
    webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringPortType.java
    webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringPortTypeImpl.java
    webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringService.java
    webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringUTF16Tests.java
    webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringUTF8Tests.java
    webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/META-INF/
    webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/META-INF/echostring.wsdl
    webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/ObjectFactory.java
Modified:
    webservices/axis2/trunk/java/modules/jaxws-integration/pom.xml
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBDSContext.java

Modified: webservices/axis2/trunk/java/modules/jaxws-integration/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/pom.xml?rev=811649&r1=811648&r2=811649&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/pom.xml (original)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/pom.xml Sat Sep  5 13:53:08 2009
@@ -1297,7 +1297,21 @@
 								<zip destfile="target/test-classes/servicejars/HandlerHeaderService.jar"
 									basedir="${pom.basedir}/target/test-classes/servicejars/HandlerHeaderService"
 								/>
+								
 								<delete dir="target/test-classes/servicejars/HandlerHeaderService"/>
+								
+                                <copy toDir="target/test-classes/servicejars/JAXBStringService/">
+                                    <fileset dir="target/test-classes">
+                                        <include name="org/apache/axis2/jaxws/jaxb/string/**"/>
+                                    </fileset>
+                                </copy>
+
+                                <zip destfile="target/test-classes/servicejars/JAXBStringService.jar"
+                                     basedir="${pom.basedir}/target/test-classes/servicejars/JAXBStringService"
+                                        />
+                                        
+                                <delete dir="target/test-classes/servicejars/JAXBStringService"/>
+                                
                                 <copy toDir="target/test-classes/servicejars/OMProviderService/">
 									<fileset dir="target/test-classes">
 									   <include name="org/apache/axis2/jaxws/provider/om/**"/>

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/Echo.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/Echo.java?rev=811649&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/Echo.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/Echo.java Sat Sep  5 13:53:08 2009
@@ -0,0 +1,68 @@
+//
+// Generated By:JAX-WS RI IBM 2.1.1 in JDK 6 (JAXB RI IBM JAXB 2.1.3 in JDK 1.6)
+//
+
+
+package org.apache.axis2.jaxws.jaxb.string;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType>
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element name="arg" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *       &lt;/sequence>
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+    "arg"
+})
+@XmlRootElement(name = "echo")
+public class Echo {
+
+    @XmlElement(required = true)
+    protected String arg;
+
+    /**
+     * Gets the value of the arg property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getArg() {
+        return arg;
+    }
+
+    /**
+     * Sets the value of the arg property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setArg(String value) {
+        this.arg = value;
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/EchoResponse.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/EchoResponse.java?rev=811649&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/EchoResponse.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/EchoResponse.java Sat Sep  5 13:53:08 2009
@@ -0,0 +1,68 @@
+//
+// Generated By:JAX-WS RI IBM 2.1.1 in JDK 6 (JAXB RI IBM JAXB 2.1.3 in JDK 1.6)
+//
+
+
+package org.apache.axis2.jaxws.jaxb.string;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType>
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element name="response" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *       &lt;/sequence>
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+    "response"
+})
+@XmlRootElement(name = "echoResponse")
+public class EchoResponse {
+
+    @XmlElement(required = true)
+    protected String response;
+
+    /**
+     * Gets the value of the response property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getResponse() {
+        return response;
+    }
+
+    /**
+     * Sets the value of the response property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setResponse(String value) {
+        this.response = value;
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringPortType.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringPortType.java?rev=811649&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringPortType.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringPortType.java Sat Sep  5 13:53:08 2009
@@ -0,0 +1,35 @@
+//
+// Generated By:JAX-WS RI IBM 2.1.1 in JDK 6 (JAXB RI IBM JAXB 2.1.3 in JDK 1.6)
+//
+
+
+package org.apache.axis2.jaxws.jaxb.string;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.xml.bind.annotation.XmlSeeAlso;
+
+@WebService(name = "JAXBStringPortType", targetNamespace = "http://string.jaxb.jaxws.axis2.apache.org")
+@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
+@XmlSeeAlso({
+    ObjectFactory.class
+})
+public interface JAXBStringPortType {
+
+
+    /**
+     * 
+     * @param echo
+     * @return
+     *     returns org.apache.axis2.jaxws.jaxb.string.EchoResponse
+     */
+    @WebMethod(action = "http://string.jaxb.jaxws.axis2.apache.org/echoString")
+    @WebResult(name = "echoResponse", targetNamespace = "http://string.jaxb.jaxws.axis2.apache.org", partName = "echoResponse")
+    public EchoResponse echoString(
+        @WebParam(name = "echo", targetNamespace = "http://string.jaxb.jaxws.axis2.apache.org", partName = "echo")
+        Echo echo);
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringPortTypeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringPortTypeImpl.java?rev=811649&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringPortTypeImpl.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringPortTypeImpl.java Sat Sep  5 13:53:08 2009
@@ -0,0 +1,14 @@
+package org.apache.axis2.jaxws.jaxb.string;
+
+import javax.jws.WebParam;
+import javax.jws.WebService;
+
+@WebService(serviceName = "JAXBStringService", endpointInterface = "org.apache.axis2.jaxws.jaxb.string.JAXBStringPortType")
+public class JAXBStringPortTypeImpl implements JAXBStringPortType {
+    public EchoResponse echoString(@WebParam(name = "echo", targetNamespace = "http://string.jaxb.jaxws.axis2.apache.org", partName = "echo") Echo echo) {
+        EchoResponse response = new EchoResponse();
+        response.setResponse(echo.getArg());
+        return response;
+    }
+}
+

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringService.java?rev=811649&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringService.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringService.java Sat Sep  5 13:53:08 2009
@@ -0,0 +1,72 @@
+//
+// Generated By:JAX-WS RI IBM 2.1.1 in JDK 6 (JAXB RI IBM JAXB 2.1.3 in JDK 1.6)
+//
+
+
+package org.apache.axis2.jaxws.jaxb.string;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.io.File;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebEndpoint;
+import javax.xml.ws.WebServiceClient;
+import javax.xml.ws.WebServiceFeature;
+
+@WebServiceClient(name = "JAXBStringService", targetNamespace = "http://string.jaxb.jaxws.axis2.apache.org")
+public class JAXBStringService
+    extends Service
+{
+
+    private final static URL JAXBSTRINGSERVICE_WSDL_LOCATION;
+
+    private static String wsdlLocation="/test/org/apache/axis2/jaxws/jaxb/string/META-INF/echostring.wsdl";
+    static {
+        URL url = null;
+        try {
+                try{
+                        String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
+                        wsdlLocation = new File(baseDir + wsdlLocation).getAbsolutePath();
+                }catch(Exception e){
+                        e.printStackTrace();
+                }
+                File file = new File(wsdlLocation);
+                url = file.toURL();
+        } catch (MalformedURLException e) {
+            e.printStackTrace();
+        }
+        JAXBSTRINGSERVICE_WSDL_LOCATION = url;
+    }
+
+    public JAXBStringService(URL wsdlLocation, QName serviceName) {
+        super(wsdlLocation, serviceName);
+    }
+
+    public JAXBStringService() {
+        super(JAXBSTRINGSERVICE_WSDL_LOCATION, new QName("http://string.jaxb.jaxws.axis2.apache.org", "JAXBStringService"));
+    }
+
+    /**
+     * 
+     * @return
+     *     returns JAXBStringPortType
+     */
+    @WebEndpoint(name = "JAXBStringPort")
+    public JAXBStringPortType getJAXBStringPort() {
+        return (JAXBStringPortType)super.getPort(new QName("http://string.jaxb.jaxws.axis2.apache.org", "JAXBStringPort"), JAXBStringPortType.class);
+    }
+
+    /**
+     * 
+     * @param features
+     *     A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy.  Supported features not in the <code>features</code> parameter will have their default values.
+     * @return
+     *     returns JAXBStringPortType
+     */
+    @WebEndpoint(name = "JAXBStringPort")
+    public JAXBStringPortType getJAXBStringPort(WebServiceFeature... features) {
+        return (JAXBStringPortType)super.getPort(new QName("http://string.jaxb.jaxws.axis2.apache.org", "JAXBStringPort"), JAXBStringPortType.class, features);
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringUTF16Tests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringUTF16Tests.java?rev=811649&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringUTF16Tests.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringUTF16Tests.java Sat Sep  5 13:53:08 2009
@@ -0,0 +1,102 @@
+package org.apache.axis2.jaxws.jaxb.string;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.axis2.jaxws.TestLogger;
+import org.apache.axis2.jaxws.framework.AbstractTestCase;
+
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.WebServiceException;
+
+public class JAXBStringUTF16Tests extends AbstractTestCase {
+    String axisEndpoint = "http://localhost:6060/axis2/services/JAXBStringService.JAXBStringPortTypeImplPort";
+
+    public static Test suite() {
+        return getTestSetup(new TestSuite(JAXBStringUTF16Tests.class));
+    }
+
+    private void runTest16(String value) {
+        runTestWithUTF16(value, value);
+    }
+
+    private void runTest16(String value, String value1) {
+        runTestWithUTF16(value, value1);
+    }
+
+    public void testSimpleString16() throws Exception {
+        runTest16("a simple string");
+    }
+
+    public void testStringWithApostrophes16() throws Exception {
+        runTest16("this isn't a simple string");
+    }
+
+    public void testStringWithEntities16() throws Exception {
+        runTest16("&amp;&lt;&gt;&apos;&quot;", "&amp;&lt;&gt;&apos;&quot;");
+    }
+
+    public void testStringWithRawEntities16() throws Exception {
+        runTest16("&<>'\"", "&<>'\"");
+    }
+
+    public void testStringWithLeadingAndTrailingSpaces16() throws Exception {
+        runTest16("          centered          ");
+    }
+
+    public void testWhitespace16() throws Exception {
+        runTest16(" \n \t "); // note: \r fails
+    }
+
+    public void testFrenchAccents16() throws Exception {
+        runTest16("\u00e0\u00e2\u00e4\u00e7\u00e8\u00e9\u00ea\u00eb\u00ee\u00ef\u00f4\u00f6\u00f9\u00fb\u00fc");
+    }
+
+    public void testGermanUmlauts16() throws Exception {
+        runTest16(" Some text \u00df with \u00fc special \u00f6 chars \u00e4.");
+    }
+
+    public void testWelcomeUnicode1_16() throws Exception {
+        // welcome in several languages
+        runTest16(
+                "Chinese (trad.) : \u6b61\u8fce  ");
+    }
+
+    public void testWelcomeUnicode2_16() throws Exception {
+        // welcome in several languages
+        runTest16(
+                "Greek : \u03ba\u03b1\u03bb\u03ce\u03c2 \u03bf\u03c1\u03af\u03c3\u03b1\u03c4\u03b5");
+    }
+
+    public void testWelcomeUnicode3_16() throws Exception {
+        // welcome in several languages
+        runTest16(
+                "Japanese : \u3088\u3046\u3053\u305d");
+    }
+
+    private void runTestWithUTF16(String input, String output) {
+        runTestWithEncoding(input, output, "UTF-16");
+    }
+
+    private void runTestWithEncoding(String input, String output, String encoding) {
+        TestLogger.logger.debug("Test : " + getName());
+        try {
+            JAXBStringPortType myPort = (new JAXBStringService()).getJAXBStringPort();
+            BindingProvider p = (BindingProvider) myPort;
+            p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, axisEndpoint);
+
+            if (encoding != null) {
+                p.getRequestContext().put(org.apache.axis2.Constants.Configuration.CHARACTER_SET_ENCODING, encoding);
+            }
+
+            Echo request = new Echo();
+            request.setArg(input);
+            EchoResponse response = myPort.echoString(request);
+            TestLogger.logger.debug(response.getResponse());
+            assertEquals(output, response.getResponse());
+        } catch (WebServiceException webEx) {
+            webEx.printStackTrace();
+            fail();
+        }
+    }
+}
+

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringUTF8Tests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringUTF8Tests.java?rev=811649&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringUTF8Tests.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringUTF8Tests.java Sat Sep  5 13:53:08 2009
@@ -0,0 +1,97 @@
+package org.apache.axis2.jaxws.jaxb.string;
+
+import org.apache.axis2.jaxws.framework.AbstractTestCase;
+import org.apache.axis2.jaxws.TestLogger;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.WebServiceException;
+
+public class JAXBStringUTF8Tests extends AbstractTestCase {
+    String axisEndpoint = "http://localhost:6060/axis2/services/JAXBStringService.JAXBStringPortTypeImplPort";
+
+    public static Test suite() {
+        return getTestSetup(new TestSuite(JAXBStringUTF8Tests.class));
+    }
+
+    private void runTest(String value) {
+        runTestWithUTF8(value, value);
+    }
+
+    private void runTest(String value, String value1) {
+        runTestWithUTF8(value, value1);
+    }
+
+    public void testSimpleString() throws Exception {
+        runTest("a simple string");
+    }
+
+    public void testStringWithApostrophes() throws Exception {
+        runTest("this isn't a simple string");
+    }
+
+    public void testStringWithEntities() throws Exception {
+        runTest("&amp;&lt;&gt;&apos;&quot;", "&amp;&lt;&gt;&apos;&quot;");
+    }
+
+    public void testStringWithRawEntities() throws Exception {
+        runTest("&<>'\"", "&<>'\"");
+    }
+
+    public void testStringWithLeadingAndTrailingSpaces() throws Exception {
+        runTest("          centered          ");
+    }
+
+    public void testWhitespace() throws Exception {
+        runTest(" \n \t "); // note: \r fails
+    }
+
+    public void testFrenchAccents() throws Exception {
+        runTest("\u00e0\u00e2\u00e4\u00e7\u00e8\u00e9\u00ea\u00eb\u00ee\u00ef\u00f4\u00f6\u00f9\u00fb\u00fc");
+    }
+
+    public void testGermanUmlauts() throws Exception {
+        runTest(" Some text \u00df with \u00fc special \u00f6 chars \u00e4.");
+    }
+
+    public void testWelcomeUnicode1() throws Exception {
+        // welcome in several languages
+        runTest(
+                "Chinese (trad.) : \u6b61\u8fce  ");
+    }
+
+    public void testWelcomeUnicode2() throws Exception {
+        // welcome in several languages
+        runTest(
+                "Greek : \u03ba\u03b1\u03bb\u03ce\u03c2 \u03bf\u03c1\u03af\u03c3\u03b1\u03c4\u03b5");
+    }
+
+    public void testWelcomeUnicode3() throws Exception {
+        // welcome in several languages
+        runTest(
+                "Japanese : \u3088\u3046\u3053\u305d");
+    }
+
+    private void runTestWithUTF8(String input, String output) {
+        runTestWithEncoding(input, output);
+    }
+
+    private void runTestWithEncoding(String input, String output) {
+        TestLogger.logger.debug("Test : " + getName());
+        try {
+            JAXBStringPortType myPort = (new JAXBStringService()).getJAXBStringPort();
+            BindingProvider p = (BindingProvider) myPort;
+            p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, axisEndpoint);
+
+            Echo request = new Echo();
+            request.setArg(input);
+            EchoResponse response = myPort.echoString(request);
+            TestLogger.logger.debug(response.getResponse());
+            assertEquals(output, response.getResponse());
+        } catch (WebServiceException webEx) {
+            webEx.printStackTrace();
+            fail();
+        }
+    }
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/META-INF/echostring.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/META-INF/echostring.wsdl?rev=811649&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/META-INF/echostring.wsdl (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/META-INF/echostring.wsdl Sat Sep  5 13:53:08 2009
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License. You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied. See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://string.jaxb.jaxws.axis2.apache.org" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="JAXBString" targetNamespace="http://string.jaxb.jaxws.axis2.apache.org">
+  <wsdl:types>
+    <xsd:schema targetNamespace="http://string.jaxb.jaxws.axis2.apache.org" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+      <xsd:element name="echoResponse">
+      	<xsd:complexType>
+      		<xsd:sequence>
+      			<xsd:element name="response" type="xsd:string"></xsd:element>
+      		</xsd:sequence>
+      	</xsd:complexType>
+      </xsd:element>
+      <xsd:element name="echo">
+      	<xsd:complexType>
+      		<xsd:sequence>
+      			<xsd:element name="arg" type="xsd:string"></xsd:element>
+      		</xsd:sequence>
+      	</xsd:complexType>
+      </xsd:element>
+    </xsd:schema>
+  </wsdl:types>
+  <wsdl:message name="echoResponse">
+    <wsdl:part element="tns:echoResponse" name="echoResponse"/>
+  </wsdl:message>
+  <wsdl:message name="echo">
+    <wsdl:part element="tns:echo" name="echo"/>
+  </wsdl:message>
+  <wsdl:portType name="JAXBStringPortType">
+    <wsdl:operation name="echoString">
+      <wsdl:input message="tns:echo"/>
+      <wsdl:output message="tns:echoResponse"/>
+    </wsdl:operation>
+  </wsdl:portType>
+  <wsdl:binding name="JAXBStringBinding" type="tns:JAXBStringPortType">
+    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+    <wsdl:operation name="echoString">
+      <soap:operation soapAction="http://string.jaxb.jaxws.axis2.apache.org/echoString"/>
+      <wsdl:input>
+        <soap:body use="literal"/>
+      </wsdl:input>
+      <wsdl:output>
+        <soap:body use="literal"/>
+      </wsdl:output>
+    </wsdl:operation>
+  </wsdl:binding>
+  <wsdl:service name="JAXBStringService">
+    <wsdl:port binding="tns:JAXBStringBinding" name="JAXBStringPort">
+      <soap:address location="http://localhost:6060/axis2/services/EchoService"/>
+    </wsdl:port>
+  </wsdl:service>
+</wsdl:definitions>

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/ObjectFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/ObjectFactory.java?rev=811649&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/ObjectFactory.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/ObjectFactory.java Sat Sep  5 13:53:08 2009
@@ -0,0 +1,52 @@
+//
+// Generated By:JAX-WS RI IBM 2.1.1 in JDK 6 (JAXB RI IBM JAXB 2.1.3 in JDK 1.6)
+//
+
+
+package org.apache.axis2.jaxws.jaxb.string;
+
+import javax.xml.bind.annotation.XmlRegistry;
+
+
+/**
+ * This object contains factory methods for each 
+ * Java content interface and Java element interface 
+ * generated in the org.apache.axis2.jaxws.jaxb.string package. 
+ * <p>An ObjectFactory allows you to programatically 
+ * construct new instances of the Java representation 
+ * for XML content. The Java representation of XML 
+ * content can consist of schema derived interfaces 
+ * and classes representing the binding of schema 
+ * type definitions, element declarations and model 
+ * groups.  Factory methods for each of these are 
+ * provided in this class.
+ * 
+ */
+@XmlRegistry
+public class ObjectFactory {
+
+
+    /**
+     * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.apache.axis2.jaxws.jaxb.string
+     * 
+     */
+    public ObjectFactory() {
+    }
+
+    /**
+     * Create an instance of {@link EchoResponse }
+     * 
+     */
+    public EchoResponse createEchoResponse() {
+        return new EchoResponse();
+    }
+
+    /**
+     * Create an instance of {@link Echo }
+     * 
+     */
+    public Echo createEcho() {
+        return new Echo();
+    }
+
+}

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBDSContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBDSContext.java?rev=811649&r1=811648&r2=811649&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBDSContext.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBDSContext.java Sat Sep  5 13:53:08 2009
@@ -328,6 +328,16 @@
             // Very easy, use the Context to get the Marshaller.
             // Use the marshaller to write the object.
             Marshaller m = JAXBUtils.getJAXBMarshaller(getJAXBContext(cl));
+            if (writer instanceof MTOMXMLStreamWriter && ((MTOMXMLStreamWriter) writer).getOutputFormat() != null) {
+                String encoding = ((MTOMXMLStreamWriter) writer).getOutputFormat().getCharSetEncoding();
+                if (encoding != null && !"UTF-8".equalsIgnoreCase(encoding)) {
+                    if (log.isDebugEnabled()) {
+                        log.debug("Setting the Marshaller.JAXB_ENCODING to " + encoding);
+                    }
+    
+                    m.setProperty(Marshaller.JAXB_ENCODING, encoding);
+                }
+            }
             
             AttachmentMarshaller am = createAttachmentMarshaller(writer);
             if (am != null) {