cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject svn commit: r466085 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/message/ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ rt/bindings/xml/src/main/java/o...
Date Fri, 20 Oct 2006 12:15:08 GMT
Author: mmao
Date: Fri Oct 20 05:15:06 2006
New Revision: 466085

URL: http://svn.apache.org/viewvc?view=rev&rev=466085
Log:
* Added content-type for soap1.1 soap1.2 and xmlbinding 
* Added fault http status code for soap1.1 soap1.2 and xmlbinding. 
* Should revisit the soap1.2 part.
* Remove system.out from tests.

Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/AbstractWrappedMessage.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap11.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap12.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBinding.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapMessage.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapVersion.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultOutInterceptor.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultOutInterceptor.java
    incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBinding.java
    incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLFaultOutInterceptor.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLWrapTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestClientServerTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/soap12/Soap12ClientServerTest.java

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/AbstractWrappedMessage.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/AbstractWrappedMessage.java?view=diff&rev=466085&r1=466084&r2=466085
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/AbstractWrappedMessage.java
(original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/AbstractWrappedMessage.java
Fri Oct 20 05:15:06 2006
@@ -156,6 +156,5 @@
 
     public Object getContextualProperty(String key) {
         return message.getContextualProperty(key);
-    }
-    
+    }       
 }

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java?view=diff&rev=466085&r1=466084&r2=466085
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java Fri Oct 20 05:15:06
2006
@@ -47,6 +47,7 @@
     String QUERY_STRING = Message.class.getName() + ".QUERY_STRING";
     String MTOM_ENABLED = Message.class.getName() + ".isMtomEnabled";
     String SCHEMA_VALIDATION_ENABLED = Message.class.getCanonicalName() + ".schemaValidationEnabled";
+    String CONTENT_TYPE = Message.class.getName() + ".ContentType";
 
     String getId();
     void setId(String id);
@@ -113,5 +114,5 @@
      */
     <T> void put(Class<T> key, T value);
     
