You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by cs...@apache.org on 2006/01/09 20:27:59 UTC

svn commit: r367366 - in /beehive/trunk: samples/controls-webservices-blank/ system-controls/samples/webservice/amazon/ system-controls/samples/webservice/google/ system-controls/samples/webservice/wsm_samples_client/ system-controls/samples/webservice...

Author: cschoett
Date: Mon Jan  9 11:27:37 2006
New Revision: 367366

URL: http://svn.apache.org/viewcvs?rev=367366&view=rev
Log:
1) Changed the name of the ServiceControlGenerator ant task to WebServiceControlGenerator
2) Updated build files which used the task, also updated task name in build files, instead of 'scgen' changed to 'webservice-control-generator'
3) Changed the name of the 'wsdlPathAnnotation' property to 'wsdlRuntimePath' in the task, just to be a bit clearer about what that attribute does.
4) Added three new attributes to the task: 'serviceName' and 'serviceNamespace' to provide the ability to select a specific service from a WSDL which contains multiple services.  'servicePortName' to provide the ability to select a specific port of a service.  These are all optional attributes and the default behavior has not changed (the first service / port found will be the one used to generate the control).


Added:
    beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/WebServiceControlGenerator.java   (contents, props changed)
      - copied, changed from r366535, beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/ServiceControlGenerator.java
    beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/WebServiceControlGeneratorTask.java
      - copied, changed from r366535, beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/ServiceControlGeneratorTask.java
Removed:
    beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/ServiceControlGenerator.java
    beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/ServiceControlGeneratorTask.java
Modified:
    beehive/trunk/samples/controls-webservices-blank/build-svn.xml
    beehive/trunk/samples/controls-webservices-blank/build.xml
    beehive/trunk/system-controls/samples/webservice/amazon/build.xml
    beehive/trunk/system-controls/samples/webservice/google/build.xml
    beehive/trunk/system-controls/samples/webservice/wsm_samples_client/build.xml
    beehive/trunk/system-controls/samples/webservice/xmlbeans/build.xml
    beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/wsdl/Wsdl.java
    beehive/trunk/system-controls/test/webservice/build.xml
    beehive/trunk/system-controls/test/webservice/junit/build.xml

Modified: beehive/trunk/samples/controls-webservices-blank/build-svn.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/samples/controls-webservices-blank/build-svn.xml?rev=367366&r1=367365&r2=367366&view=diff
==============================================================================
--- beehive/trunk/samples/controls-webservices-blank/build-svn.xml (original)
+++ beehive/trunk/samples/controls-webservices-blank/build-svn.xml Mon Jan  9 11:27:37 2006
@@ -111,16 +111,16 @@
     <target name="gen-svc-ctrl" depends="gen-types">
             <property name="cp" refid="build.classpath"/><echo>cp: ${cp}</echo>
 
-        <path id="scgen.dependencies">
+        <path id="wscgen.dependencies">
             <path refid="build.classpath" />
             <pathelement location="${build.classes}" />
         </path>
 
-        <taskdef name="scgen"
-                 classname="org.apache.beehive.controls.system.webservice.generator.ServiceControlGeneratorTask"
-                 classpathref="scgen.dependencies"/>
+        <taskdef name="webservice-control-gen"
+                 classname="org.apache.beehive.controls.system.webservice.generator.WebServiceControlGeneratorTask"
+                 classpathref="wscgen.dependencies"/>
 
-        <scgen srcdir="${schema.dir}" destdir="${gen.source.dir}" destPackageName="${my.service.control.package}"/>
+        <webservice-control-gen srcdir="${schema.dir}" destdir="${gen.source.dir}" destPackageName="${my.service.control.package}"/>
 
           <!-- have the wsdls, in the same dir as the jcx files -->
         <copy todir="${gen.source.dir}/${my.service.control.package}">

Modified: beehive/trunk/samples/controls-webservices-blank/build.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/samples/controls-webservices-blank/build.xml?rev=367366&r1=367365&r2=367366&view=diff
==============================================================================
--- beehive/trunk/samples/controls-webservices-blank/build.xml (original)
+++ beehive/trunk/samples/controls-webservices-blank/build.xml Mon Jan  9 11:27:37 2006
@@ -96,16 +96,16 @@
     <!-- Generate the service control, should run after types have been generated. -->
     <target name="gen-svc-ctrl" depends="gen-types">
 
