axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Derek Eichele <>
Subject Java2WSDL/WSDL2Java question
Date Tue, 26 Nov 2002 20:05:10 GMT
I am attempting to learn how to use Java2WSDL and WSDL2Java properly, 
but it isn't coming easily. I always get odd type names that I am forced 
to edit every time I generate code. I created a simple test case for 
demonstrative purposes, if anyone can tell me what I am doing wrong, I 
would appreciate it.

First I start with a very simple Java interface :

    public interface Test extends java.rmi.Remote {
        public int getVal(int in0) throws java.rmi.RemoteException;

Then, I run the following command on the interface:

                java org.apache.axis.wsdl.Java2WSDL -o test.wsdl  
-l"http://localhost/axis/services/Test" -n  "urn:Test" Test

Which generates my wsdl:

------- Begin WSDL --------

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="urn:Test" 
xmlns:apachesoap="" xmlns:impl="urn:Test" 

   <wsdl:message name="getValRequest">

      <wsdl:part name="in0" type="xsd:int"/>


   <wsdl:message name="getValResponse">

      <wsdl:part name="getValReturn" type="xsd:int"/>


   <wsdl:portType name="Test">

      <wsdl:operation name="getVal" parameterOrder="in0">

         <wsdl:input message="intf:getValRequest" name="getValRequest"/>

         <wsdl:output message="intf:getValResponse" name="getValResponse"/>



   <wsdl:binding name="TestSoapBinding" type="intf:Test">

      <wsdlsoap:binding style="rpc" 

      <wsdl:operation name="getVal">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="getValRequest">

namespace="urn:Test" use="encoded"/>


         <wsdl:output name="getValResponse">

namespace="urn:Test" use="encoded"/>




   <wsdl:service name="TestService">

      <wsdl:port binding="intf:TestSoapBinding" name="Test">

         <wsdlsoap:address location="http://localhost/axis/services/Test"/>




------- End WSDL -------

Finally, I will then run this command to generate the server side code :

java org.apache.axis.wsdl.WSDL2Java -o . -D -s -S true  test.wsdl

This creates a subdirectory called Test, and places the code there, and 
the files have the correct package definitions in them. But ......

The code for some of the files contains uncompilable code when refering 
to the created types, here is as an example :

 * This file was auto-generated from WSDL
 * by the Apache Axis WSDL2Java emitter.

package Test;

public interface TestService extends javax.xml.rpc.Service {
    public java.lang.String getTestAddress();

    public Test.Test getTest() throws javax.xml.rpc.ServiceException;

    public Test.Test getTest( portAddress) throws 

The "Test.Test" gives me a bad type error when compiling. I have tried 
many different options with both tools trying to determine if it is 
something that I am doing that is causing this, but have had no luck. Do 
I have a fundamental misunderstanding? Am I missing an option on one of 
my commands? Any help would be appreciated.


View raw message