[ 
http://issues.apache.org/jira/browse/AXIS-1734?page=comments#action_60302 ]
     
Ephemeris Lappis commented on AXIS-1734:
----------------------------------------

The zip i had already attached is just what you need to reproduce the problem. 
In it, the build.xml is more or less what should be a real script. The 
java2wsdl task has an inner classpath that points to the project's class files. 
In this classpath, java2wsdl actually resolves the main service interface 
class, but the exception and javabean are not found.

<java2wsdl output="axis2.wsdl"
        className="my.ws.Endpoint"
        namespace="${my.namespace}"
        portTypeName="SampleService"
        servicePortName="SampleServicePort"
        serviceElementName="MyService"
        style="DOCUMENT"
        use="LITERAL"
        location="http://ws.moon.net/axis2";>
    <classpath>
        <pathelement location="Classes" />
        <path refid="my.axis.classpath" />
        </classpath>
        <mapping
            package="my.ws"
            namespace="${my.namespace}" />
        <complextype
            classname="my.ws.Structure"
            namespace="${my.namespace}" />
</java2wsdl>

The only way i found to make it work is adding the same directory to the 
taskdef classpath.

<path id="my.axis.classpath">
    <fileset dir="E:\TEMPORARY\axis-1_2RC2\lib">
        <include name="*.jar" />
    </fileset>
    <!-- ADDED FOR JAVA2WSDL TO RESOLVE MY CLASSES -->
    <pathelement location="Classes"/>
</path>

<taskdef name="java2wsdl"
    classname="org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask"
classpathref="my.axis.classpath" />

I can obviously open a new report, but it's going to be an exact copy of this 
one.
Tell me if you want more details.

Regards.

> JAVA2WSDL (ant) with document/literal encoding
> ----------------------------------------------
>
>          Key: AXIS-1734
>          URL: http://issues.apache.org/jira/browse/AXIS-1734
>      Project: Axis
>         Type: Bug
>   Components: WSDL processing
>     Versions: 1.2 Beta, 1.2RC2
>  Environment: Windows 2K SP4 / Ant 1.6 within Eclipse 3.0.1
> JDK 1.4.2_01-b06
>     Reporter: Ephemeris Lappis
>     Assignee: Davanum Srinivas
>  Attachments: AXIS-2.zip
>
> WSDL generation from Java, using document/literal encoding doesn't work when 
> the code uses custom data types and exceptions. Code for the endpoint 
> interface, the data type and exception are copied at the end of the message.
> From a first simple script, and then adding explicit mapping or complex type 
> tags, i did'nt find and way to make the generation work for this 'basic' 
> example :
> Case 1 :
> --------
> In the ant task, if i just set the service interface classname, java2wsdl 
> displays out messages, asking for mappings for my exception and data types :
>       <target name="wsdl">
>               <property name="my.namespace" value="http://ws.moon.net/axis2"; 
> />
>               <java2wsdl output="axis2.wsdl"
>                          className="my.ws.Endpoint"
>                          namespace="${my.namespace}"
>                          portTypeName="SampleService"
>                          servicePortName="SampleServicePort"
>                          serviceElementName="MyService"
>                          style="DOCUMENT"
>                          use="LITERAL"
>                          location="http://ws.moon.net/axis2";>
>                       <classpath>
>                               <pathelement location="Classes" />
>                               <path refid="my.axis.classpath" />
>                       </classpath>
>               </java2wsdl>
>       </target>
> Console :
> [java2wsdl] - Unable to find required classes (javax.activation.DataHandler 
> and javax.mail.internet.MimeMultipart). Attachment support is disabled.
> [java2wsdl] Java2WSDL my.ws.Endpoint
> [java2wsdl] - Please register a typemapping/beanmapping for 'my.ws.Structure'
> [java2wsdl] - Please register a typemapping/beanmapping for 
> 'my.ws.ProblemException'
> Case 2 :
> ------
> If i add an explicit mapping on the package, the result is the same.
>       <target name="wsdl">
>               <property name="my.namespace" value="http://ws.moon.net/axis2"; 
> />
>               <java2wsdl output="axis2.wsdl"
>                          className="my.ws.Endpoint"
>                          namespace="${my.namespace}"
>                          portTypeName="SampleService"
>                          servicePortName="SampleServicePort"
>                          serviceElementName="MyService"
>                          style="DOCUMENT"
>                          use="LITERAL"
>                          location="http://ws.moon.net/axis2";>
>                       <classpath>
>                               <pathelement location="Classes" />
>                               <path refid="my.axis.classpath" />
>                       </classpath>
>                       <mapping package="my.ws" namespace="${my.namespace}" />
>               </java2wsdl>
>       </target>
> Case 3 :
> ------
> I add an explicit complex type tag for my data type. Axis task fails on 
> resolving the data type class.
>       <target name="wsdl">
>               <property name="my.namespace" value="http://ws.moon.net/axis2"; 
> />
>               <java2wsdl output="axis2.wsdl"
>                          className="my.ws.Endpoint"
>                          namespace="${my.namespace}"
>                          portTypeName="SampleService"
>                          servicePortName="SampleServicePort"
>                          serviceElementName="MyService"
>                          style="DOCUMENT"
>                          use="LITERAL"
>                          location="http://ws.moon.net/axis2";>
>                       <classpath>
>                               <pathelement location="Classes" />
>                               <path refid="my.axis.classpath" />
>                       </classpath>
>                       <mapping package="my.ws" namespace="${my.namespace}" />
>                       <complextype classname="my.ws.Structure"
>                                    namespace="${my.namespace}" />
>               </java2wsdl>
>       </target>
> Console :
> [java2wsdl] - Unable to find required classes (javax.activation.DataHandler 
> and javax.mail.internet.MimeMultipart). Attachment support is disabled.
> [java2wsdl] Java2WSDL my.ws.Endpoint
> [java2wsdl] java.lang.ClassNotFoundException: my.ws.Structure
> [java2wsdl]   at 
> org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1149)
> [java2wsdl]   at 
> org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1090)
> [java2wsdl]   at 
> org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:960)
> [java2wsdl]   at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
> [java2wsdl]   at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
> [java2wsdl]   at java.lang.Class.forName0(Native Method)
> [java2wsdl]   at java.lang.Class.forName(Class.java:141)
> [java2wsdl]   at 
> org.apache.axis.tools.ant.wsdl.ComplexType.register(ComplexType.java:52)
> [java2wsdl]   at 
> org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask.execute(Java2WsdlAntTask.java:206)
> [java2wsdl]   at 
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
> [java2wsdl]   at org.apache.tools.ant.Task.perform(Task.java:364)
> [java2wsdl]   at org.apache.tools.ant.Target.execute(Target.java:341)
> [java2wsdl]   at org.apache.tools.ant.Target.performTasks(Target.java:369)
> [java2wsdl]   at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
> [java2wsdl]   at 
> org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:379)
> [java2wsdl]   at 
> org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:135)
> BUILD FAILED: 
> D:\Data\Philippe\Atelier\Java\Eclipse-Workspace\AXIS-2\build.xml:25: Error 
> while running org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask
> --- my/ws/Endpoint.java ---
> package my.ws;
> import java.rmi.Remote;
> import java.rmi.RemoteException;
> public interface Endpoint extends Remote {
>       public String operation(Structure structure) throws ProblemException, 
> RemoteException;
> }
> --- my/ws/Structure.java ---
> package my.ws;
> import java.io.Serializable;
> public class Structure implements Serializable {
>       private String String;
>       private int integer;
>       public Structure() {
>               this(null, 0);
>       }
>       public Structure(final String string, final int integer) {
>               setString(string);
>               setInteger(integer);
>       }
>       public void setString(final String string) {
>               String = string;
>       }
>       public String getString() {
>               return String;
>       }
>       public void setInteger(final int integer) {
>               this.integer = integer;
>       }
>       public int getInteger() {
>               return integer;
>       }
> }
> --- my/ws/ProblemException.java ---
> package my.ws;
> public class ProblemException extends Exception {
>       public ProblemException(final String message) {
>               super(message);
>       }
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira

Reply via email to