cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject svn commit: r554819 [2/2] - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/service/model/ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/ rt/core/src/main/java/org/apache/cxf/binding/ rt/frontend/jaxws/src/main/java/org/apache/cx...
Date Tue, 10 Jul 2007 03:50:18 GMT
Added: incubator/cxf/trunk/tools/anttask/src/main/java/org/apache/cxf/ant/extensions/Java2WSDLTask.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/anttask/src/main/java/org/apache/cxf/ant/extensions/Java2WSDLTask.java?view=auto&rev=554819
==============================================================================
--- incubator/cxf/trunk/tools/anttask/src/main/java/org/apache/cxf/ant/extensions/Java2WSDLTask.java (added)
+++ incubator/cxf/trunk/tools/anttask/src/main/java/org/apache/cxf/ant/extensions/Java2WSDLTask.java Mon Jul  9 20:50:15 2007
@@ -0,0 +1,146 @@
+/**
+ * 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.
+ */
+package org.apache.cxf.ant.extensions;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.tools.java2wsdl.JavaToWSDL;
+import org.apache.tools.ant.AntClassLoader;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Execute;
+import org.apache.tools.ant.taskdefs.LogStreamHandler;
+import org.apache.tools.ant.types.Commandline;
+import org.apache.tools.ant.types.CommandlineJava;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.Reference;
+
+public class Java2WSDLTask extends CxfAntTask {
+
+    private Path classpath;
+
+    private File wsdlDir;
+    private String protocol;
+    private String className;
+
+    public void setGenwsdl(boolean gw) {
+        //the point of this is to gen the wsdl, always do it
+    }
+
+    public Path createClasspath() {
+        if (classpath == null) {
+            classpath = new Path(getProject());
+        }
+        return classpath.createPath();
+    }
+    public void setClasspath(Path c) {
+        if (classpath == null) {
+            classpath = c;
+        } else {
+            classpath.append(c);
+        }
+    }
+    public void setClasspathRef(Reference r) {
+        createClasspath().setRefid(r);
+    }
+
+
+    public void setProtocol(String p) {
+        protocol = p;
+    }
+
+    public void setResourcedestdir(File f) {
+        wsdlDir = f;
+    }
+
+    public void setSei(String clz) {
+        className = clz;
+    }
+
+    public void execute() throws BuildException {
+        buildCommandLine();
+
+        LogStreamHandler log = new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN);
+        Execute exe = new Execute(log);
+        exe.setAntRun(getProject());
+        exe.setCommandline(cmd.getCommandline());
+        try {
+            int rc = exe.execute();
+            if (exe.killedProcess()
+                || rc != 0) {
+                throw new BuildException("java2wsdl failed", getLocation());
+            }
+        } catch (IOException e) {
+            throw new BuildException(e, getLocation());
+        }
+    }
+
+    public void buildCommandLine() {
+        ClassLoader loader = this.getClass().getClassLoader();
+        Path runCp = new Path(getProject());
+        if (loader instanceof AntClassLoader) {
+            runCp = new Path(getProject(), ((AntClassLoader)loader).getClasspath());
+        }
+        cmd.createClasspath(getProject()).append(runCp);
+        cmd.createVmArgument().setLine("-Djava.util.logging.config.file=");
+
+        cmd.setClassname(JavaToWSDL.class.getName());
+
+        if (classpath != null && !classpath.toString().equals("")) {
+            cmd.createArgument().setValue("-cp");
+            cmd.createArgument().setPath(classpath);
+        }
+
+
+        if (null != classesDir
+            && !StringUtils.isEmpty(classesDir.getName())) {
+            cmd.createArgument().setValue("-classdir");
+            cmd.createArgument().setFile(classesDir);
+        }
+        if (null != sourcesDir
+            && !StringUtils.isEmpty(sourcesDir.getName())) {
+            cmd.createArgument().setValue("-s");
+            cmd.createArgument().setFile(sourcesDir);
+        }
+
+        // verbose option
+        if (verbose) {
+            cmd.createArgument().setValue("-verbose");
+        }
+
+        if ("Xsoap1.2".equals(protocol)) {
+            cmd.createArgument().setValue("-soap12");
+        }
+
+        cmd.createArgument().setValue("-createxsdimports");
+
+        if (null != wsdlDir
+            && !StringUtils.isEmpty(wsdlDir.getName())) {
+            cmd.createArgument().setValue("-d");
+            cmd.createArgument().setFile(wsdlDir);
+        }
+
+
+        if (!StringUtils.isEmpty(className)) {
+            cmd.createArgument().setValue(className);
+        }
+    }
+}

Added: incubator/cxf/trunk/tools/anttask/src/main/java/org/apache/cxf/ant/extensions/WSDL2JavaTask.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/anttask/src/main/java/org/apache/cxf/ant/extensions/WSDL2JavaTask.java?view=auto&rev=554819
==============================================================================
--- incubator/cxf/trunk/tools/anttask/src/main/java/org/apache/cxf/ant/extensions/WSDL2JavaTask.java (added)
+++ incubator/cxf/trunk/tools/anttask/src/main/java/org/apache/cxf/ant/extensions/WSDL2JavaTask.java Mon Jul  9 20:50:15 2007
@@ -0,0 +1,125 @@
+/**
+ * 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.
+ */
+package org.apache.cxf.ant.extensions;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.tools.wsdlto.WSDLToJava;
+import org.apache.tools.ant.AntClassLoader;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.Execute;
+import org.apache.tools.ant.taskdefs.LogStreamHandler;
+import org.apache.tools.ant.types.Commandline;
+import org.apache.tools.ant.types.CommandlineJava;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+
+public class WSDL2JavaTask extends CxfAntTask{
+
+    private String wsdlLocation;
+    private String wsdl;
+    private Set<File> bindingFiles = new HashSet<File>();
+
+    public void setWsdlLocation(String w) {
+        wsdlLocation = w;
+    }
+    public void setWsdl(String w) {
+        wsdl = w;
+    }
+    public void addConfiguredBinding(FileSet fs) {
+        DirectoryScanner ds = fs.getDirectoryScanner(getProject());
+        String[] includedFiles = ds.getIncludedFiles();
+        File baseDir = ds.getBasedir();
+        for (int i = 0; i < includedFiles.length; ++i) {
+            bindingFiles.add(new File(baseDir, includedFiles[i]));
+        }
+    }
+
+    public void execute() throws BuildException {
+        buildCommandLine();
+
+        LogStreamHandler log = new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN);
+        Execute exe = new Execute(log);
+        exe.setAntRun(getProject());
+        exe.setCommandline(cmd.getCommandline());
+        try {
+            int rc = exe.execute();
+            if (exe.killedProcess()
+                || rc != 0) {
+                throw new BuildException("wsdl2java failed", getLocation());
+            }
+        } catch (IOException e) {
+            throw new BuildException(e, getLocation());
+        }
+    }
+
+    private void buildCommandLine() {
+        ClassLoader loader = this.getClass().getClassLoader();
+        Path classpath = new Path(getProject());
+        if (loader instanceof AntClassLoader) {
+            classpath = new Path(getProject(), ((AntClassLoader)loader).getClasspath());
+        }
+        cmd.createClasspath(getProject()).append(classpath);
+        cmd.createVmArgument().setLine("-Djava.util.logging.config.file=");
+
+        cmd.setClassname(WSDLToJava.class.getName());
+
+
+        if (null != classesDir
+            && !StringUtils.isEmpty(classesDir.getName())) {
+            cmd.createArgument().setValue("-classdir");
+            cmd.createArgument().setFile(classesDir);
+            cmd.createArgument().setValue("-compile");
+        }
+        if (null != sourcesDir
+            && !StringUtils.isEmpty(sourcesDir.getName())) {
+            cmd.createArgument().setValue("-d");
+            cmd.createArgument().setFile(sourcesDir);
+        }
+
+        // verbose option
+        if (verbose) {
+            cmd.createArgument().setValue("-verbose");
+        }
+
+        if (!bindingFiles.isEmpty()) {
+            for (File b : bindingFiles) {
+                cmd.createArgument().setValue("-b");
+                cmd.createArgument().setFile(b);
+            }
+        }
+
+        if (!StringUtils.isEmpty(wsdlLocation)) {
+            cmd.createArgument().setValue("-wsdlLocation");
+            cmd.createArgument().setValue(wsdlLocation);
+        }
+
+        // wsdl
+        if (!StringUtils.isEmpty(wsdl)) {
+            cmd.createArgument().setValue(wsdl);
+        }
+    }
+}
\ No newline at end of file

