views:

688

answers:

3

I use the wsdlc tool (weblogic 10.3.1) to generate classes from wsdl. I have the following external jaxb bindings customization file:

<jaxb:bindings
    xmlns="http://java.sun.com/xml/ns/jaxb"
    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
    schemaLocation="web/WEB-INF/....xsd"
    version="2.1">

    <jaxb:bindings node="/xs:schema">
     <jaxb:globalBindings>
      <xjc:superClass name="my.MySuperClass" />
     </jaxb:globalBindings>
    </jaxb:bindings>
</jaxb:bindings>

The error message on complilation is: cannot find symbol my.MySuperClass. And from javac: "package my does not exist". The classpath = everything I include via <pathelement location= etc. and 60 lines from eclipse plugins. The problem lies in the javac command that wsdlc initiates. The classpath of this command is correct (hard coded paths e.g.) but still "package ... does not exist".

The usage of wsdlc from ant is like so:

<path id="class.path">
  <pathelement path="${java.class.path}" />
  <pathelement location="... hard coded path on disk to a jar" />
</path>

<target name="generate-ws-from-wsdl">
<wsdlc failOnError="true"
       srcWsdl="${basedir}/web/WEB-INF/ps.wsdl"
       destImplDir="${basedir}/src"
       destJwsDir="${basedir}/web/WEB-INF/lib"
       srcPortName="PsPort"
       type="JAXWS">
    <binding file="jaxb-bindings.xml" />
    <classpath refid="class.path" />
</wsdlc>
</target>
+1  A: 

my.SuperClass has to exist already, wsdlc won't generate it for you. When it comes to compiling the generated code (which is where I assume is what is failing here), it's because javac can't find my.SuperClass in its classpath.

skaffman
the class exists under the src tree, i run from ant, perhaps i should change the classpath there?
Gerard
That would seem like a good place to look, yes
skaffman
+1  A: 

Please provide the excerpt of the build.xml showing how you use use the wsdlc.

According to the documentation:

In addition to the WebLogic-specific wsdlc attributes, you can also define the following standard javac attributes; see the Ant documentation for additional information about each attribute:

  • bootclasspath
  • bootClasspathRef
  • classpath
  • [...]

You can also use the following standard Ant child elements with the wsdlc Ant task:

  • <FileSet>
  • <SourcePath>
  • <Classpath>

Did you specify the classpath to include my.SuperClass?

Pascal Thivent
see my edit, my superclass is in java src tree, all generated files end up in a jar under web/WEB-INF/lib/..._wsdl.jar
Gerard
A: 

I didn't jar my classes properly, I thought I could use WinZip to quickly add some classes to a jar, but the 'path' in WinZip was not equal to the package name in java. It took me a while but I learned something about classpaths.

Gerard
Use winrar for dirty things like this :) At least, the problem is solved now.
Pascal Thivent