-        <path id="scgen.dependencies">
+        <path id="wscgen.dependencies">
             <path refid="build.classpath"/>
             <pathelement location="${build.classes}"/>
         </path>
 
-        <taskdef name="scgen"
-                 classname="org.apache.beehive.controls.system.webservice.generator.ServiceControlGeneratorTask"
-                 classpathref="scgen.dependencies"/>
+        <taskdef name="webservice-control-gen"
+                 classname="org.apache.beehive.controls.system.webservice.generator.WebServiceControlGeneratorTask"
+                 classpathref="wscgen.dependencies"/>
 
-        <scgen srcdir="${schema.dir}" destdir="${gen.source.dir}" destPackageName="${my.service.control.package}"/>
+        <webservice-control-gen srcdir="${schema.dir}" destdir="${gen.source.dir}" destPackageName="${my.service.control.package}"/>
 
         <!-- have the wsdls, in the same dir as the jcx files -->
         <copy todir="${gen.source.dir}/${my.service.control.package}">

Modified: beehive/trunk/system-controls/samples/webservice/amazon/build.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/samples/webservice/amazon/build.xml?rev=367366&r1=367365&r2=367366&view=diff
==============================================================================
--- beehive/trunk/system-controls/samples/webservice/amazon/build.xml (original)
+++ beehive/trunk/system-controls/samples/webservice/amazon/build.xml Mon Jan  9 11:27:37 2006
@@ -52,14 +52,14 @@
         <pathelement path="${servicecontrol.jar}"/>
     </path>
 
-    <path id="scgen.dependencies">
+    <path id="wscgen.dependencies">
         <path refid="build.classpath"/>
         <pathelement location="${build.classes}"/>
     </path>
 
-    <taskdef name="scgen"
-             classname="org.apache.beehive.controls.system.webservice.generator.ServiceControlGeneratorTask"
-             classpathref="scgen.dependencies"/>
+    <taskdef name="webservice-control-gen"
+             classname="org.apache.beehive.controls.system.webservice.generator.WebServiceControlGeneratorTask"
+             classpathref="wscgen.dependencies"/>
 
     <!-- XMLBean build -->
     <taskdef name="xmlbeanbuild" classname="org.apache.xmlbeans.impl.tool.XMLBean">
@@ -90,7 +90,7 @@
 
     <target name="gen_jcx" depends="gen_xmlbeans">
 
-        <scgen srcDir="${schema.dir}" destDir="${jcxgen.dir}" destPackageName="amazonWS" wsdlPathAnnotation="."/>
+        <webservice-control-gen srcDir="${schema.dir}" destDir="${jcxgen.dir}" destPackageName="amazonWS" wsdlRuntimePath="."/>
 
         <!-- have the wsdls, next to the jcx files -->
         <copy todir="${jcxgen.dir}/amazonWS">

Modified: beehive/trunk/system-controls/samples/webservice/google/build.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/samples/webservice/google/build.xml?rev=367366&r1=367365&r2=367366&view=diff
==============================================================================
--- beehive/trunk/system-controls/samples/webservice/google/build.xml (original)
+++ beehive/trunk/system-controls/samples/webservice/google/build.xml Mon Jan  9 11:27:37 2006
@@ -69,17 +69,17 @@
 	<target name="gen_jcx" depends="gen_types" unless="noaxisrebuild">
 
         <echo>"${beehive-webservice-control.jar}"</echo>
-        <path id="scgen.dependencies">
+        <path id="wscgen.dependencies">
             <path refid="build.classpath" />
             <pathelement location="${build.classes}" />
         </path>
 
-        <taskdef name="scgen"
-                 classname="org.apache.beehive.controls.system.webservice.generator.ServiceControlGeneratorTask"
-                 classpathref="scgen.dependencies"/>
+        <taskdef name="webservice-control-gen"
+                 classname="org.apache.beehive.controls.system.webservice.generator.WebServiceControlGeneratorTask"
+                 classpathref="wscgen.dependencies"/>
 
-        <scgen srcDir="${rpc.schema.dir}" destDir="${jcxgen.dir}"
-               destPackageName="${testmodel.client.jcxgen.packageName}" wsdlPathAnnotation="."/>
+        <webservice-control-gen srcDir="${rpc.schema.dir}" destDir="${jcxgen.dir}"
+               destPackageName="${testmodel.client.jcxgen.packageName}" wsdlRuntimePath="."/>
 
 		<!-- have the wsdls, next to the jcx files -->
 		<copy todir="${jcxgen.dir}/${testmodel.client.jcxgen.packageName}">

