You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ge...@apache.org on 2007/11/12 10:37:47 UTC

svn commit: r594064 - in /incubator/servicemix/trunk/common/servicemix-soap/src: main/java/org/apache/servicemix/soap/marshalers/SoapWriter.java test/java/org/apache/servicemix/soap/marshalers/SoapWriterTest.java

Author: gertv
Date: Mon Nov 12 01:37:47 2007
New Revision: 594064

URL: http://svn.apache.org/viewvc?rev=594064&view=rev
Log:
SM-1119: Encoding problem in HTTP SU response

Added:
    incubator/servicemix/trunk/common/servicemix-soap/src/test/java/org/apache/servicemix/soap/marshalers/SoapWriterTest.java
Modified:
    incubator/servicemix/trunk/common/servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/SoapWriter.java

Modified: incubator/servicemix/trunk/common/servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/SoapWriter.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/common/servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/SoapWriter.java?rev=594064&r1=594063&r2=594064&view=diff
==============================================================================
--- incubator/servicemix/trunk/common/servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/SoapWriter.java (original)
+++ incubator/servicemix/trunk/common/servicemix-soap/src/main/java/org/apache/servicemix/soap/marshalers/SoapWriter.java Mon Nov 12 01:37:47 2007
@@ -98,7 +98,7 @@
             parts = new MimeMultipart("related; type=\"text/xml\"; start=\"<" + SOAP_PART_ID + ">\"");
             return parts.getContentType();
         } else {
-            return "text/xml";
+            return "text/xml;charset=utf-8";
         }
     }
 

Added: incubator/servicemix/trunk/common/servicemix-soap/src/test/java/org/apache/servicemix/soap/marshalers/SoapWriterTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/common/servicemix-soap/src/test/java/org/apache/servicemix/soap/marshalers/SoapWriterTest.java?rev=594064&view=auto
==============================================================================
--- incubator/servicemix/trunk/common/servicemix-soap/src/test/java/org/apache/servicemix/soap/marshalers/SoapWriterTest.java (added)
+++ incubator/servicemix/trunk/common/servicemix-soap/src/test/java/org/apache/servicemix/soap/marshalers/SoapWriterTest.java Mon Nov 12 01:37:47 2007
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+package org.apache.servicemix.soap.marshalers;
+
+import javax.activation.DataHandler;
+
+import junit.framework.TestCase;
+
+public class SoapWriterTest extends TestCase {
+            
+    public void testGetContentTypeSimpleMessage() throws Exception {
+        SoapWriter writer = new SoapWriter(new SoapMarshaler(), new SoapMessage());
+        assertEquals("text/xml;charset=utf-8", writer.getContentType());
+    }
+    
+    public void testGetContentTypeComplexMessage() throws Exception {
+        SoapMessage message = new SoapMessage();
+        DataHandler handler = new DataHandler(new Object(), "mime/type");
+        message.addAttachment("attachment", handler);
+        
+        SoapWriter writer = new SoapWriter(new SoapMarshaler(), message);
+        assertTrue(writer.getContentType().startsWith("multipart/related; type=\"text/xml\""));     
+    }
+}
\ No newline at end of file