cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r650567 - in /incubator/cxf/branches/2.0.x-fixes: ./ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/ tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/too...
Date Tue, 22 Apr 2008 16:16:53 GMT
Author: dkulp
Date: Tue Apr 22 09:16:46 2008
New Revision: 650567

URL: http://svn.apache.org/viewvc?rev=650567&view=rev
Log:
Merged revisions 650368 via svnmerge from 
https://svn.apache.org/repos/asf/incubator/cxf/trunk

........
  r650368 | dkulp | 2008-04-21 23:29:21 -0400 (Mon, 21 Apr 2008) | 2 lines
  
  [CXF-1537] Bunch of issues with out-of-band headers
........

Added:
    incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/OutOfBandHeaderBug.wsdl
      - copied unchanged from r650368, incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/OutOfBandHeaderBug.wsdl
Modified:
    incubator/cxf/branches/2.0.x-fixes/   (props changed)
    incubator/cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
    incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/HolderInInterceptor.java
    incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/HolderOutInterceptor.java
    incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
    incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java

Propchange: incubator/cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: incubator/cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java?rev=650567&r1=650566&r2=650567&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
Tue Apr 22 09:16:46 2008
@@ -415,6 +415,24 @@
     private void addOutOfBandParts(final BindingOperationInfo bop, final javax.wsdl.Message
msg,
                                    final SchemaCollection schemas, boolean isInput) {
         MessageInfo minfo = null;
+        int nextId = 0;
+        minfo = bop.getOperationInfo().getInput();
+        if (minfo != null) {
+            for (MessagePartInfo part : minfo.getMessageParts()) {
+                if (part.getIndex() >= nextId) {
+                    nextId = part.getIndex() + 1;
+                }
+            }
+        }
+        minfo = bop.getOperationInfo().getOutput();
+        if (minfo != null) {
+            for (MessagePartInfo part : minfo.getMessageParts()) {
+                if (part.getIndex() >= nextId) {
+                    nextId = part.getIndex() + 1;
+                }
+            }
+        }
+        
         if (isInput) {
             minfo = bop.getOperationInfo().getInput();
         } else {
@@ -424,13 +442,33 @@
         if (minfo == null) {
             minfo = new MessageInfo(null, msg.getQName());
         }
-        buildMessage(minfo, msg, schemas);
+        buildMessage(minfo, msg, schemas, nextId);
 
         // for wrapped style
         OperationInfo unwrapped = bop.getOperationInfo().getUnwrappedOperation();
         if (unwrapped == null) {
             return;
         }
+        nextId = 0;
+        minfo = unwrapped.getInput();
+        if (minfo != null) {
+            for (MessagePartInfo part : minfo.getMessageParts()) {
+                if (part.getIndex() >= nextId) {
+                    nextId = part.getIndex() + 1;
+                }
+            }
+        }
+        minfo = unwrapped.getOutput();
+        if (minfo != null) {
+            for (MessagePartInfo part : minfo.getMessageParts()) {
+                if (part.getIndex() >= nextId) {
+                    nextId = part.getIndex() + 1;
+                }
+            }
+        }
+        
+        
+        
         if (isInput) {
             minfo = unwrapped.getInput();
         } else {
@@ -440,11 +478,13 @@
         if (minfo == null) {
             minfo = new MessageInfo(unwrapped, msg.getQName());
         }
-        buildMessage(minfo, msg, schemas);
+        buildMessage(minfo, msg, schemas, nextId);
     }
 
-    private void buildMessage(MessageInfo minfo, javax.wsdl.Message msg,
-                              SchemaCollection schemas) {
+    private void buildMessage(MessageInfo minfo,
+                              javax.wsdl.Message msg,
+                              SchemaCollection schemas,
+                              int nextId) {
         for (Part part : cast(msg.getParts().values(), Part.class)) {
             MessagePartInfo pi = minfo.addMessagePart(new QName(minfo.getName().getNamespaceURI(),
part
                                                                 .getName()));
@@ -459,6 +499,8 @@
             }
             pi.setProperty(OUT_OF_BAND_HEADER, Boolean.TRUE);
             pi.setProperty(HEADER, Boolean.TRUE);
+            pi.setIndex(nextId);
+            nextId++;
         }
     }
 

Modified: incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/HolderInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/HolderInInterceptor.java?rev=650567&r1=650566&r2=650567&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/HolderInInterceptor.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/HolderInInterceptor.java
Tue Apr 22 09:16:46 2008
@@ -59,7 +59,7 @@
             List<Holder> outHolders = CastUtils.cast((List)message.getExchange()
                 .getOutMessage().get(CLIENT_HOLDERS));
             for (MessagePartInfo part : parts) {
-                if (part.getIndex() != 0) {
+                if (part.getIndex() != 0 && part.getTypeClass() != null) {
                     Holder holder = (Holder)outHolders.get(part.getIndex() - 1);
                     holder.value = inObjects.get(part);
                     inObjects.put(part, holder);
@@ -68,7 +68,7 @@
         } else {
             for (MessagePartInfo part : parts) {
                 int idx = part.getIndex() - 1;
-                if (idx >= 0) {
+                if (idx >= 0 && part.getTypeClass() != null) {
                     if (idx >= inObjects.size()) {
                         inObjects.set(idx, new Holder<Object>());
                     } else {

Modified: incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/HolderOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/HolderOutInterceptor.java?rev=650567&r1=650566&r2=650567&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/HolderOutInterceptor.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/HolderOutInterceptor.java
Tue Apr 22 09:16:46 2008
@@ -78,7 +78,7 @@
                 }
             }
             for (MessagePartInfo part : parts) {
-                if (part.getIndex() > 0) {
+                if (part.getIndex() > 0 && part.getTypeClass() != null) {
                     Holder holder = (Holder)outObjects.get(part);
                     outObjects.put(part, holder.value);
                 }

Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java?rev=650567&r1=650566&r2=650567&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
Tue Apr 22 09:16:46 2008
@@ -220,40 +220,50 @@
             outputMessage == null ? new ArrayList<MessagePartInfo>() : outputMessage.getMessageParts();
         // figure out output parts that are not present in input parts
         List<MessagePartInfo> outParts = new ArrayList<MessagePartInfo>();
+        int numHeader = 0;
         if (isRequestResponse(method)) {
-
             for (MessagePartInfo outpart : outputParts) {
-                if (isOutOfBandHeader(outpart) && !requireOutOfBandHeader()) {
-                    continue;
+                boolean oob = false;
+                if (isOutOfBandHeader(outpart)) {
+                    if (!requireOutOfBandHeader()) {
+                        continue;
+                    }
+                    oob = true;
                 }
                 
                 MessagePartInfo inpart = inputPartsMap.get(outpart.getName());
                 if (inpart == null) {
                     outParts.add(outpart);
+                    if (oob) {
+                        numHeader++;
+                    }
                     continue;
                 } else if (isSamePart(inpart, outpart)) {
                     addParameter(method, getParameterFromPart(outpart, JavaType.Style.INOUT));
                     continue;
                 } else if (!isSamePart(inpart, outpart)) {
+                    if (oob) {
+                        numHeader++;
+                    }
                     outParts.add(outpart);
                     continue;
                 }
             }
         }
 
-        if (isRequestResponse(method) && outParts.size() == 1) {
-            processReturn(method, outParts.get(0));
-            return;
-        } else {
-            processReturn(method, null);
-        }
         if (isRequestResponse(method)) {
+            if (outParts.size() - numHeader == 1
+                && !isHeader(outParts.get(0))) {
+                processReturn(method, outParts.get(0));
+                outParts.remove(0);
+            } else {
+                processReturn(method, null);
+            }
             for (MessagePartInfo part : outParts) {
-                if (isOutOfBandHeader(part) && !requireOutOfBandHeader()) {
-                    continue;
-                }
                 addParameter(method, getParameterFromPart(part, JavaType.Style.OUT));
             }
+        } else {
+            processReturn(method, null);
         }
     }
 

Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java?rev=650567&r1=650566&r2=650567&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
Tue Apr 22 09:16:46 2008
@@ -209,6 +209,7 @@
     }
 
 
+
     @Test
     public void testHeaderFromAnotherMessage4() throws Exception {
         env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/pizza_wrapped.wsdl"));
@@ -238,6 +239,26 @@
                         fail("No WebParam found!");
                     }
                 }
+            }
+        }
+    }
+
+    @Test
+    public void testHeaderFromAnotherMessage5() throws Exception {
+        env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/OutOfBandHeaderBug.wsdl"));
+        env.put(ToolConstants.CFG_EXTRA_SOAPHEADER, "TRUE");
+        processor.setContext(env);
+        processor.execute();
+
+        assertNotNull(output);
+
+        Class clz = classLoader.loadClass("org.apache.cxf.bugs.oobh.LoginInterface");
+        Method meths[] = clz.getMethods();
+        for (Method m : meths) {
+            if ("login".equals(m.getName())) {
+                assertEquals(String.class, m.getReturnType());
+                assertEquals(2, m.getParameterTypes().length);
+                assertEquals(Holder.class, m.getParameterTypes()[1]);
             }
         }
     }



Mime
View raw message