My experience is similar.  Even if there is just one build.xml, wsgen does not 
use basedir.  It uses the directory containing the build.xml as the current 
directory.  You would need to put your path to the file relative to that.
 

----- Original Message ----
From: Jose Manuel Valladares <[EMAIL PROTECTED]>
To: [email protected]
Sent: Tuesday, January 16, 2007 5:11:45 AM
Subject: [xfire-user] wsgen task doesn't get the correct basedir

Hello,
I am using an ant task that calls several other ant tasks to generate the java 
classes from wsdl files for several services.

The problem is that wsgen gets its basedir from the main ant task not from the 
child ant task. No matter what I do, wsgen always gets the wrong basedir.

Let me show you the build.xml files.

First the main build.xml:

<project name="Generate OTA" basedir="." default="generate-jars-axis1">
  <target name="w2j-xfire">
    <ant dir="OTA_Cancel" antfile="build.xml" inheritall="false" 
target="w2j-xfire"/>
    <ant dir="OTA_HotelAvail" antfile="build.xml" inheritall="false" 
target="w2j-xfire"/>
    <ant dir="OTA_HotelDescriptiveInfo" antfile="build.xml" inheritall="false" 
target="w2j-xfire"/>
  </target>
</project>


Now, one of the child build.xml located in the directory OTA_Cancel from the 
main build.xml:

<project name="cancel-xota" basedir="."  default="w2j">
  <property name="ota_operation" value="OTA_Cancel"/>
  <property name="wsdlfile" value="${ota_operation}.wsdl"/>

  <!-- XFIRE -->
  <target name="w2j-xfire">
    <property name="xfire.dir" value="${env.XFIRE_HOME}"/>
    <property name="xmlbeans.dir" value="${env.XMLBEANS_HOME}"/>

    <path id="xmlbeans.classpath">
      <fileset dir="${xmlbeans.dir}/lib">
        <include name="**/*.jar" />
      </fileset>
    </path>

    <taskdef name="xmlbean" classname="org.apache.xmlbeans.impl.tool.XMLBean" 
classpathref="xmlbeans.classpath" />

    <mkdir dir="xfire"/>
    <xmlbean classpathref="xmlbeans.classpath" classgendir="xfire/classes" 
failonerror="true" srcgendir="xfire/src" memoryMaximumSize="256m">
      <fileset dir="xsd" includes="*.xsd"/>
    </xmlbean>

    <path id="xfire.classpath">
      <fileset dir="${xfire.dir}/lib">
        <include name="**/*.jar" />
      </fileset>
      <fileset dir="${xfire.dir}">
        <include name="*.jar" />
      </fileset>
      <pathelement location="xfire/classes" />
    </path>

    <taskdef name="wsgen" classname="org.codehaus.xfire.gen.WsGenTask" 
classpathref="xfire.classpath" />
    <wsgen outputDirectory="xfire/src" wsdl="./${wsdlfile}" 
package="com.mirai.otageneric.${ota_operation}" binding="xmlbeans" 
overwrite="true"/>

    <javac srcdir="xfire/src" destdir="xfire/classes" source="1.5" 
target="1.5" debug="on" deprecation="on" encoding="ISO-8859-1">
      <classpath refid="xfire.classpath"/>
      <include name="com/**/*.java" />
    </javac>
  </target>
</project>


The wsdl file is located in the OTA_Cancel directory:
-->    OTA_Cancel/OTA_Cancel.wsdl


When I run
       ant w2j-xfire


I get the exception:

  [xmlbean] Time to compile code: 17.907 seconds
  [wsgen] Resovling. Base: null, URI: ./OTA_Cancel.wsdl

BUILD FAILED
/home/jmanuel/workspace/XOTA/build.xml:67: The following error occurred while 
executing this line:
/home/jmanuel/workspace/XOTA/OTA_Cancel/build.xml:69: java.io.IOException: 
Could not find resource './OTA_Cancel.wsdl


If I put the wsdl file: OTA_Cancel.wsdl in the main build.xml folder it works, 
but gives me another error later on.
Well, it seems clear to me that wsgen gets the folder from the parent 
build.xml instead of the called build.xml.
This behaviour is different from the other ant tasks.

Is there a way to tell wsgen where the base dir is located?
Or do I have to specify the whole path of the wsdl file from the root 
directory?

Thank you very much for your time.

                  Manuel Valladares

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email





---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to