-    Object getContextualProperty(String key);
+    Object getContextualProperty(String key);   
 }

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap11.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap11.java?view=diff&rev=466085&r1=466084&r2=466085
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap11.java
(original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap11.java
Fri Oct 20 05:15:06 2006
@@ -51,7 +51,7 @@
 
     private final QName body = new QName(namespace, "Body", prefix);
 
-    private final QName fault = new QName(namespace, "Fault", prefix);
+    private final QName fault = new QName(namespace, "Fault", prefix);      
 
     private Soap11() {
         // Singleton 
@@ -138,5 +138,9 @@
     public QName getDateEncodingUnknown() {
         // There is no such fault code in soap11
         return null;
+    }
+    
+    public String getContentType() {
+        return "text/xml";
     }
 }

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap12.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap12.java?view=diff&rev=466085&r1=466084&r2=466085
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap12.java
(original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/Soap12.java
Fri Oct 20 05:15:06 2006
@@ -139,5 +139,7 @@
     public QName getDateEncodingUnknown() {
         return new QName(SOAP_NAMESPACE, "DataEncodingUnknown");
     }
-
+    public String getContentType() {
+        return "application/soap+xml";
+    }
 }

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBinding.java?view=diff&rev=466085&r1=466084&r2=466085
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBinding.java
(original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBinding.java
Fri Oct 20 05:15:06 2006
@@ -51,6 +51,7 @@
     public Message createMessage(Message m) {
         SoapMessage soapMessage = new SoapMessage(m);
         soapMessage.setVersion(version);
+        soapMessage.put(Message.CONTENT_TYPE, version.getContentType());
 
         if (mtomEnabled) {
             m.put(Message.MTOM_ENABLED, Boolean.TRUE);

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapMessage.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapMessage.java?view=diff&rev=466085&r1=466084&r2=466085
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapMessage.java
(original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapMessage.java
Fri Oct 20 05:15:06 2006
@@ -51,7 +51,7 @@
     public void setVersion(SoapVersion v) {
         this.version = v;
     }
-
+    
     public <T> boolean hasHeaders(Class<T> format) {
         return headers.containsKey(format);
     }

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapVersion.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapVersion.java?view=diff&rev=466085&r1=466084&r2=466085
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapVersion.java
(original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapVersion.java
Fri Oct 20 05:15:06 2006
@@ -65,4 +65,6 @@
     String getNextRole();
     
     String getSoapMimeType();
+    
+    String getContentType();
 }

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultOutInterceptor.java?view=diff&rev=466085&r1=466084&r2=466085
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultOutInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultOutInterceptor.java
Fri Oct 20 05:15:06 2006
@@ -45,10 +45,12 @@
     }
 
     public void handleMessage(SoapMessage message) throws Fault {
+        message.put(org.apache.cxf.message.Message.RESPONSE_CODE, new Integer(500));
+        
         XMLStreamWriter writer = message.getContent(XMLStreamWriter.class);
         Fault f = (Fault)message.getContent(Exception.class);
 
-        SoapFault fault = SoapFault.createFault(f, message.getVersion());
+        SoapFault fault = SoapFault.createFault(f, message.getVersion());        
 
         try {
             Map<String, String> namespaces = fault.getNamespaces();

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultOutInterceptor.java?view=diff&rev=466085&r1=466084&r2=466085
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultOutInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultOutInterceptor.java
Fri Oct 20 05:15:06 2006
@@ -46,11 +46,13 @@
     }
 
     public void handleMessage(SoapMessage message) throws Fault {
+        message.put(org.apache.cxf.message.Message.RESPONSE_CODE, new Integer(500));
+        
         XMLStreamWriter writer = message.getContent(XMLStreamWriter.class);
         Fault f = (Fault)message.getContent(Exception.class);
 
-        SoapFault fault = SoapFault.createFault(f, message.getVersion());
-
+        SoapFault fault = SoapFault.createFault(f, message.getVersion());       
+        
         try {
             Map<String, String> namespaces = fault.getNamespaces();
             for (Map.Entry<String, String> e : namespaces.entrySet()) {

Modified: incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBinding.java?view=diff&rev=466085&r1=466084&r2=466085
==============================================================================
--- incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBinding.java
(original)
+++ incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBinding.java
Fri Oct 20 05:15:06 2006
@@ -34,6 +34,7 @@
     }
 
     public Message createMessage(Message m) {
+        m.put(Message.CONTENT_TYPE, "text/xml");
         return new XMLMessage(m);
     }
 }

Modified: incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLFaultOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLFaultOutInterceptor.java?view=diff&rev=466085&r1=466084&r2=466085
==============================================================================
--- incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLFaultOutInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/interceptor/XMLFaultOutInterceptor.java
Fri Oct 20 05:15:06 2006
@@ -49,8 +49,8 @@
         setPhase(Phase.MARSHAL);
     }
 
-    public void handleMessage(Message message) throws Fault {
-
+    public void handleMessage(Message message) throws Fault {        
+        message.put(org.apache.cxf.message.Message.RESPONSE_CODE, new Integer(500));
         NSStack nsStack = new NSStack();
         nsStack.push();
 

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java?view=diff&rev=466085&r1=466084&r2=466085
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
(original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
Fri Oct 20 05:15:06 2006
@@ -37,7 +37,6 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.Base64Utility;
@@ -178,6 +177,12 @@
         connection.setConnectTimeout((int)getClient().getConnectionTimeout());
         connection.setReadTimeout((int)getClient().getReceiveTimeout());
         connection.setUseCaches(false);
+        
+        if (null != message.get(Message.CONTENT_TYPE)) {
+            connection.setRequestProperty("Content-Type", (String)message.get(Message.CONTENT_TYPE));
+        } else {
+            connection.setRequestProperty("Content-Type", "text/xml");
+        }
         
         if (connection instanceof HttpURLConnection) {
             String httpRequestMethod = (String)message.get(Message.HTTP_REQUEST_METHOD);

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java?view=diff&rev=466085&r1=466084&r2=466085
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
Fri Oct 20 05:15:06 2006
@@ -21,6 +21,7 @@
 
 import java.lang.reflect.UndeclaredThrowableException;
 import java.net.URL;
+import java.util.Map;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -28,6 +29,7 @@
 
 import javax.xml.namespace.QName;
 import javax.xml.ws.AsyncHandler;
+import javax.xml.ws.BindingProvider;
 import javax.xml.ws.Endpoint;
 import javax.xml.ws.Response;
 import javax.xml.ws.Service;
@@ -35,6 +37,7 @@
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
+import org.apache.cxf.message.Message;
 import org.apache.cxf.systest.common.ClientServerSetupBase;
 import org.apache.cxf.systest.common.ClientServerTestBase;
 import org.apache.cxf.systest.common.TestServerBase;
@@ -117,6 +120,10 @@
         } catch (UndeclaredThrowableException ex) {
             throw (Exception)ex.getCause();
         }
+        BindingProvider bp = (BindingProvider)greeter;
+        Map<String, Object> responseContext = bp.getResponseContext();
+        Integer responseCode = (Integer) responseContext.get(Message.RESPONSE_CODE);    
   
+        assertEquals(200, responseCode.intValue());
     } 
     
     public void testAddPort() throws Exception {
@@ -444,11 +451,17 @@
             try {
                 greeter.testDocLitFault(badRecordFault);
                 fail("Should have thrown BadRecordLitFault exception");
-            } catch (BadRecordLitFault brlf) {
+            } catch (BadRecordLitFault brlf) {                
+                BindingProvider bp = (BindingProvider)greeter;
+                Map<String, Object> responseContext = bp.getResponseContext();
+                String contentType = (String) responseContext.get(Message.CONTENT_TYPE);
+                assertEquals("text/xml", contentType);
+                Integer responseCode = (Integer) responseContext.get(Message.RESPONSE_CODE);
+                assertEquals(500, responseCode.intValue());                
                 assertNotNull(brlf.getFaultInfo());
+                assertEquals("BadRecordLitFault", brlf.getFaultInfo());
             }
         }
-
     } 
 
     public static void main(String[] args) {

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLWrapTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLWrapTest.java?view=diff&rev=466085&r1=466084&r2=466085
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLWrapTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLWrapTest.java
Fri Oct 20 05:15:06 2006
@@ -20,8 +20,10 @@
 package org.apache.cxf.systest.jaxws;
 
 import java.lang.reflect.UndeclaredThrowableException;
+import java.util.Map;
 
 import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
 import javax.xml.ws.Endpoint;
 import javax.xml.ws.Service;
 
@@ -29,6 +31,7 @@
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
+import org.apache.cxf.message.Message;
 import org.apache.cxf.systest.common.ClientServerSetupBase;
 import org.apache.cxf.systest.common.TestServerBase;
 import org.apache.hello_world_xml_http.wrapped.Greeter;
@@ -112,8 +115,8 @@
 
         String response1 = new String("Hello ");
         String response2 = new String("Bonjour");
-        try {
-            Greeter greeter = service.getPort(fakePortName, Greeter.class);
+        Greeter greeter = service.getPort(fakePortName, Greeter.class);
+        try {            
             String username = System.getProperty("user.name");
             String reply = greeter.greetMe(username);
 
@@ -129,21 +132,33 @@
         } catch (UndeclaredThrowableException ex) {
             throw (Exception) ex.getCause();
         }
+        BindingProvider bp = (BindingProvider)greeter;
+        Map<String, Object> responseContext = bp.getResponseContext();
+        Integer responseCode = (Integer) responseContext.get(Message.RESPONSE_CODE);    
   
+        assertEquals(200, responseCode.intValue());                                    
     }
 
     public void testXMLFault() throws Exception {
         XMLService service = new XMLService(
                 this.getClass().getResource("/wsdl/hello_world_xml_wrapped.wsdl"), serviceName);
         assertNotNull(service);
-        try {
-            Greeter greeter = service.getPort(portName, Greeter.class);
+        Greeter greeter = service.getPort(portName, Greeter.class);
+        try {            
             greeter.pingMe();
             fail("did not catch expected PingMeFault exception");
         } catch (PingMeFault ex) {
             assertEquals("minor value", 1, ex.getFaultInfo().getMinor());
             assertEquals("major value", 2, ex.getFaultInfo().getMajor());
+            
+            BindingProvider bp = (BindingProvider)greeter;
+            Map<String, Object> responseContext = bp.getResponseContext();
+            String contentType = (String) responseContext.get(Message.CONTENT_TYPE);
+            assertEquals("text/xml", contentType);
+            Integer responseCode = (Integer) responseContext.get(Message.RESPONSE_CODE);
+            assertEquals(500, responseCode.intValue());                                 
  
         } catch (Exception ex) {
-            fail("did not catch expected PingMeFault exception");
+            assertTrue("did not catch expected PingMeFault exception", 
+                       !(ex instanceof PingMeFault));
         }
     }
 }

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestClientServerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestClientServerTest.java?view=diff&rev=466085&r1=466084&r2=466085
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestClientServerTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestClientServerTest.java
Fri Oct 20 05:15:06 2006
@@ -114,8 +114,7 @@
         requestContext.put(MessageContext.HTTP_REQUEST_METHOD, new String("GET"));
         requestContext.put(MessageContext.QUERY_STRING, "id=1"); 
         //this is the original path part of uri 
-        requestContext.put(MessageContext.PATH_INFO, path);
-        System.out.println("Invoking Restful GET Request with query string ");
+        requestContext.put(MessageContext.PATH_INFO, path);        
         Source result = d.invoke(null);
         assertNotNull("result shoud not be null", result);        
         String tempstring = source2String(result);
@@ -133,21 +132,4 @@
         trans.transform(source, sr);
         return bos.toString();
     }
-
-    void printSource(Source source) {
-        try {
-            ByteArrayOutputStream bos = new ByteArrayOutputStream();
-            StreamResult sr = new StreamResult(bos);
-            Transformer trans = TransformerFactory.newInstance().newTransformer();
-            Properties oprops = new Properties();
-            oprops.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
-            trans.setOutputProperties(oprops);
-            trans.transform(source, sr);
-            System.out.println("**** Response ******" + bos.toString());
-            bos.close();
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
 }

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/soap12/Soap12ClientServerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/soap12/Soap12ClientServerTest.java?view=diff&rev=466085&r1=466084&r2=466085
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/soap12/Soap12ClientServerTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/soap12/Soap12ClientServerTest.java
Fri Oct 20 05:15:06 2006
@@ -22,11 +22,16 @@
 package org.apache.cxf.systest.soap12;
 
 import java.net.URL;
+import java.util.List;
+import java.util.Map;
 
 import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
+
+import org.apache.cxf.message.Message;
 import org.apache.cxf.systest.common.ClientServerSetupBase;
 import org.apache.cxf.systest.common.ClientServerTestBase;
 import org.apache.hello_world_soap12_http.Greeter;
@@ -56,13 +61,18 @@
             String echo = greeter.sayHi();
             assertEquals("Bonjour", echo);
         }
-
+        BindingProvider bp = (BindingProvider)greeter;
+        Map<String, Object> responseContext = bp.getResponseContext();
+        Integer responseCode = (Integer) responseContext.get(Message.RESPONSE_CODE);
+        assertEquals(200, responseCode.intValue());
     }
 
     public void testPingMeFault() throws Exception {
-        Greeter greeter = getGreeter();
+        Greeter greeter = getGreeter();       
+        
         try {
             greeter.pingMe();
+            
             fail("Should throw Exception!");
         } catch (PingMeFault ex) {
             FaultDetail detail = ex.getFaultInfo();
@@ -70,6 +80,16 @@
             assertEquals((short)1, detail.getMinor());
             assertEquals("PingMeFault raised by server", ex.getMessage());            
         }
+        
+        BindingProvider bp = (BindingProvider)greeter;
+        Map<String, Object> responseContext = bp.getResponseContext();
+        String contentType = (String) responseContext.get(Message.CONTENT_TYPE);
+        assertEquals("application/soap+xml", contentType);
+        Integer responseCode = (Integer) responseContext.get(Message.RESPONSE_CODE);
+        assertEquals(500, responseCode.intValue());
+        Map ct = (Map) responseContext.get(Message.PROTOCOL_HEADERS);
+        List contentTypes = (List) ct.get("Content-Type"); 
+        assertTrue(contentTypes.contains("application/soap+xml"));
     }
 
     private Greeter getGreeter() {



Mime
View raw message