Added: incubator/cxf/trunk/tools/anttask/src/main/java/org/apache/cxf/ant/extensions/antlib.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/anttask/src/main/java/org/apache/cxf/ant/extensions/antlib.xml?view=auto&rev=554819
==============================================================================
--- incubator/cxf/trunk/tools/anttask/src/main/java/org/apache/cxf/ant/extensions/antlib.xml (added)
+++ incubator/cxf/trunk/tools/anttask/src/main/java/org/apache/cxf/ant/extensions/antlib.xml Mon Jul  9 20:50:15 2007
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!--
+  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.
+-->
+
+<antlib>
+    <taskdef name="wsdl2java"
+             classname="org.apache.cxf.ant.extensions.WSDL2JavaTask"/>
+    <taskdef name="java2wsdl"
+             classname="org.apache.cxf.ant.extensions.Java2WSDLTask"/>
+</antlib>
\ No newline at end of file

Modified: incubator/cxf/trunk/tools/eclipse-plugin/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/eclipse-plugin/pom.xml?view=diff&rev=554819&r1=554818&r2=554819
==============================================================================
--- incubator/cxf/trunk/tools/eclipse-plugin/pom.xml (original)
+++ incubator/cxf/trunk/tools/eclipse-plugin/pom.xml Mon Jul  9 20:50:15 2007
@@ -86,6 +86,12 @@
 
         <dependency>
             <groupId>${pom.groupId}</groupId>
+            <artifactId>cxf-rt-transports-jms</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>${pom.groupId}</groupId>
             <artifactId>cxf-tools-java2wsdl</artifactId>
             <version>${project.version}</version>
             <exclusions>

Modified: incubator/cxf/trunk/tools/javato/test/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/test/pom.xml?view=diff&rev=554819&r1=554818&r2=554819
==============================================================================
--- incubator/cxf/trunk/tools/javato/test/pom.xml (original)
+++ incubator/cxf/trunk/tools/javato/test/pom.xml Mon Jul  9 20:50:15 2007
@@ -6,9 +6,9 @@
     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
@@ -166,11 +166,11 @@
                                     <wsdl>${basedir}/src/test/resources/java2wsdl_wsdl/hello_world_soap12.wsdl</wsdl>
                                 </wsdlOption>
                                 <wsdlOption>
-				    <wsdl>${basedir}/src/test/resources/java2wsdl_wsdl/hello_world_bare.wsdl</wsdl>
+                                    <wsdl>${basedir}/src/test/resources/java2wsdl_wsdl/hello_world_bare.wsdl</wsdl>
                                 </wsdlOption>
                                 <wsdlOption>
-				    <wsdl>${basedir}/src/test/resources/java2wsdl_wsdl/hello_world_fault.wsdl</wsdl>
-                                </wsdlOption>                                
+                                    <wsdl>${basedir}/src/test/resources/java2wsdl_wsdl/hello_world_fault.wsdl</wsdl>
+                                </wsdlOption>
                             </wsdlOptions>
                         </configuration>
                         <goals>

Modified: incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java?view=diff&rev=554819&r1=554818&r2=554819
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java Mon Jul  9 20:50:15 2007
@@ -320,10 +320,6 @@
             }
         }
 