Modified: beehive/trunk/system-controls/samples/webservice/wsm_samples_client/build.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/samples/webservice/wsm_samples_client/build.xml?rev=367366&r1=367365&r2=367366&view=diff
==============================================================================
--- beehive/trunk/system-controls/samples/webservice/wsm_samples_client/build.xml (original)
+++ beehive/trunk/system-controls/samples/webservice/wsm_samples_client/build.xml Mon Jan  9 11:27:37 2006
@@ -94,17 +94,17 @@
 
     <target name="gen_jcx" depends="gen_types" unless="noxbeanrebuild">
 
-        <path id="scgen.dependencies">
+        <path id="wscgen.dependencies">
             <path refid="build.classpath" />
             <pathelement location="${build.classes}" />
         </path>
 
-        <taskdef name="scgen"
-                 classname="org.apache.beehive.controls.system.webservice.generator.ServiceControlGeneratorTask"
-                 classpathref="scgen.dependencies"/>
+        <taskdef name="webservice-control-gen"
+                 classname="org.apache.beehive.controls.system.webservice.generator.WebServiceControlGeneratorTask"
+                 classpathref="wscgen.dependencies"/>
 
-        <scgen srcDir="${doc.schema.dir}" destDir="${jcxgen.dir}"
-               destPackageName="${testmodel.client.jcxgen.packageName}" wsdlPathAnnotation="."/>
+        <webservice-control-gen srcDir="${doc.schema.dir}" destDir="${jcxgen.dir}"
+               destPackageName="${testmodel.client.jcxgen.packageName}" wsdlRuntimePath="."/>
 
         <!-- have the wsdls, next to the jcx files -->
         <copy todir="${jcxgen.dir}/${testmodel.client.jcxgen.packageName}">
@@ -113,8 +113,8 @@
             </fileset>
         </copy>
 
-        <scgen srcDir="${rpc.schema.dir}" destDir="${jcxgen.dir}"
-               destPackageName="${testmodel.client.jcxgen.packageName}" wsdlPathAnnotation="."/>
+        <webservice-control-gen srcDir="${rpc.schema.dir}" destDir="${jcxgen.dir}"
+               destPackageName="${testmodel.client.jcxgen.packageName}" wsdlRuntimePath="."/>
 
         <!-- have the wsdls, next to the jcx files -->
         <copy todir="${jcxgen.dir}/${testmodel.client.jcxgen.packageName}">

Modified: beehive/trunk/system-controls/samples/webservice/xmlbeans/build.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/samples/webservice/xmlbeans/build.xml?rev=367366&r1=367365&r2=367366&view=diff
==============================================================================
--- beehive/trunk/system-controls/samples/webservice/xmlbeans/build.xml (original)
+++ beehive/trunk/system-controls/samples/webservice/xmlbeans/build.xml Mon Jan  9 11:27:37 2006
@@ -85,16 +85,16 @@
 
     <target name="gen_jcx" depends="gen_xmlbeans">
 
-        <path id="scgen.dependencies">
+        <path id="wscgen.dependencies">
             <path refid="build.classpath" />
             <pathelement location="${build.classes}" />
         </path>
 
-        <taskdef name="scgen"
-                 classname="org.apache.beehive.controls.system.webservice.generator.ServiceControlGeneratorTask"
-                 classpathref="scgen.dependencies"/>
+        <taskdef name="webservice-control-gen"
+                 classname="org.apache.beehive.controls.system.webservice.generator.WebServiceControlGeneratorTask"
+                 classpathref="wscgen.dependencies"/>
 
-      <scgen srcDir="${schema.dir}" destDir="${jcxgen.dir}"/>
+      <webservice-control-gen srcDir="${schema.dir}" destDir="${jcxgen.dir}"/>
     </target>
 
     <target name="build_jcx" depends="gen_jcx">

Copied: beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/WebServiceControlGenerator.java (from r366535, beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/ServiceControlGenerator.java)
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/WebServiceControlGenerator.java?p2=beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/WebServiceControlGenerator.java&p1=beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/ServiceControlGenerator.java&r1=366535&r2=367366&rev=367366&view=diff
==============================================================================
--- beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/ServiceControlGenerator.java (original)
+++ beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/WebServiceControlGenerator.java Mon Jan  9 11:27:37 2006
@@ -44,10 +44,10 @@
 /**
  * Generate a service control from a WSDL using Velocity.
  */
