axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Derek Eichele <eiche...@swbell.net>
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="http://schemas.xmlsoap.org/wsdl/" 
xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="urn:Test" 
xmlns:intf="urn:Test" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 <wsdl:types/>

   <wsdl:message name="getValRequest">

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

   </wsdl:message>

   <wsdl:message name="getValResponse">

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

   </wsdl:message>

   <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:operation>

   </wsdl:portType>

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

      <wsdlsoap:binding style="rpc" 
transport="http://schemas.xmlsoap.org/soap/http"/>

      <wsdl:operation name="getVal">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="getValRequest">

            <wsdlsoap:body 
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
namespace="urn:Test" use="encoded"/>

         </wsdl:input>

         <wsdl:output name="getValResponse">

            <wsdlsoap:body 
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
namespace="urn:Test" use="encoded"/>

         </wsdl:output>

      </wsdl:operation>

   </wsdl:binding>

   <wsdl:service name="TestService">

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

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

      </wsdl:port>

   </wsdl:service>

</wsdl:definitions>

------- 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 TestService.java as an example :

/**
 * TestService.java
 *
 * 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(java.net.URL portAddress) throws 
javax.xml.rpc.ServiceException;
}

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.

Derek.



Mime
View raw message