-        if (!env.optionSet(ToolConstants.CFG_EXTRA_SOAPHEADER)) {
-            env.put(ToolConstants.CFG_EXTRA_SOAPHEADER, "false");
-        }
-
         if (env.optionSet(ToolConstants.CFG_COMPILE)) {
             String clsdir = (String)env.get(ToolConstants.CFG_CLASSDIR);
             if (clsdir != null) {
@@ -471,7 +467,7 @@
         return false;
     }
 
-    public void generateTypes() throws ToolException {        
+    public void generateTypes() throws ToolException {
         DataBindingProfile dataBindingProfile = context.get(DataBindingProfile.class);
         if (dataBindingProfile == null) {
             Message msg = new Message("FOUND_NO_DATABINDING", LOG);

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml?view=diff&rev=554819&r1=554818&r2=554819
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml (original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml Mon Jul  9 20:50:15 2007
@@ -7,9 +7,9 @@
   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

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/Messages.properties
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/Messages.properties?view=diff&rev=554819&r1=554818&r2=554819
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/Messages.properties (original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/Messages.properties Mon Jul  9 20:50:15 2007
@@ -46,9 +46,10 @@
 
 SKIP_OVERLOADED_OPERATION=Skipping overloaded operation: {0}
 NO_INPUT_MESSAGE=Problem outputting method for {0} as no input message was found for input named {1}
-FAIL_TO_GET_WSDL = Can not get WSDL location from {0} 
-BINDING_STYLE_NOT_DEFINED = Operation binding style must be defined 
+FAIL_TO_GET_WSDL = Can not get WSDL location from {0}
+BINDING_STYLE_NOT_DEFINED = Operation binding style must be defined
 
-RPC_PART_ILLEGAL = Message Part {0} does not use type reference not confirm to RPC style   
+RPC_PART_ILLEGAL = Message Part {0} does not use type reference not confirm to RPC style
 
 
+NO_SOAP_HEADER_MESSAGE = Can not load soap header message from the service model, check if the soap binding is in classpath
\ No newline at end of file

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?view=diff&rev=554819&r1=554818&r2=554819
==============================================================================
--- 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 Mon Jul  9 20:50:15 2007
@@ -31,6 +31,7 @@
 import org.apache.cxf.jaxb.JAXBUtils;
 import org.apache.cxf.service.model.MessageInfo;
 import org.apache.cxf.service.model.MessagePartInfo;
+import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolContext;
 import org.apache.cxf.tools.common.ToolException;
 import org.apache.cxf.tools.common.model.JavaMethod;
@@ -42,9 +43,11 @@
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.mapper.ParameterMapper;
 
 public class ParameterProcessor extends AbstractProcessor {
-    
+    public static final String HEADER = "messagepart.isheader";
+    public static final String OUT_OF_BAND_HEADER = "messagepart.is_out_of_band_header";
+
     private DataBindingProfile dataBinding;
-    
+
     @SuppressWarnings("unchecked")
     public ParameterProcessor(ToolContext penv) {
         super(penv);
@@ -59,11 +62,11 @@
                         MessageInfo inputMessage,
                         MessageInfo outputMessage,
                         List<String> parameterOrder) throws ToolException {
-        
+
         if (!StringUtils.isEmpty(parameterOrder)
             && isValidOrdering(parameterOrder, inputMessage, outputMessage)
             && !method.isWrapperStyle()) {
-            
+
             buildParamModelsWithOrdering(method,
                                          inputMessage,
                                          outputMessage,
@@ -78,7 +81,7 @@
     /**
      * This method will be used by binding processor to change existing
      * generated java method of porttype
-     * 
+     *
      * @param method
      * @param part
      * @param style
@@ -105,12 +108,12 @@
     private void processReturn(JavaMethod method, MessagePartInfo part) {
         String name = part == null ? "return" : part.getName().getLocalPart();
         String type = part == null ? "void" : ProcessorUtil.resolvePartType(part, context);
- 
+
         String namespace = part == null ? null : ProcessorUtil.resolvePartNamespace(part);
-              
+
         JavaReturn returnType = new JavaReturn(name, type, namespace);
-        
-        
+
+
         returnType.setQName(ProcessorUtil.getElementName(part));
         returnType.setStyle(JavaType.Style.OUT);
         if (namespace != null && type != null && !"void".equals(type)) {
@@ -119,17 +122,29 @@
         method.setReturn(returnType);
     }
 
+    private boolean isOutOfBandHeader(final MessagePartInfo part) {
+        return Boolean.TRUE.equals(part.getProperty(OUT_OF_BAND_HEADER));
+    }
+
+    private boolean requireOutOfBandHeader() {
+        String value = (String)context.get(ToolConstants.CFG_EXTRA_SOAPHEADER);
+        return StringUtils.isEmpty(value) || Boolean.valueOf(value).booleanValue();
+    }
+
     @SuppressWarnings("unchecked")
     private void processInput(JavaMethod method, MessageInfo inputMessage) throws ToolException {
         for (MessagePartInfo part : inputMessage.getMessageParts()) {
+            if (isOutOfBandHeader(part) && !requireOutOfBandHeader()) {
+                continue;
+            }
             addParameter(method, getParameterFromPart(part, JavaType.Style.IN));
         }
     }
-    
+
     @SuppressWarnings("unchecked")
     private void processWrappedInput(JavaMethod method, MessageInfo inputMessage) throws ToolException {
         List<MessagePartInfo> inputParts = inputMessage.getMessageParts();
-        
+
         if (inputParts.size() > 1) {
             processInput(method, inputMessage);
             return;
@@ -137,19 +152,19 @@
             return;
         }
         MessagePartInfo part = inputParts.iterator().next();
-        
+
         List<QName> wrappedElements = ProcessorUtil.getWrappedElement(context, part.getElementQName());
         if (wrappedElements == null || wrappedElements.size() == 0) {
             return;
         }
         boolean isSchemaQualified = ProcessorUtil.isSchemaFormQualified(context, part.getElementQName());
         for (QName item : wrappedElements) {
-            JavaParameter jp = getParameterFromQName(part.getElementQName(), 
+            JavaParameter jp = getParameterFromQName(part.getElementQName(),
                                   item, JavaType.Style.IN, part);
             if (!isSchemaQualified) {
                 jp.setTargetNamespace("");
             }
-            
+
             addParameter(method, jp);
         }
     }
@@ -158,7 +173,7 @@
     private void processOutput(JavaMethod method, MessageInfo inputMessage, MessageInfo outputMessage)
         throws ToolException {
         Map<QName, MessagePartInfo> inputPartsMap = inputMessage.getMessagePartsMap();
-        List<MessagePartInfo> outputParts = 
+        List<MessagePartInfo> outputParts =
             outputMessage == null ? new ArrayList<MessagePartInfo>() : outputMessage.getMessageParts();
         // figure out output parts that are not present in input parts
         List<MessagePartInfo> outParts = new ArrayList<MessagePartInfo>();
@@ -196,7 +211,7 @@
     private void processWrappedOutput(JavaMethod method,
                                       MessageInfo inputMessage,
                                       MessageInfo outputMessage) throws ToolException {
-        
+
         List<MessagePartInfo> outputParts = outputMessage.getMessageParts();
         List<MessagePartInfo> inputParts = inputMessage.getMessageParts();
 
@@ -208,19 +223,19 @@
             addVoidReturn(method);
             return;
         }
-        
+
         MessagePartInfo inputPart = inputParts.size() > 0 ? inputParts.iterator().next() : null;
         MessagePartInfo outputPart = outputParts.size() > 0 ? outputParts.iterator().next() : null;
-        
+
         List<QName> inputWrapElement = null;
         List<QName> outputWrapElement = null;
-        
+
         if (inputPart != null) {
-            inputWrapElement = ProcessorUtil.getWrappedElement(context, inputPart.getElementQName()); 
-        }       
-        
+            inputWrapElement = ProcessorUtil.getWrappedElement(context, inputPart.getElementQName());
+        }
+
         if (outputPart != null) {
-            outputWrapElement = ProcessorUtil.getWrappedElement(context, outputPart.getElementQName()); 
+            outputWrapElement = ProcessorUtil.getWrappedElement(context, outputPart.getElementQName());
         }
 
         if (inputWrapElement == null || outputWrapElement.size() == 0) {
@@ -229,13 +244,13 @@
         }
         method.setReturn(null);
         boolean qualified = ProcessorUtil.isSchemaFormQualified(context, outputPart.getElementQName());
-        
+
         if (outputWrapElement.size() == 1 && inputWrapElement != null) {
             QName outElement = outputWrapElement.iterator().next();
             boolean sameWrapperChild = false;
             for (QName inElement : inputWrapElement) {
                 if (isSameWrapperChild(inElement, outElement)) {
-                    JavaParameter  jp = getParameterFromQName(outputPart.getElementQName(), outElement, 
+                    JavaParameter  jp = getParameterFromQName(outputPart.getElementQName(), outElement,
                                                               JavaType.Style.INOUT, outputPart);
                     if (!qualified) {
                         jp.setTargetNamespace("");
@@ -256,12 +271,12 @@
                 method.setReturn(jreturn);
                 return;
             }
-            
+
         }
         for (QName outElement : outputWrapElement) {
             if ("return".equals(outElement.getLocalPart())) {
                 if (method.getReturn() != null) {
-                    org.apache.cxf.common.i18n.Message msg = 
+                    org.apache.cxf.common.i18n.Message msg =
                         new org.apache.cxf.common.i18n.Message("WRAPPER_STYLE_TWO_RETURN_TYPES", LOG);
                     throw new ToolException(msg);
                 }
@@ -276,7 +291,7 @@
             if (inputWrapElement != null) {
                 for (QName inElement : inputWrapElement) {
                     if (isSameWrapperChild(inElement, outElement)) {
-                        JavaParameter  jp = getParameterFromQName(outputPart.getElementQName(), outElement, 
+                        JavaParameter  jp = getParameterFromQName(outputPart.getElementQName(), outElement,
                                                                   JavaType.Style.INOUT, outputPart);
                         if (!qualified) {
                             jp.setTargetNamespace("");
@@ -288,7 +303,7 @@
                 }
             }
             if (!sameWrapperChild) {
-                JavaParameter  jp = getParameterFromQName(outputPart.getElementQName(), outElement, 
+                JavaParameter  jp = getParameterFromQName(outputPart.getElementQName(), outElement,
                                                           JavaType.Style.OUT, outputPart);
                 if (!qualified) {
                     jp.setTargetNamespace("");
@@ -310,34 +325,34 @@
         if (!in.getLocalPart().equals(out.getLocalPart())) {
             return false;
         }
-        
+
         if (!in.getNamespaceURI().equals(out.getNamespaceURI())) {
             return false;
         }
         return true;
     }
 
-    private JavaParameter getParameterFromQName(QName wrapperElement, QName item, JavaType.Style style, 
+    private JavaParameter getParameterFromQName(QName wrapperElement, QName item, JavaType.Style style,
                                                 MessagePartInfo part) {
 
         String fullJavaName = "";
-              
+
         fullJavaName = this.dataBinding.getWrappedElementType(wrapperElement, item);
 
-        String targetNamespace = item.getNamespaceURI();    
-        
+        String targetNamespace = item.getNamespaceURI();
+
         String jpname = ProcessorUtil.mangleNameToVariableName(item.getLocalPart());
         JavaParameter parameter = new JavaParameter(jpname, fullJavaName, targetNamespace);
         parameter.setStyle(style);
         parameter.setQName(item);
-        
+
         if (style == JavaType.Style.OUT || style == JavaType.Style.INOUT) {
             parameter.setHolder(true);
             parameter.setHolderName(javax.xml.ws.Holder.class.getName());
             String holderClass = fullJavaName;
             if (JAXBUtils.holderClass(fullJavaName) != null) {
                 holderClass = JAXBUtils.holderClass(fullJavaName).getName();
-            }          
+            }
             parameter.setHolderClass(holderClass);
         }
         return parameter;
@@ -345,27 +360,26 @@
     }
 
     private JavaReturn getReturnFromQName(QName element, MessagePartInfo part) {
-       
+
         String fullJavaName = "";
         String simpleJavaName = "";
         fullJavaName = this.dataBinding.getWrappedElementType(part.getElementQName(), element);
         simpleJavaName = fullJavaName;
-        
+
         int index = fullJavaName.lastIndexOf(".");
-        
+
         if (index > -1) {
-            simpleJavaName = fullJavaName.substring(index);    
+            simpleJavaName = fullJavaName.substring(index);
         }
-        
+
         String targetNamespace = "";
-        Object obj = part.getProperty("messagepart.isheader");
-        if (Boolean.TRUE.equals(obj)) {
+        if (isHeader(part)) {
             targetNamespace = part.getMessageInfo().getOperation().getInterface().
             getService().getTargetNamespace();
         }  else {
             targetNamespace = element.getNamespaceURI();
         }
-        
+
         String jpname = ProcessorUtil.mangleNameToVariableName(simpleJavaName);
         JavaReturn returnType = new JavaReturn(jpname, fullJavaName , targetNamespace);
         returnType.setQName(element);
@@ -373,6 +387,10 @@
         return returnType;
     }
 
+    private boolean isHeader(final MessagePartInfo part) {
+        return Boolean.TRUE.equals(part.getProperty(HEADER));
+    }
+
     private void buildParamModelsWithoutOrdering(JavaMethod method,
                                                  MessageInfo inputMessage,
                                                  MessageInfo outputMessage) throws ToolException {
@@ -401,7 +419,7 @@
                                               List<String> parameterList) throws ToolException {
 
         Map<QName, MessagePartInfo> inputPartsMap = inputMessage.getMessagePartsMap();
-        
+
         Map<QName, MessagePartInfo> outputPartsMap = outputMessage.getMessagePartsMap();
 
         List<MessagePartInfo> inputParts = inputMessage.getMessageParts();
@@ -446,7 +464,7 @@
             if (part == null) {
                 part = outputPartsMap.get(inputMessage.getMessagePartQName(partName));
                 style = JavaType.Style.OUT;
-            } else if (outputPartsMap.get(inputMessage.getMessagePartQName(partName)) != null 
+            } else if (outputPartsMap.get(inputMessage.getMessagePartQName(partName)) != null
                 && isSamePart(part, outputPartsMap.get(inputMessage.getMessagePartQName(partName)))) {
                 style = JavaType.Style.INOUT;
             }
@@ -480,7 +498,7 @@
     }
 
     @SuppressWarnings("unchecked")
-    private boolean isValidOrdering(List<String> parameterOrder, 
+    private boolean isValidOrdering(List<String> parameterOrder,
                                     MessageInfo inputMessage, MessageInfo outputMessage) {
         Iterator<String> params = parameterOrder.iterator();
 

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.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/ServiceProcessor.java?view=diff&rev=554819&r1=554818&r2=554819
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java Mon Jul  9 20:50:15 2007
@@ -38,7 +38,6 @@
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.service.model.BindingInfo;
-import org.apache.cxf.service.model.BindingMessageInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.service.model.InterfaceInfo;
@@ -84,7 +83,7 @@
 
     private Object bindingObj;
     private ServiceInfo service;
-    
+
     private JAXWSBinding jaxwsBinding = new JAXWSBinding();
 
     public ServiceProcessor(ToolContext penv) {
@@ -97,7 +96,7 @@
         }
         this.service = si;
         processService(context.get(JavaModel.class));
-        
+
     }
 
     private boolean isNameCollision(String packageName, String className) {
@@ -116,25 +115,25 @@
         String namespace = service.getName().getNamespaceURI();
         String packageName = ProcessorUtil.parsePackageName(namespace, context.mapPackageName(namespace));
 
-        
+
         //customizing
         JAXWSBinding serviceBinding = service.getDescription().getExtensor(JAXWSBinding.class);
         JAXWSBinding serviceBinding2 = service.getExtensor(JAXWSBinding.class);
-        
+
         //TODO : Handle service customized class
         if (serviceBinding != null) {
             if (serviceBinding.getPackage() != null) {
                 jaxwsBinding.setPackage(serviceBinding.getPackage());
             }
-            
+
             if (serviceBinding.isEnableAsyncMapping()) {
                 jaxwsBinding.setEnableAsyncMapping(true);
             }
-            
+
             if (serviceBinding.isEnableMime()) {
                 jaxwsBinding.setEnableMime(true);
             }
-            
+
             if (serviceBinding.isEnableWrapperStyle()) {
                 jaxwsBinding.setEnableWrapperStyle(true);
             }
@@ -147,15 +146,15 @@
             if (serviceBinding2.getPackage() != null) {
                 jaxwsBinding.setPackage(serviceBinding2.getPackage());
             }
-            
+
             if (serviceBinding2.isEnableAsyncMapping()) {
                 jaxwsBinding.setEnableAsyncMapping(true);
             }
-            
+
             if (serviceBinding2.isEnableMime()) {
                 jaxwsBinding.setEnableMime(true);
             }
-            
+
             if (serviceBinding2.isEnableWrapperStyle()) {
                 jaxwsBinding.setEnableWrapperStyle(true);
             }
@@ -164,29 +163,29 @@
                 name = serviceBinding2.getJaxwsClass().getClassName();
             }
         }
-        
+
         sclz.setServiceName(service.getName().getLocalPart());
         sclz.setNamespace(namespace);
-        
+
         if (jaxwsBinding.getPackage() != null) {
             packageName = jaxwsBinding.getPackage();
         }
         sclz.setPackageName(packageName);
-        
+
         while (isNameCollision(packageName, name)) {
             name = name + "_Service";
         }
         sclz.setName(name);
-        
+
 
         if (model.getServiceClasses().containsKey(name)) {
             sclz = model.getServiceClasses().get(name);
         }
-        
+
         Element handler = (Element)context.get(ToolConstants.HANDLER_CHAIN);
         sclz.setHandlerChains(handler);
-        
-        
+
+
         Collection<EndpointInfo> ports = service.getEndpoints();
 
         for (EndpointInfo port : ports) {
@@ -202,29 +201,29 @@
         BindingInfo binding = port.getBinding();
         jport.setBindingAdress(port.getAddress());
         jport.setBindingName(binding.getName().getLocalPart());
-        
+
         String namespace = binding.getInterface().getName().getNamespaceURI();
         String packageName = ProcessorUtil.parsePackageName(namespace, context.mapPackageName(namespace));
         jport.setPackageName(packageName);
 
         InterfaceInfo infInfo = binding.getInterface();
-              
+
         String portType = binding.getInterface().getName().getLocalPart();
         jport.setPortType(portType);
-        
+
         JAXWSBinding infBinding = infInfo.getExtensor(JAXWSBinding.class);
 
-        
+
         if (infBinding != null) {
             if (infBinding.getJaxwsClass() != null
                 && !StringUtils.isEmpty(infBinding.getJaxwsClass().getClassName())) {
                 jport.setPortType(infBinding.getJaxwsClass().getClassName());
             }
-            
+
             if (!infBinding.isEnableAsyncMapping()) {
                 jaxwsBinding.setEnableAsyncMapping(false);
             }
-        
+
             if (!infBinding.isEnableWrapperStyle()) {
                 jaxwsBinding.setEnableWrapperStyle(false);
             }
@@ -237,8 +236,8 @@
         if (jaxwsBinding.getPackage() != null) {
             jport.setPackageName(jaxwsBinding.getPackage());
         }
-        
-        if (infBinding != null && infBinding.getJaxwsClass() != null 
+
+        if (infBinding != null && infBinding.getJaxwsClass() != null
             && infBinding.getJaxwsClass().getClassName() != null) {
             String className = NameUtil.mangleNameToClassName(infBinding.getJaxwsClass().getClassName());
             jport.setInterfaceClass(className);
@@ -247,11 +246,11 @@
         }
 
         bindingType = getBindingType(binding);
-        
+
         if (bindingType == null) {
-            org.apache.cxf.common.i18n.Message msg = 
+            org.apache.cxf.common.i18n.Message msg =
                 new org.apache.cxf.common.i18n.Message("BINDING_SPECIFY_ONE_PROTOCOL",
-                                                       LOG, 
+                                                       LOG,
                                                        binding.getName());
             throw new ToolException(msg);
         }
@@ -273,13 +272,13 @@
         throws ToolException {
         boolean enableOpMime = false;
         JAXWSBinding bind = binding.getExtensor(JAXWSBinding.class);
- 
+
         if (bind != null && bind.isEnableMime()) {
             enableOpMime = true;
         }
-        
+
         JAXWSBinding bopBinding = bop.getExtensor(JAXWSBinding.class);
-        
+
         if (bopBinding != null && bopBinding.isEnableMime()) {
             enableOpMime = true;
             if (bopBinding.getJaxwsPara() != null) {
@@ -317,7 +316,7 @@
                     String soapStyle = prop.get(soapOPStyle) == null ? "" : (String)prop.get(soapOPStyle);
                     jm.setSoapAction(soapAction);
                     if (SOAPBindingUtil.getSoapStyle(soapStyle) == null && this.bindingObj == null) {
-                        org.apache.cxf.common.i18n.Message msg = 
+                        org.apache.cxf.common.i18n.Message msg =
                             new  org.apache.cxf.common.i18n.Message("BINDING_STYLE_NOT_DEFINED",
                                                                          LOG);
                         throw new ToolException(msg);
@@ -341,10 +340,10 @@
                 int headerType = isNonWrappable(bop);
 
                 OperationInfo opinfo = bop.getOperationInfo();
-                
+
                 JAXWSBinding opBinding = (JAXWSBinding)opinfo.getExtensor(JAXWSBinding.class);
-                
-                
+
+
                 if (opBinding != null) {
                     if (opBinding.isEnableWrapperStyle()) {
                         jaxwsBinding.setEnableWrapperStyle(true);
@@ -354,7 +353,7 @@
                             jaxwsBinding.setEnableAsyncMapping(false);
                         }
                     }
-                    
+
                     if (opBinding.isEnableMime()) {
                         enableOpMime = true;
                     }
@@ -362,9 +361,9 @@
                 if (jaxwsBinding.isEnableMime() || enableOpMime) {
                     jm.setMimeEnable(true);
                 }
-                
-                if (jm.isWrapperStyle() && headerType > this.noHEADER 
-                    || !jaxwsBinding.isEnableWrapperStyle() 
+
+                if (jm.isWrapperStyle() && headerType > this.noHEADER
+                    || !jaxwsBinding.isEnableWrapperStyle()
                     || jm.enableMime() && jm.isWrapperStyle()) {
                     // changed wrapper style
 
@@ -399,7 +398,7 @@
     private void processParameter(JavaMethod jm, BindingOperationInfo operation) throws ToolException {
 
         // process input
-        
+
         List<ExtensibilityElement> inbindings = null;
         if (operation.getInput() != null) {
             inbindings = operation.getInput().getExtensors(ExtensibilityElement.class);
@@ -417,9 +416,9 @@
             }
             if (ext instanceof MIMEMultipartRelated && jm.enableMime()) {
                 processMultipart(jm, operation, (MIMEMultipartRelated)ext, JavaType.Style.IN);
-            }            
+            }
         }
-        
+
         // process output
         if (operation.getOutput() != null) {
             List<ExtensibilityElement> outbindings =
@@ -456,7 +455,7 @@
                 if (ext instanceof MIMEMultipartRelated && jm.enableMime()) {
                     processMultipart(jm, operation, (MIMEMultipartRelated)ext, JavaType.Style.OUT);
                 }
-            }           
+            }
         }
 
         jm.setSoapUse(SOAPBindingUtil.getSoapUse(use));
@@ -476,35 +475,12 @@
 
     private void processSoapHeader(JavaMethod jm, BindingOperationInfo operation, ExtensibilityElement ext) {
         SoapHeader soapHeader = SOAPBindingUtil.getSoapHeader(ext);
-        boolean found = false;
         for (JavaParameter parameter : jm.getParameters()) {
             if (soapHeader.getPart().equals(parameter.getPartName())) {
                 setParameterAsHeader(parameter);
-                found = true;
                 break;
             }
         }
-        if (Boolean.valueOf((String)context.get(ToolConstants.CFG_EXTRA_SOAPHEADER)).booleanValue()
-            && !found) {
-            // Header can't be found in java method parameters, in
-            // different message
-            // other than messages used in porttype operation
-            ParameterProcessor processor = new ParameterProcessor(context);
-           
-            MessagePartInfo exPart = service.getMessage(soapHeader.getMessage())
-                .getMessagePart(new QName(soapHeader.getMessage().getNamespaceURI(),
-                                          soapHeader.getPart()));
-                
-            JavaType.Style jpStyle = JavaType.Style.IN;
-            if (isInOutParam(soapHeader.getPart(), operation.getOutput())) {
-                jpStyle = JavaType.Style.INOUT;
-            }
-            JavaParameter jp = processor.addParameterFromBinding(jm, exPart, jpStyle);
-            if (soapHeader.getPart() != null && soapHeader.getPart().length() > 0) {
-                jp.getAnnotation().addArgument("partName", soapHeader.getPart());
-            }
-            setParameterAsHeader(jp);
-        }
     }
 
     private static String getJavaTypeForMimeType(MIMEPart mPart) {
@@ -557,9 +533,9 @@
                             jp = jm.getReturn();
                             jp.setClassName(mimeJavaType);
                         }
-                            
-                         
-                        
+
+
+
                         if (jp == null) {
                             for (JavaParameter para : jm.getParameters()) {
                                 if (mimeContent.getPart().equals(para.getPartName())) {
@@ -585,7 +561,7 @@
             }
         }
     }
-    
+
     private Map getSoapOperationProp(BindingOperationInfo bop) {
         Map<String, Object> soapOPProp = new HashMap<String, Object>();
         if (bop.getExtensor(ExtensibilityElement.class) != null) {
@@ -604,8 +580,8 @@
                     soapOPProp.put(this.soapOPStyle, soapOP.getStyle());
                 }
             }
-            
-            
+
+
         }
         return soapOPProp;
     }
@@ -622,11 +598,11 @@
             }
             // TBD XMLBinding
             return BindingType.XMLBinding;
-            
+
         }
         return null;
     }
-    
+
     private int isNonWrappable(BindingOperationInfo bop) {
         QName operationName = bop.getName();
         MessageInfo bodyMessage = null;
@@ -639,7 +615,7 @@
         int result = this.noHEADER;
 
         // begin process input
-        if (bop.getInput() != null 
+        if (bop.getInput() != null
             && bop.getInput().getExtensors(ExtensibilityElement.class) != null) {
             List<ExtensibilityElement> extensors = bop.getInput().getExtensors(ExtensibilityElement.class);
             if (extensors != null) {
@@ -720,7 +696,7 @@
         }
         return null;
     }
-    
+
     public enum BindingType {
         HTTPBinding, SOAPBinding, XMLBinding
     }
@@ -728,17 +704,5 @@
     private boolean isSoapBinding() {
         return bindingType != null && "SOAPBinding".equals(bindingType.name());
 
-    }
-
-    private boolean isInOutParam(String inPartName, BindingMessageInfo messageInfo) {
-        for (ExtensibilityElement ext : messageInfo.getExtensors(ExtensibilityElement.class)) {
-            if (SOAPBindingUtil.isSOAPHeader(ext)) {
-                String outPartName = (SOAPBindingUtil.getSoapHeader(ext)).getPart();
-                if (inPartName.equals(outPartName)) {
-                    return true;
-                }
-            }
-        }
-        return false;
     }
 }

Modified: incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java?view=diff&rev=554819&r1=554818&r2=554819
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java Mon Jul  9 20:50:15 2007
@@ -77,9 +77,9 @@
         processor = null;
         env = null;
     }
-    
+
     @Test
-    public void testHeaderFromAnotherNamespace() throws Exception {
+    public void testHeaderFromAnotherMessage1() throws Exception {
 
         env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/pizza.wsdl"));
         env.put(ToolConstants.CFG_EXTRA_SOAPHEADER, "TRUE");
@@ -88,8 +88,8 @@
 
         assertNotNull(output);
 
-        Class clz = classLoader.loadClass("com.mypizzaco.pizza.PizzaPortType");      
-        
+        Class clz = classLoader.loadClass("com.mypizzaco.pizza.PizzaPortType");
+
         Method meths[] = clz.getMethods();
         for (Method m : meths) {
             if ("orderPizzaBroken".equals(m.getName())) {
@@ -101,17 +101,17 @@
                     if ("OrderPizza".equals(parm.name())) {
                         assertEquals("http://mypizzaco.com/pizza/types", parm.targetNamespace());
                         assertEquals("OrderPizza", parm.name());
-                        assertTrue(!parm.header());                       
+                        assertTrue(!parm.header());
                     } else if ("CallerIDHeader".equals(parm.name())) {
                         assertEquals("http://mypizzaco.com/pizza/types", parm.targetNamespace());
                         assertEquals("callerID", parm.partName());
                         assertEquals("CallerIDHeader", parm.name());
-                        assertTrue(parm.header());                       
+                        assertTrue(parm.header());
                     } else {
                         fail("No WebParam found!");
                     }
                 }
-           
+
             }
             if ("orderPizza".equals(m.getName())) {
                 Annotation annotations[][] = m.getParameterAnnotations();
@@ -122,23 +122,91 @@
                     if ("OrderPizza".equals(parm.name())) {
                         assertEquals("http://mypizzaco.com/pizza/types", parm.targetNamespace());
                         assertEquals("OrderPizza", parm.name());
-                        assertTrue(!parm.header());                       
+                        assertTrue(!parm.header());
                     } else if ("CallerIDHeader".equals(parm.name())) {
                         assertEquals("http://mypizzaco.com/pizza/types", parm.targetNamespace());
                         assertEquals("callerID", parm.partName());
                         assertEquals("CallerIDHeader", parm.name());
-                        assertTrue(parm.header());                       
+                        assertTrue(parm.header());
                     } else {
                         fail("No WebParam found!");
                     }
                 }
-           
-            } 
+
+            }
         }
 
 
     }
-    
+
+    @Test
+    public void testHeaderFromAnotherMessage2() throws Exception {
+        env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/pizza.wsdl"));
+        processor.setContext(env);
+        processor.execute();
+
+        assertNotNull(output);
+
+        Class clz = classLoader.loadClass("com.mypizzaco.pizza.PizzaPortType");
+
+        Method meths[] = clz.getMethods();
+        for (Method m : meths) {
+            if ("orderPizzaBroken".equals(m.getName())) {
+                Annotation annotations[][] = m.getParameterAnnotations();
+                assertEquals(2, annotations.length);
+                for (int i = 0; i < 2; i++) {
+                    assertTrue(annotations[i][0] instanceof WebParam);
+                    WebParam parm = (WebParam)annotations[i][0];
+                    if ("OrderPizza".equals(parm.name())) {
+                        assertEquals("http://mypizzaco.com/pizza/types", parm.targetNamespace());
+                        assertEquals("OrderPizza", parm.name());
+                        assertTrue(!parm.header());
+                    } else if ("CallerIDHeader".equals(parm.name())) {
+                        assertEquals("http://mypizzaco.com/pizza/types", parm.targetNamespace());
+                        assertEquals("callerID", parm.partName());
+                        assertEquals("CallerIDHeader", parm.name());
+                        assertTrue(parm.header());
+                    } else {
+                        fail("No WebParam found!");
+                    }
+                }
+            }
+        }
+    }
+
+    @Test
+    public void testHeaderFromAnotherMessage3() throws Exception {
+        env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/pizza.wsdl"));
+        env.put(ToolConstants.CFG_EXTRA_SOAPHEADER, "FALSE");
+        processor.setContext(env);
+        processor.execute();
+
+        assertNotNull(output);
+
+        Class clz = classLoader.loadClass("com.mypizzaco.pizza.PizzaPortType");
+
+        Method meths[] = clz.getMethods();
+        for (Method m : meths) {
+            if ("orderPizzaBroken".equals(m.getName())) {
+                Annotation annotations[][] = m.getParameterAnnotations();
+                assertEquals(1, annotations.length);
+                for (int i = 0; i < 1; i++) {
+                    assertTrue(annotations[i][0] instanceof WebParam);
+                    WebParam parm = (WebParam)annotations[i][0];
+                    if ("OrderPizza".equals(parm.name())) {
+                        assertEquals("http://mypizzaco.com/pizza/types", parm.targetNamespace());
+                        assertEquals("OrderPizza", parm.name());
+                        assertTrue(!parm.header());
+                    } else if ("CallerIDHeader".equals(parm.name())) {
+                        fail("If the exsh turned off, should not generate this parameter");
+                    } else {
+                        fail("No WebParam found!");
+                    }
+                }
+            }
+        }
+    }
+
     @Test
     public void testRPCLit() throws Exception {
 
@@ -158,7 +226,7 @@
         assertTrue(types.exists());
         File[] files = helloworldsoaphttp.listFiles();
         assertEquals(4, files.length);
-        
+
         files = types.listFiles();
         assertEquals(files.length, 3);
 
@@ -366,14 +434,14 @@
 
     }
 
-    
+
     @Test
     public void testHelloWorldWithDummyPlugin() throws Exception {
         env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/hello_world.wsdl"));
-        
-        // verify passing space seperated xjc args direct to xjc will load, 
+
+        // verify passing space seperated xjc args direct to xjc will load,
         // configure and invoke an xjc plugin
-        env.put(ToolConstants.CFG_XJC_ARGS, "-" + DummyXjcPlugin.XDUMMY_XJC_PLUGIN 
+        env.put(ToolConstants.CFG_XJC_ARGS, "-" + DummyXjcPlugin.XDUMMY_XJC_PLUGIN
                 + ",-" + DummyXjcPlugin.XDUMMY_XJC_PLUGIN  + ":arg");
         processor.setContext(env);
         processor.execute();
@@ -581,7 +649,7 @@
         soapBindingAnno = AnnotationUtil.getPrivMethodAnnotation(method, SOAPBinding.class);
         assertNotNull(soapBindingAnno);
         assertEquals(SOAPBinding.ParameterStyle.BARE, soapBindingAnno.parameterStyle());
-        
+
         WebParam webParamAnno = AnnotationUtil.getWebParam(method, "SOAPHeaderInfo");
         assertEquals("INOUT", webParamAnno.mode().name());
         assertEquals(true, webParamAnno.header());
@@ -930,7 +998,7 @@
 
         method = clz.getMethod("deregisterPeerManager", new Class[] {String.class});
         webParamAnn = AnnotationUtil.getWebParam(method, "node_id");
-        
+
         assertEquals("", webParamAnn.targetNamespace());
 
 
@@ -948,21 +1016,21 @@
         assertEquals("http://www.w3.org/2001/XMLSchema", webFault.targetNamespace());
 
     }
-    
+
     @Test
     public void testWsdlWithInvalidSchema() {
         try {
-            env.put(ToolConstants.CFG_WSDLURL, 
+            env.put(ToolConstants.CFG_WSDLURL,
                     getLocation("/wsdl2java_wsdl/hello_world_with_invalid_schema.wsdl"));
             env.put(ToolConstants.CFG_VALIDATE_WSDL, ToolConstants.CFG_VALIDATE_WSDL);
             processor.setContext(env);
             processor.execute();
         } catch (Exception e) {
-            assertTrue("Jaxb databinding can not find the schema error ", 
-                       e.getLocalizedMessage().indexOf(" cos-st-restricts.1.1: " 
+            assertTrue("Jaxb databinding can not find the schema error ",
+                       e.getLocalizedMessage().indexOf(" cos-st-restricts.1.1: "
                                                        + "The type 'TpAny' is atomic") > -1);
         }
     }
-    
-    
+
+
 }

Modified: incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/pizza.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/pizza.wsdl?view=diff&rev=554819&r1=554818&r2=554819
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/pizza.wsdl (original)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/pizza.wsdl Mon Jul  9 20:50:15 2007
@@ -7,9 +7,9 @@
   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
@@ -17,83 +17,16 @@
   specific language governing permissions and limitations
   under the License.
 -->
-<wsdl:definitions 
+<wsdl:definitions
         name="PizzaService"
         targetNamespace="http://mypizzaco.com/pizza"
         xmlns:tns="http://mypizzaco.com/pizza"
         xmlns:types="http://mypizzaco.com/pizza/types"
         xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
         xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
-            
-  <wsdl:types>
-    <xsd:schema targetNamespace="http://mypizzaco.com/pizza/types"
-               xmlns:tns="http://mypizzaco.com/pizza/types"
-			   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
-			   elementFormDefault="qualified"
-			   version="1.0">
-
-      <xsd:element name="CallerIDHeader" type="tns:CallerIDHeaderType" />
-	  
-      <xsd:complexType name="CallerIDHeaderType">
-        <xsd:sequence>
-          <xsd:element name="Name" type="xsd:string" />
-          <xsd:element name="PhoneNumber" type="xsd:string" />
-        </xsd:sequence>
-      </xsd:complexType>
-      
-	  <xsd:element name="OrderPizza" type="tns:OrderPizzaType" />
-	  
-      <xsd:complexType name="OrderPizzaType">
-        <xsd:sequence>
-          <xsd:element name="Toppings" type="tns:ToppingsListType" />
-        </xsd:sequence>
-      </xsd:complexType>
-	  
-      <xsd:element name="OrderPizzaResponse" type="tns:OrderPizzaResponseType" />
-
-      <xsd:complexType name="OrderPizzaResponseType">
-        <xsd:sequence>
-          <xsd:element name="MinutesUntilReady" type="xsd:int" /> 
-        </xsd:sequence>
-      </xsd:complexType>
-
-      <xsd:complexType name="ToppingsListType">
-        <xsd:sequence>
-          <xsd:element name="Topping" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
-        </xsd:sequence>
-      </xsd:complexType>
 
-    </xsd:schema>
-  </wsdl:types>
+  <wsdl:import namespace="http://mypizzaco.com/pizza"  location="pizza_messages.wsdl"/>
 
-  <wsdl:message name="CallerIDHeader">
-    <wsdl:part name="callerID" element="types:CallerIDHeader"/>
-  </wsdl:message>	
-  <wsdl:message name="OrderPizzaBrokenRequest">
-    <wsdl:part name="body" element="types:OrderPizza"/>
-  </wsdl:message>	
-  <wsdl:message name="OrderPizzaBrokenResponse">
-    <wsdl:part name="body" element="types:OrderPizzaResponse"/>
-  </wsdl:message>
-  <wsdl:message name="OrderPizzaRequest">
-    <wsdl:part name="body" element="types:OrderPizza"/>
-    <wsdl:part name="callerID" element="types:CallerIDHeader"/>
-  </wsdl:message>	
-  <wsdl:message name="OrderPizzaResponse">
-    <wsdl:part name="body" element="types:OrderPizzaResponse"/>
-  </wsdl:message>
-  	
-  <wsdl:portType name="PizzaPortType">
-    <wsdl:operation name="OrderPizzaBroken">
-      <wsdl:input message="tns:OrderPizzaBrokenRequest" />
-      <wsdl:output message="tns:OrderPizzaBrokenResponse" />
-    </wsdl:operation>
-    <wsdl:operation name="OrderPizza">
-      <wsdl:input message="tns:OrderPizzaRequest" />
-      <wsdl:output message="tns:OrderPizzaResponse" />
-    </wsdl:operation>
-  </wsdl:portType>
-  
   <wsdl:binding name="PizzaPortBinding" type="tns:PizzaPortType">
     <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
     <wsdl:operation name="OrderPizzaBroken">
@@ -117,7 +50,7 @@
       </wsdl:output>
     </wsdl:operation>
   </wsdl:binding>
-  
+
   <wsdl:service name="PizzaService">
     <wsdl:port name="PizzaPort" binding="tns:PizzaPortBinding">
       <soap:address location="http://localhost:8080/pizza_service/services/PizzaService"/>

Added: incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/pizza_messages.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/pizza_messages.wsdl?view=auto&rev=554819
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/pizza_messages.wsdl (added)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/pizza_messages.wsdl Mon Jul  9 20:50:15 2007
@@ -0,0 +1,65 @@
+<?xml version="1.0" ?>
+<!--
+    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
+    name="PizzaService"
+    targetNamespace="http://mypizzaco.com/pizza"
+    xmlns:tns="http://mypizzaco.com/pizza"
+    xmlns:types="http://mypizzaco.com/pizza/types"
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+  <wsdl:types>
+    <xsd:schema targetNamespace="http://mypizzaco.com/pizza/types"
+               xmlns:tns="http://mypizzaco.com/pizza/types"
+                           xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+                           elementFormDefault="qualified"
+                           version="1.0">
+      <xsd:import schemaLocation="pizza_schema.xml" namespace="http://mypizzaco.com/pizza/types"/>
+    </xsd:schema>
+  </wsdl:types>
+
+  <wsdl:portType name="PizzaPortType">
+    <wsdl:operation name="OrderPizzaBroken">
+      <wsdl:input message="tns:OrderPizzaBrokenRequest" />
+      <wsdl:output message="tns:OrderPizzaBrokenResponse" />
+    </wsdl:operation>
+    <wsdl:operation name="OrderPizza">
+      <wsdl:input message="tns:OrderPizzaRequest" />
+      <wsdl:output message="tns:OrderPizzaResponse" />
+    </wsdl:operation>
+  </wsdl:portType>
+
+  <wsdl:message name="CallerIDHeader">
+    <wsdl:part name="callerID" element="types:CallerIDHeader"/>
+  </wsdl:message>
+  <wsdl:message name="OrderPizzaBrokenRequest">
+    <wsdl:part name="body" element="types:OrderPizza"/>
+  </wsdl:message>
+  <wsdl:message name="OrderPizzaBrokenResponse">
+    <wsdl:part name="body" element="types:OrderPizzaResponse"/>
+  </wsdl:message>
+  <wsdl:message name="OrderPizzaRequest">
+    <wsdl:part name="body" element="types:OrderPizza"/>
+    <wsdl:part name="callerID" element="types:CallerIDHeader"/>
+  </wsdl:message>
+  <wsdl:message name="OrderPizzaResponse">
+    <wsdl:part name="body" element="types:OrderPizzaResponse"/>
+  </wsdl:message>
+</wsdl:definitions>
\ No newline at end of file

Added: incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/pizza_schema.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/pizza_schema.xml?view=auto&rev=554819
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/pizza_schema.xml (added)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/pizza_schema.xml Mon Jul  9 20:50:15 2007
@@ -0,0 +1,57 @@
+<?xml version="1.0" ?>
+<!--
+    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.
+ -->
+<xsd:schema targetNamespace="http://mypizzaco.com/pizza/types"
+            xmlns:tns="http://mypizzaco.com/pizza/types"
+            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+            elementFormDefault="qualified"
+            version="1.0">
+
+  <xsd:element name="CallerIDHeader" type="tns:CallerIDHeaderType" />
+
+  <xsd:complexType name="CallerIDHeaderType">
+    <xsd:sequence>
+      <xsd:element name="Name" type="xsd:string" />
+      <xsd:element name="PhoneNumber" type="xsd:string" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:element name="OrderPizza" type="tns:OrderPizzaType" />
+
+  <xsd:complexType name="OrderPizzaType">
+    <xsd:sequence>
+      <xsd:element name="Toppings" type="tns:ToppingsListType" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:element name="OrderPizzaResponse" type="tns:OrderPizzaResponseType" />
+
+  <xsd:complexType name="OrderPizzaResponseType">
+    <xsd:sequence>
+      <xsd:element name="MinutesUntilReady" type="xsd:int" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+  <xsd:complexType name="ToppingsListType">
+    <xsd:sequence>
+      <xsd:element name="Topping" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
+    </xsd:sequence>
+  </xsd:complexType>
+
+</xsd:schema>



Mime
View raw message