Author: jbonofre
Date: Sun Dec 12 08:23:53 2010
New Revision: 1044772

URL: http://svn.apache.org/viewvc?rev=1044772&view=rev
Log:
[SMXCOMP-675] Add content type support in ERROR and FAULT messages.

Modified:
    
servicemix/components/trunk/bindings/servicemix-http/src/main/java/org/apache/servicemix/http/endpoints/HttpSoapConsumerMarshaler.java

Modified: 
servicemix/components/trunk/bindings/servicemix-http/src/main/java/org/apache/servicemix/http/endpoints/HttpSoapConsumerMarshaler.java
URL: 
http://svn.apache.org/viewvc/servicemix/components/trunk/bindings/servicemix-http/src/main/java/org/apache/servicemix/http/endpoints/HttpSoapConsumerMarshaler.java?rev=1044772&r1=1044771&r2=1044772&view=diff
==============================================================================
--- 
servicemix/components/trunk/bindings/servicemix-http/src/main/java/org/apache/servicemix/http/endpoints/HttpSoapConsumerMarshaler.java
 (original)
+++ 
servicemix/components/trunk/bindings/servicemix-http/src/main/java/org/apache/servicemix/http/endpoints/HttpSoapConsumerMarshaler.java
 Sun Dec 12 08:23:53 2010
@@ -137,6 +137,12 @@ public class HttpSoapConsumerMarshaler e
 
     public void sendError(MessageExchange exchange, Exception error, 
HttpServletRequest request, HttpServletResponse response) throws Exception {
         addResponseHeaders(exchange, request, response);
+        // the content type is specific to this marshaler, depending of the 
used SOAP version
+        if (soapVersion.equals("1.1")) {
+            response.setContentType("text/xml");
+        } else {
+            response.setContentType("application/soap+xml");
+        }
         response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
         Message in = (Message) request.getAttribute(Message.class.getName());
         Message msg = binding.createMessage(in);
@@ -159,9 +165,12 @@ public class HttpSoapConsumerMarshaler e
 
     public void sendFault(MessageExchange exchange, Fault fault, 
HttpServletRequest request, HttpServletResponse response) throws Exception {
         addResponseHeaders(exchange, request, response);
-        // the content type is specific to this marshaler
-        // TODO the following content type is only valid for SOAP 1.2, SOAP 
1.1 should use text/xml
-        response.setContentType("application/soap+xml");
+        // the content type is specific to this marshaler, depending of the 
used SOAP version
+        if (soapVersion.equals("1.1")) {
+            response.setContentType("text/xml");
+        } else {
+            response.setContentType("application/soap+xml");
+        }
         response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
         Message in = (Message) request.getAttribute(Message.class.getName());
         Message msg = binding.createMessage(in);


Reply via email to