Author: mmao
Date: Thu Sep 13 21:36:18 2007
New Revision: 575529

URL: http://svn.apache.org/viewvc?rev=575529&view=rev
Log:
CXF-1001
 * Fix the out of band header if the number of parameter of the wrapper child 
is zero


Added:
    
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1001.wsdl
Modified:
    
incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
    
incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java

Modified: 
incubator/cxf/trunk/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/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java?rev=575529&r1=575528&r2=575529&view=diff
==============================================================================
--- 
incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
 (original)
+++ 
incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
 Thu Sep 13 21:36:18 2007
@@ -186,7 +186,8 @@
         MessagePartInfo part = inputParts.iterator().next();
 
         List<QName> wrappedElements = 
ProcessorUtil.getWrappedElementQNames(context, part.getElementQName());
-        if (wrappedElements == null || wrappedElements.size() == 0) {
+        if ((wrappedElements == null || wrappedElements.size() == 0) 
+            && countOutOfBandHeader(inputMessage) == 0) {
             return;
         }
         boolean isSchemaQualified = 
ProcessorUtil.isSchemaFormQualified(context, part.getElementQName());
@@ -201,9 +202,9 @@
         }
 
         // Adding out of band headers
-        if (countOutOfBandHeader(inputMessage) > 0) {
+        if (requireOutOfBandHeader() && countOutOfBandHeader(inputMessage) > 
0) {
             for (MessagePartInfo hpart : inputMessage.getMessageParts()) {
-                if (!isOutOfBandHeader(hpart) || !requireOutOfBandHeader()) {
+                if (!isOutOfBandHeader(hpart)) {
                     continue;
                 }
                 addParameter(method, getParameterFromPart(hpart, 
JavaType.Style.IN));

Modified: 
incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
URL: 
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java?rev=575529&r1=575528&r2=575529&view=diff
==============================================================================
--- 
incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
 (original)
+++ 
incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
 Thu Sep 13 21:36:18 2007
@@ -694,7 +694,7 @@
         }
     }
 
-    @Test()
+    @Test
     public void testAsyncImplAndClient() throws Exception {
         //CXF994
         env.put(ToolConstants.CFG_COMPILE, "compile");
@@ -705,5 +705,23 @@
         env.put(ToolConstants.CFG_BINDING, 
getLocation("/wsdl2java_wsdl/cxf994/async.xml"));
         processor.setContext(env);
         processor.execute();
+    }
+
+    @Test
+    public void testZeroInputOutOfBandHeader() throws Exception {
+        env.put(ToolConstants.CFG_COMPILE, "compile");
+        env.put(ToolConstants.CFG_WSDLURL, 
getLocation("/wsdl2java_wsdl/cxf1001.wsdl"));
+        env.put(ToolConstants.CFG_EXTRA_SOAPHEADER, "TRUE");
+        env.put(ToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
+        env.put(ToolConstants.CFG_CLASSDIR, output.getCanonicalPath() + 
"/classes");
+        env.put(ToolConstants.CFG_CLIENT, ToolConstants.CFG_CLIENT);
+
+        processor.setContext(env);
+        processor.execute();
+
+        String results = getStringFromFile(new File(output.getCanonicalPath(), 
+                                                    
"soapinterface/ems/esendex/com/AccountServiceSoap.java"));
+        assertTrue(results.indexOf("public  int  getMessageLimit") != -1);
+        assertTrue(results.indexOf("header  =  true,  name  =  
\"MessengerHeader") != -1);
     }
 }

Added: 
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1001.wsdl
URL: 
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1001.wsdl?rev=575529&view=auto
==============================================================================
--- 
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1001.wsdl
 (added)
+++ 
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1001.wsdl
 Thu Sep 13 21:36:18 2007
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  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.
+-->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; 
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"; 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"; 
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"; 
xmlns:tns="com.esendex.ems.soapinterface" 
xmlns:s="http://www.w3.org/2001/XMLSchema"; 
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"; 
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"; 
targetNamespace="com.esendex.ems.soapinterface" 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";>
+    <wsdl:types>
+       <s:schema elementFormDefault="qualified" 
targetNamespace="com.esendex.ems.soapinterface">
+           <s:element name="GetMessageLimit">
+               <s:complexType />
+
+           </s:element>
+           <s:element name="GetMessageLimitResponse">
+               <s:complexType>
+                   <s:sequence>
+                       <s:element minOccurs="1" maxOccurs="1" 
name="GetMessageLimitResult" type="s:int" />
+                   </s:sequence>
+               </s:complexType>
+           </s:element>
+           <s:element name="MessengerHeader" type="tns:MessengerHeader" />
+
+           <s:complexType name="MessengerHeader">
+               <s:sequence>
+                   <s:element minOccurs="0" maxOccurs="1" name="Username" 
type="s:string" />
+                   <s:element minOccurs="0" maxOccurs="1" name="Password" 
type="s:string" />
+                   <s:element minOccurs="0" maxOccurs="1" name="Account" 
type="s:string" />
+               </s:sequence>
+               <s:anyAttribute />
+           </s:complexType>
+       </s:schema>
+
+    </wsdl:types>
+    <wsdl:message name="GetMessageLimitSoapIn">
+       <wsdl:part name="parameters" element="tns:GetMessageLimit" />
+    </wsdl:message>
+    <wsdl:message name="GetMessageLimitSoapOut">
+       <wsdl:part name="parameters" element="tns:GetMessageLimitResponse" />
+    </wsdl:message>
+    <wsdl:message name="GetMessageLimitMessengerHeader">
+       <wsdl:part name="MessengerHeader" element="tns:MessengerHeader" />
+
+    </wsdl:message>
+    <wsdl:portType name="AccountServiceSoap">
+       <wsdl:operation name="GetMessageLimit">
+           <wsdl:input message="tns:GetMessageLimitSoapIn" />
+           <wsdl:output message="tns:GetMessageLimitSoapOut" />
+       </wsdl:operation>
+    </wsdl:portType>
+    <wsdl:binding name="AccountServiceSoap" type="tns:AccountServiceSoap">
+       <soap:binding transport="http://schemas.xmlsoap.org/soap/http"; />
+       <wsdl:operation name="GetMessageLimit">
+           <soap:operation 
soapAction="com.esendex.ems.soapinterface/GetMessageLimit" style="document" />
+           <wsdl:input>
+               <soap:body use="literal" />
+               <soap:header message="tns:GetMessageLimitMessengerHeader" 
part="MessengerHeader" use="literal" />
+           </wsdl:input>
+
+           <wsdl:output>
+               <soap:body use="literal" />
+           </wsdl:output>
+       </wsdl:operation>
+    </wsdl:binding>
+
+    <wsdl:service name="AccountService">
+       <wsdl:port name="AccountServiceSoap" binding="tns:AccountServiceSoap">
+           <soap:address 
location="https://www.esendex.com/secure/messenger/soap/AccountService.asmx"; />
+       </wsdl:port>
+    </wsdl:service>
+</wsdl:definitions>
\ No newline at end of file


Reply via email to