5 Replies Latest reply on Sep 19, 2007 12:05 AM by Thomas Diesler

    Two webservice classes define method with same name (bug?)

    GB DT Newbie

      Hi,
      I have a test case in which I get wrong WSDLs:
      (Both classes are in the same package)

      File1:

      package com.XXXX;
      
      import javax.ejb.Stateless;
      import javax.jws.WebMethod;
      import javax.jws.WebParam;
      import javax.jws.WebService;
      
      @WebService
      @Stateless
      public class TestClass1 {
      
       @WebMethod
       public ****Integer**** method(@WebParam(name="f")Float f) {
       return null;
       }
      }
      


      File2:
      package com.XXXX;
      
      import javax.ejb.Stateless;
      import javax.jws.WebMethod;
      import javax.jws.WebParam;
      import javax.jws.WebService;
      
      @WebService
      @Stateless
      public class TestClass2 {
      
       @WebMethod
       public ****Double**** method(@WebParam(name="f")Float f) {
       return 17.0;
       }
      }
      


      The problem is that for both services the WSDL definition of the return type is xs:int, while for the second class it should be a double.

      For TestClass1:
      <types>
      <xs:schema targetNamespace="http://XXXX.com/" version="1.0" xmlns:tns="http://XXXX.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
       <xs:element name="method" type="tns:method" />
       <xs:element name="methodResponse" type="tns:methodResponse" />
       <xs:complexType name="method">
       <xs:sequence>
       <xs:element minOccurs="0" name="f" type="xs:float" />
       </xs:sequence>
       </xs:complexType>
       <xs:complexType name="methodResponse">
       <xs:sequence>
       <xs:element minOccurs="0" name="return" type="****xs:int****" />
       </xs:sequence>
       </xs:complexType>
       </xs:schema>
       </types>
      


      And for TestClass2:
      ...
       <types>
       <xs:schema targetNamespace="http://XXXX.com/" version="1.0" xmlns:tns="http://XXXX.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
       <xs:element name="method" type="tns:method" />
       <xs:element name="methodResponse" type="tns:methodResponse" />
       <xs:complexType name="method">
       <xs:sequence>
       <xs:element minOccurs="0" name="f" type="xs:float" />
       </xs:sequence>
       </xs:complexType>
       <xs:complexType name="methodResponse">
       <xs:sequence>
       <xs:element minOccurs="0" name="return" type="****xs:int****" />
       </xs:sequence>
       </xs:complexType>
       </xs:schema>
       </types>
      ...
      


      The second method definition, for a totally different service has an incorrect return type.

      Is is a bug or some kind of error on my side?

      Thanks!