-public final class ServiceControlGenerator {
+public final class WebServiceControlGenerator {
 
     /*
-    todo: it seems bad that the service control needs explicit knowledge of
+          todo: it seems bad that the service control needs explicit knowledge of
           the type system used to implement the web service.  Probably need to
           fix this.
     */
@@ -67,14 +67,14 @@
      * @param wsdlDirectory      Directory of WSDLs to process.
      * @param pkgName            Package name of generated controls. If null, package name will be generated
      *                           from the WSDL's target namespace.
-     * @param wsdlPathAnnotation WSDL path annotation value for generated controls.
+     * @param wsdlRuntimePath WSDL path annotation value for generated controls.
      * @throws Exception
      */
-    static void generateJCXs(File wsdlDirectory, File outputDir, String pkgName, String wsdlPathAnnotation)
+    static void generateJCXs(File wsdlDirectory, File outputDir, String pkgName, String wsdlRuntimePath)
             throws Exception {
         assert wsdlDirectory.isDirectory() : "wsdlLocation must be a directory!";
         for (File wsdlFile : wsdlDirectory.listFiles(FILE_FILTER_WSDL)) {
-            generateJCX(wsdlFile, outputDir, pkgName, wsdlPathAnnotation);
+            generateJCX(wsdlFile, outputDir, pkgName, wsdlRuntimePath, null, null);
         }
     }
 
@@ -84,21 +84,26 @@
      * @param wsdlFile           A WSDL file.
      * @param pkgName            Package name of generated controls. If null, package name will be generated
      *                           from the WSDL's target namespace.
-     * @param wsdlPathAnnotation WSDL path annotation value for generated control.
+     * @param wsdlRuntimePath WSDL path annotation value for generated control.
+     * @param serviceQName        Name of the service to generate the control.
+     * @param servicePortName     Name of the service port used to generate the control.
      * @throws Exception
      */
-    static void generateJCX(File wsdlFile, File outputDir, String pkgName, String wsdlPathAnnotation)
+    static void generateJCX(File wsdlFile, File outputDir, String pkgName,
+                            String wsdlRuntimePath, QName serviceQName, String servicePortName)
             throws Exception {
         assert wsdlFile.isFile() : "wsdlFile must be a file!";
         final String wsdlPath;
 
-        Wsdl wsdl = new Wsdl(wsdlFile.toURI());
+        // load and parse the WSDL file
+        Wsdl wsdl = new Wsdl(wsdlFile.toURI(), serviceQName, servicePortName);
+
         if (pkgName == null) {
             pkgName = GeneratorUtils.generatePackageName(wsdl.getTargetNamespace());
         }
 
-        if (wsdlPathAnnotation != null) {
-            wsdlPath = genWsdlPath(wsdlPathAnnotation + File.separatorChar + wsdlFile.getName());
+        if (wsdlRuntimePath != null) {
+            wsdlPath = genWsdlPath(wsdlRuntimePath + File.separatorChar + wsdlFile.getName());
         }
         else {
             wsdlPath = wsdlFile.toURL().toString();
@@ -237,6 +242,13 @@
         return methodList;
     }
 
+    /**
+     *
+     * @param xmlType
+     * @param itemXmlType
+     * @param isArray
+     * @return
+     */
     static private Class getClass(QName xmlType, QName itemXmlType, boolean isArray) {
 
         if (xmlType == null) {

Propchange: beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/WebServiceControlGenerator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/WebServiceControlGeneratorTask.java (from r366535, beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/ServiceControlGeneratorTask.java)
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/WebServiceControlGeneratorTask.java?p2=beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/WebServiceControlGeneratorTask.java&p1=beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/ServiceControlGeneratorTask.java&r1=366535&r2=367366&rev=367366&view=diff
==============================================================================
--- beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/ServiceControlGeneratorTask.java (original)
+++ beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/generator/WebServiceControlGeneratorTask.java Mon Jan  9 11:27:37 2006
@@ -21,60 +21,63 @@
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Task;
 
+import javax.xml.namespace.QName;
 import java.io.File;
 
+// todo: Add a bunch more JavaDoc on how this task works!
 /**
  * The Webservice Control Generator task generates a web service control from a WSDL.
  * <xmp>
- * <taskdef name="service-control-gen"
- *          classname="org.apache.beehive.controls.system.webservice.generate.ServiceControlGenerationTask"
- *          classpathref="scgen.dependency.path"/>
+ * <taskdef name="webservice-control-gen"
+ * classname="org.apache.beehive.controls.system.webservice.generate.ServiceControlGenerationTask"
+ * classpathref="wscgen.dependency.path"/>
  * <p/>
  * <p/>
  * <service-control-gen srcDir="${build.wsdls}"
- *                      destDir="${build.jcxgen}"
- *                      destPackageName="${pkg.name}"
- *                      wsdlPathAnnotation=${annot}"/>
+ * destDir="${build.jcxgen}"
+ * destPackageName="${pkg.name}"
+ * wsdlRuntimePath=${annot}"/>
  * </xmp>
  */
-public final class ServiceControlGeneratorTask
-    extends Task {
+public final class WebServiceControlGeneratorTask
+        extends Task {
 
     private File _srcfile;
     private File _srcdir;
     private File _destdir;
 
     private String _destPackageName;
-    private String _wsdlPathAnnotation;
+    private String _wsdlRuntimePath;
+    private String _serviceName;
+    private String _serviceNamespace;
+    private String _servicePortName;
 
-    //@todo: should add settings for service name and binding name
     //@todo: add option for copying wsdl to location of generated webservice control
     //@todo: add option to compile generated service control
 
     /**
-     * Create a new ServiceControlGeneratorTask.
+     * Create a new WebServiceControlGeneratorTask.
      */
-    public ServiceControlGeneratorTask()
-    {
+    public WebServiceControlGeneratorTask() {
         // do nothing
     }
 
     /**
      * Set the source file (wsdl) to generate the service control from.
+     *
      * @param srcfile WSDL used to generate a service control.
      */
-    public void setSrcfile(File srcfile)
-    {
+    public void setSrcfile(File srcfile) {
         _srcfile = srcfile;
     }
 
     /**
      * Set the source directory to generate service control(s) from.  All WSDL files
      * in the directory will be processed, each one producing a service control.
+     *
      * @param srcdir The directory to process WSDLs in.
      */
-    public void setSrcdir(File srcdir)
-    {
+    public void setSrcdir(File srcdir) {
         _srcdir = srcdir;
     }
 
@@ -82,41 +85,71 @@
      * Set the destination directory for the generated service controls.
      * The directory specified will be the base generation dir, if destPackageName is specified
      * the appropriate sub-directories will be created in it.
+     *
      * @param destdir Location to create service control(s).
      */
-    public void setDestdir(File destdir)
-    {
+    public void setDestdir(File destdir) {
         _destdir = destdir;
     }
 
     /**
      * The java package name for generated service controls.  If not set the generated controls
      * the package name will be generated from the target namespace of the WSDL.
+     *
      * @param destPackageName Java package name. Package names may be of arbitrary depth, ex. xxx.yyy.zzz
      */
-    public void setDestPackageName(String destPackageName)
-    {
+    public void setDestPackageName(String destPackageName) {
         _destPackageName = destPackageName;
     }
 
     /**
-     * The generated service control's include a class-level annotation  which describes the physical
-     * location of the WSDL the control was generated from.  This value may be in the form of a URL or
-     * fully qualified location within the classpath of the application at runtime.  The webservice control
-     * requires that the WSDL is accessible to it at runtime.  It is not necessary to include the name of the
-     * WSDL, just its path information.
-     * @param wsdlPathAnnotation The value for the WSDL path annotation.
-     */
-    public void setWsdlPathAnnotation(String wsdlPathAnnotation)
-    {
-        _wsdlPathAnnotation = wsdlPathAnnotation;
+     * A WSDL file may contain multiple services, this value specifies the service name of the service
+     * which should be used to generate the web service control.  This is an optional value, if not specified
+     * the first service found in the WSDL file will be used to generate the control. This value may only be used
+     * when the input WSDL has been specified using the srcFile task attribute.
+     *
+     * @param serviceName Name of service to generate web service control from.
+     */
+    public void setServiceName(String serviceName) {
+        _serviceName = serviceName;
+    }
+
+    /**
+     * This value can be used in conjunction with the serviceName value to define a qualified QName value
+     * for the name of the service. If the serviceName attribute has NOT been set the value of serviceNamespace
+     * will be ignored.
+     *
+     * @param serviceNamespace Namespace of the service.
+     */
+    public void setServiceNamespace(String serviceNamespace) {
+        _serviceNamespace = serviceNamespace;
+    }
+
+    /**
+     * This value can be used to specify the name of the port of a specific service to use.  This is an
+     * optional value if not specified the first port defined in the service will be used.
+     *
+     * @param servicePortName Name of the service port to use in control generation.
+     */
+    public void setServicePort(String servicePortName) {
+        _servicePortName = servicePortName;
+    }
+
+    /**
+     * A web service control needs to be able to locate the WSDL it was generated from at runtime. This value may be
+     * in the form of a URL or fully qualified location within the classpath of the application at runtime.  It is
+     * not necessary to include the name of the WSDL, just its path information.
+     *
+     * @param wsdlRuntimePath The value for the WSDL path annotation.
+     */
+    public void setWsdlRuntimePath(String wsdlRuntimePath) {
+        _wsdlRuntimePath = wsdlRuntimePath;
     }
 
     /**
      * Execute this task.
      */
-    public void execute()
-    {
+    public void execute() {
         validateAttributeSettings();
 
         // xmlbeans does not use the AntClassLoader if defined when parsing
@@ -128,13 +161,21 @@
             ((AntClassLoader) cl).setThreadContextLoader();
         }
 
+        QName serviceQName = null;
+        if (_serviceName != null) {
+            serviceQName = new QName(_serviceNamespace, _serviceName);
+        }
+
         try {
             if (_srcfile != null) {
-                ServiceControlGenerator.generateJCX(_srcfile, _destdir, _destPackageName, _wsdlPathAnnotation);
-            } else {
-                ServiceControlGenerator.generateJCXs(_srcdir, _destdir, _destPackageName, _wsdlPathAnnotation);
+                WebServiceControlGenerator.generateJCX(_srcfile, _destdir, _destPackageName,
+                                                    _wsdlRuntimePath, serviceQName, _servicePortName);
             }
-        } catch (Exception e) {
+            else {
+                WebServiceControlGenerator.generateJCXs(_srcdir, _destdir, _destPackageName, _wsdlRuntimePath);
+            }
+        }
+        catch (Exception e) {
             e.printStackTrace();
             throw new BuildException("Service control generation failed.", e);
         } finally {
@@ -147,8 +188,7 @@
     /**
      * Validate the attribute settings.
      */
-    private void validateAttributeSettings()
-    {
+    private void validateAttributeSettings() {
 
         if (_srcfile == null && _srcdir == null) {
             throw new BuildException("The srcFile or srcDir attribute must be set");
@@ -160,6 +200,10 @@
 
         if (_srcfile != null && !_srcfile.isFile()) {
             throw new BuildException("The srcFile must be a file");
+        }
+
+        if (_srcfile == null && _serviceName != null) {
+            throw new BuildException("The serviceName attribute can only be used with the srcFile attribute");
         }
 
         if (_srcdir != null && !_srcdir.isDirectory()) {

Modified: beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/wsdl/Wsdl.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/wsdl/Wsdl.java?rev=367366&r1=367365&r2=367366&view=diff
==============================================================================
--- beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/wsdl/Wsdl.java (original)
+++ beehive/trunk/system-controls/src/webservice/control/org/apache/beehive/controls/system/webservice/wsdl/Wsdl.java Mon Jan  9 11:27:37 2006
@@ -45,12 +45,13 @@
     private HashMap<String, WsdlOperation> _operationCache;
 
     /**
-     * Loads and parses the specified WSDL file. Default to the first service found
-     * in the wsdl and the first port type found for that service.
+     * Loads and parses the specified WSDL file.
      *
-     * @param wsdlURI URI of a WSDL file.
+     * @param wsdlURI      URI of a WSDL file.
+     * @param serviceQName Name of the service in the WSDL, if null default to first service in WSDL.
+     * @param portName     The service port name, if null default to first port in service.
      */
-    public Wsdl(URI wsdlURI) {
+    public Wsdl(URI wsdlURI, QName serviceQName, String portName) {
 
         try {
             _wsdlDefinition = parse(wsdlURI);
@@ -59,8 +60,26 @@
             throw new TypeNotPresentException("Could not load WSDL file: " + e.getMessage(), e);
         }
 
-        _service = (Service) _wsdlDefinition.getServices().values().iterator().next();
-        _port = (Port) _service.getPorts().values().iterator().next();
+        if (serviceQName == null) {
+            _service = (Service) _wsdlDefinition.getServices().values().iterator().next();
+        } else {
+            _service = _wsdlDefinition.getService(serviceQName);
+            if (_service == null) {
+                throw new IllegalArgumentException("Service: " + serviceQName
+                        + " is not defined in the WSDL file " + wsdlURI);
+            }
+        }
+
+        if (portName == null) {
+            _port = (Port) _service.getPorts().values().iterator().next();
+        } else {
+            _port = _service.getPort(portName);
+            if (_port == null) {
+                throw new IllegalArgumentException("Port: " + portName
+                        + " is not defined in the service: " + serviceQName);
+            }
+        }
+
         _operationCache = new HashMap<String, WsdlOperation>();
         _namespaceResolver = new WsdlNamespaceResolver(_wsdlDefinition);
     }
@@ -88,8 +107,12 @@
         }
 
         _port = _service.getPort(portName);
-        _operationCache = new HashMap<String, WsdlOperation>();
+        if (_port == null) {
+            throw new IllegalArgumentException("Port: " + portName
+                    + " is not defined in the service: " + serviceQName);
+        }
 
+        _operationCache = new HashMap<String, WsdlOperation>();
         _namespaceResolver = new WsdlNamespaceResolver(_wsdlDefinition);
     }
 

Modified: beehive/trunk/system-controls/test/webservice/build.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/test/webservice/build.xml?rev=367366&r1=367365&r2=367366&view=diff
==============================================================================
--- beehive/trunk/system-controls/test/webservice/build.xml (original)
+++ beehive/trunk/system-controls/test/webservice/build.xml Mon Jan  9 11:27:37 2006
@@ -235,8 +235,8 @@
                  classname="org.apache.xmlbeans.impl.tool.XMLBean"
                  classpathref="xbean.dependency.path"/>
 
-        <taskdef name="scgen"
-                 classname="org.apache.beehive.controls.system.webservice.generator.ServiceControlGeneratorTask"
+        <taskdef name="webservice-control-gen"
+                 classname="org.apache.beehive.controls.system.webservice.generator.WebServiceControlGeneratorTask"
                  classpathref="client.classpath"/>
 
         <!-- TODO: add support for ignoreDuplicates to build-schemas macro? -->
@@ -259,8 +259,8 @@
 
         <javac srcdir="${client.axisgen}" destdir="${client.classes}" classpathref="client.classpath" debug="true"/>
 
-        <scgen srcdir="${wsdls.dir}" destdir="${client.jcxgensrc}" destPackageName="${client.jcxgen.packageName}"/>
-        <scgen srcdir="${rpc.encoded.wsdls.dir}" destdir="${client.jcxgensrc}" destPackageName="${client.jcxgen.packageName}"/>
+        <webservice-control-gen srcdir="${wsdls.dir}" destdir="${client.jcxgensrc}" destPackageName="${client.jcxgen.packageName}"/>
+        <webservice-control-gen srcdir="${rpc.encoded.wsdls.dir}" destdir="${client.jcxgensrc}" destPackageName="${client.jcxgen.packageName}"/>
 
         <copy todir="${client.jcxgensrc}/${client.jcxgen.packageName}">
             <fileset dir="${wsdls.dir}" includes="*.wsdl"/>

Modified: beehive/trunk/system-controls/test/webservice/junit/build.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/test/webservice/junit/build.xml?rev=367366&r1=367365&r2=367366&view=diff
==============================================================================
--- beehive/trunk/system-controls/test/webservice/junit/build.xml (original)
+++ beehive/trunk/system-controls/test/webservice/junit/build.xml Mon Jan  9 11:27:37 2006
@@ -89,11 +89,11 @@
     </target>
 
     <target name="generate_wscs" depends="gen_xmlbeans" description="Generate web service controls for JUnit tests">
-        <taskdef name="scgen"
-                 classname="org.apache.beehive.controls.system.webservice.generator.ServiceControlGeneratorTask"
+        <taskdef name="webservice-control-gen"
+                 classname="org.apache.beehive.controls.system.webservice.generator.WebServiceControlGeneratorTask"
                  classpathref="wscgen.classpath"/>
 
-        <scgen srcdir="${wsdls.dir}" destdir="${wscgen.gensrc}"/>
+        <webservice-control-gen srcdir="${wsdls.dir}" destdir="${wscgen.gensrc}"/>
     </target>
 
     <target name="gen_xmlbeans" depends="checkxbean" unless="noxbeanrebuild">