cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1244822 - in /cxf/branches/2.5.x-fixes/rt: databinding/aegis/src/test/java/org/apache/cxf/aegis/jaxws/ databinding/aegis/src/test/java/org/apache/cxf/aegis/services/ frontend/simple/src/main/java/org/apache/cxf/service/factory/
Date Thu, 16 Feb 2012 01:53:11 GMT
Author: dkulp
Date: Thu Feb 16 01:53:10 2012
New Revision: 1244822

URL: http://svn.apache.org/viewvc?rev=1244822&view=rev
Log:
Merged revisions 1244820 via  git cherry-pick from
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1244820 | dkulp | 2012-02-15 20:50:54 -0500 (Wed, 15 Feb 2012) | 2 lines

  [CXF-4113] Fix problems where header elements may appear twice

........

Modified:
    cxf/branches/2.5.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/jaxws/AegisJaxwsGetTest.java
    cxf/branches/2.5.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/Echo.java
    cxf/branches/2.5.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java

Modified: cxf/branches/2.5.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/jaxws/AegisJaxwsGetTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/jaxws/AegisJaxwsGetTest.java?rev=1244822&r1=1244821&r2=1244822&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/jaxws/AegisJaxwsGetTest.java
(original)
+++ cxf/branches/2.5.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/jaxws/AegisJaxwsGetTest.java
Thu Feb 16 01:53:10 2012
@@ -19,6 +19,12 @@
 
 package org.apache.cxf.aegis.jaxws;
 
+import java.util.HashMap;
+import java.util.Map;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.NodeList;
+
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.HttpMethod;
 import org.apache.commons.httpclient.HttpStatus;
@@ -29,7 +35,9 @@ import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.frontend.ServerFactoryBean;
 import org.apache.cxf.interceptor.AbstractInDatabindingInterceptor;
 import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
+import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.cxf.test.AbstractCXFTest;
+import org.apache.cxf.test.XPathAssert;
 import org.apache.cxf.testutil.common.TestUtil;
 
 import org.junit.Before;
@@ -81,6 +89,19 @@ public class AegisJaxwsGetTest extends A
         String result = method.getResponseBodyAsString();
         assertTrue(result.contains("hello"));
         method.releaseConnection();
+        
+        httpClient = createClient();
+        url = "http://localhost:" + PORT + "/Echo/echo/echo/hello?wsdl";
+        method = new GetMethod(url);
+        status = httpClient.executeMethod(method);
+        assertEquals(HttpStatus.SC_OK, status);
+        Document doc = StaxUtils.read(method.getResponseBodyAsStream());
+        Map<String, String> ns = new HashMap<String, String>();
+        ns.put("xsd", "http://www.w3.org/2001/XMLSchema");
+        NodeList nl = XPathAssert.assertValid("//xsd:element[@name='firstHeader']",
+                                              doc.getDocumentElement(),
+                                              ns);
+        assertEquals(1, nl.getLength());
     }
     @Test
     public void testGetEchoSimple() throws Exception {

Modified: cxf/branches/2.5.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/Echo.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/Echo.java?rev=1244822&r1=1244821&r2=1244822&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/Echo.java
(original)
+++ cxf/branches/2.5.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/Echo.java
Thu Feb 16 01:53:10 2012
@@ -33,4 +33,12 @@ public class Echo {
     public String simpleEcho(String string) {
         return string;
     }
+    @WebMethod
+    public String simpleEchoWithHeaders(
+        @WebParam(name = "firstHeader", header = true) int i,
+        @WebParam(name = "secondHeader", header = true) String s,
+        String string) {
+        
+        return string;
+    }
 }

Modified: cxf/branches/2.5.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?rev=1244822&r1=1244821&r2=1244822&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
(original)
+++ cxf/branches/2.5.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
Thu Feb 16 01:53:10 2012
@@ -1039,15 +1039,14 @@ public class ReflectionServiceFactoryBea
     }
 
     protected void checkForElement(ServiceInfo serviceInfo, MessagePartInfo mpi) {
-        for (SchemaInfo s : serviceInfo.getSchemas()) {
-            XmlSchemaElement e = s.getElementByQName(mpi.getElementQName());
-            if (e != null) {
-                mpi.setXmlSchema(e);
-                return;
-            }
-        }
         SchemaInfo si = getOrCreateSchema(serviceInfo, mpi.getElementQName().getNamespaceURI(),
                                           getQualifyWrapperSchema());
+        XmlSchemaElement e = si.getElementByQName(mpi.getElementQName());
+        e = si.getSchema().getElementByName(mpi.getElementQName().getLocalPart());
+        if (e != null) {
+            mpi.setXmlSchema(e);
+            return;
+        }
         XmlSchema schema = si.getSchema();
         si.setElement(null); //cached element is now invalid
 
@@ -1258,7 +1257,7 @@ public class ReflectionServiceFactoryBea
         ct.setParticle(seq);
 
         for (MessagePartInfo mpi : unwrappedMessage.getMessageParts()) {
-            el = new XmlSchemaElement(schema, false);
+            el = new XmlSchemaElement(schema, Boolean.TRUE.equals(mpi.getProperty(HEADER)));
             // We hope that we can't have parts that different only in namespace.
             el.setName(mpi.getName().getLocalPart());
             Map<Class, Boolean> jaxbAnnoMap = getJaxbAnnoMap(mpi);



Mime
View raw message