cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r531324 - in /incubator/cxf/trunk/rt/bindings/soap/src: main/java/org/apache/cxf/binding/soap/interceptor/ test/java/org/apache/cxf/binding/soap/ test/resources/org/apache/cxf/binding/soap/
Date Mon, 23 Apr 2007 03:45:54 GMT
Author: gawor
Date: Sun Apr 22 20:45:53 2007
New Revision: 531324

URL: http://svn.apache.org/viewvc?view=rev&rev=531324
Log:
soap envelope with bad namespace should result with soap fault with 'version mismatch' fault
code

Added:
    incubator/cxf/trunk/rt/bindings/soap/src/test/resources/org/apache/cxf/binding/soap/test-bad-env.xml
  (with props)
Modified:
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java
    incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/ReadHeaderInterceptorTest.java

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java?view=diff&rev=531324&r1=531323&r2=531324
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java
Sun Apr 22 20:45:53 2007
@@ -78,7 +78,7 @@
                 SoapVersion soapVersion = SoapVersionFactory.getInstance().getSoapVersion(ns);
                 if (soapVersion == null) {
                     throw new SoapFault(new Message("INVALID_VERSION", BUNDLE, ns),
-                                            Soap11.getInstance().getSender());
+                                            Soap11.getInstance().getVersionMismatch());
                 }
                 message.setVersion(soapVersion);
 

Modified: incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/ReadHeaderInterceptorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/ReadHeaderInterceptorTest.java?view=diff&rev=531324&r1=531323&r2=531324
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/ReadHeaderInterceptorTest.java
(original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/ReadHeaderInterceptorTest.java
Sun Apr 22 20:45:53 2007
@@ -49,6 +49,22 @@
         chain.add(rhi);
     }
 
+    public void testBadSOAPEnvelopeNamespace() throws Exception {
+        soapMessage = TestUtil.createEmptySoapMessage(Soap12.getInstance(), chain);
+        InputStream in = getClass().getResourceAsStream("test-bad-env.xml");
+        assertNotNull(in);
+        ByteArrayDataSource bads = new ByteArrayDataSource(in, "test/xml");
+        soapMessage.setContent(InputStream.class, bads.getInputStream());
+
+        ReadHeadersInterceptor r = new ReadHeadersInterceptor();
+        try {
+            r.handleMessage(soapMessage);
+            fail("Did not throw exception");
+        } catch (SoapFault f) {
+            assertEquals(Soap11.getInstance().getVersionMismatch(), f.getFaultCode());
+        }
+    }
+
     public void testHandleHeader() {
         try {
             prepareSoapMessage("test-soap-header.xml");

Added: incubator/cxf/trunk/rt/bindings/soap/src/test/resources/org/apache/cxf/binding/soap/test-bad-env.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/test/resources/org/apache/cxf/binding/soap/test-bad-env.xml?view=auto&rev=531324
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/test/resources/org/apache/cxf/binding/soap/test-bad-env.xml
(added)
+++ incubator/cxf/trunk/rt/bindings/soap/src/test/resources/org/apache/cxf/binding/soap/test-bad-env.xml
Sun Apr 22 20:45:53 2007
@@ -0,0 +1,42 @@
+<!--
+    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.
+-->
+<env:Envelope xmlns:env="http://foobar">
+    <env:Body>
+        <!-- boyd test for processing comment here -->
+        <p:itinerary xmlns:p="http://travelcompany.example.org/reservation/travel">
+            <p:departure>
+                <p:departing>New York</p:departing>
+                <p:arriving>Los Angeles</p:arriving>
+                <p:departureDate>2001-12-14</p:departureDate>
+                <p:departureTime>late afternoon</p:departureTime>
+                <p:seatPreference>aisle</p:seatPreference>
+            </p:departure>
+            <p:return>
+                <p:departing>Los Angeles</p:departing>
+                <p:arriving>New York</p:arriving>
+                <p:departureDate>2001-12-20</p:departureDate>
+                <p:departureTime>mid-morning</p:departureTime>
+                <p:seatPreference />
+            </p:return>
+        </p:itinerary>
+        <q:lodging xmlns:q="http://travelcompany.example.org/reservation/hotels">
+            <q:preference>none</q:preference>
+        </q:lodging>
+    </env:Body>
+</env:Envelope>

Propchange: incubator/cxf/trunk/rt/bindings/soap/src/test/resources/org/apache/cxf/binding/soap/test-bad-env.xml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message