Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001853 [Resin] major always 07-05-07 11:34 08-21-07 18:39
Reporter djulian View Status public  
Assigned To
Priority normal Resolution fixed  
Status closed   Product Version 3.1.1
Summary 0001853: Resin WSDL generation includes all public methods, not just those marked with @WebMethod
Description The automatic WSDL generation in Resin 3.1.1 includes all public methods of the endpoint regardless of whether or not they're annotated with @WebMethod. This behavior is inconsistent with wsgen provided with the JDK. This exposes methods on the service that may not be intended. The difference in behavior could be surprising to developers.
Additional Information Here is an example that demonstrates this issue. (These files are available in the attached zip archive.) Given these files:

---
resin-web.xml
---
<web-app xmlns="http://caucho.com/ns/resin"> [^]
  <servlet-mapping url-pattern="/View"
                   servlet-class="com.example.ws.ViewEndpoint">
    <protocol type="soap" separate-schema="false" />
  </servlet-mapping>
</web-app>

---
ViewEndpoint.xml
---
package com.example.ws;

import java.util.Date;

import javax.jws.WebMethod;
import javax.jws.WebService;

@WebService
public class ViewEndpoint {

    @WebMethod
    public String getTime() {
        return new Date().toString();
    }

    public long getCurrentTimeMillis() {
        return System.currentTimeMillis();
    }
}

---

Only the getTime() method should be exposed. However, calling http://localhost:8080/view/View?wsdl [^] exposes both methods:

---
<?xml version="1.0" standalone="yes"?>
<definitions targetNamespace="http://ws.example.com/" [^] name="ViewEndpointService" xmlns="http://schemas.xmlsoap.org/wsdl/" [^] xmlns:xsd="http://www.w3.org/2001/XMLSchema" [^] xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" [^] xmlns:m="http://ws.example.com/"> [^]
  <types>
    <xsd:schema version="1.0" targetNamespace="http://ws.example.com/" [^] xmlns:m="http://ws.example.com/"> [^]
      <xsd:element name="getTime" type="m:getTime"/>
      <xsd:complexType name="getTime"/>
      <xsd:element name="getTimeResponse" type="m:getTimeResponse"/>
      <xsd:complexType name="getTimeResponse">
        <xsd:sequence>
          <xsd:element name="return" type="xsd:string" minOccurs="0"/>
        </xsd:sequence>
      </xsd:complexType>
      <xsd:element name="getCurrentTimeMillis" type="m:getCurrentTimeMillis"/>
      <xsd:complexType name="getCurrentTimeMillis"/>
      <xsd:element name="getCurrentTimeMillisResponse" type="m:getCurrentTimeMillisResponse"/>
      <xsd:complexType name="getCurrentTimeMillisResponse">
        <xsd:sequence>
          <xsd:element name="return" type="xsd:long"/>
        </xsd:sequence>
      </xsd:complexType>
    </xsd:schema>
  </types>
  <message name="getTime">
    <part name="parameters" element="m:getTime"/>
  </message>
  <message name="getTimeResponse">
    <part name="parameters" element="m:getTimeResponse"/>
  </message>
  <message name="getCurrentTimeMillis">
    <part name="parameters" element="m:getCurrentTimeMillis"/>
  </message>
  <message name="getCurrentTimeMillisResponse">
    <part name="parameters" element="m:getCurrentTimeMillisResponse"/>
  </message>
  <portType name="ViewEndpoint">
    <operation name="getTime">
      <input message="m:getTime"/>
      <output message="m:getTimeResponse"/>
    </operation>
    <operation name="getCurrentTimeMillis">
      <input message="m:getCurrentTimeMillis"/>
      <output message="m:getCurrentTimeMillisResponse"/>
    </operation>
  </portType>
  <binding name="ViewEndpointPortBinding" type="m:ViewEndpoint">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" [^] style="document"/>
    <operation name="getTime">
      <soap:operation soapAction=""/>
      <input>
        <soap:body use="literal"/>
      </input>
      <output>
        <soap:body use="literal"/>
      </output>
    </operation>
    <operation name="getCurrentTimeMillis">
      <soap:operation soapAction=""/>
      <input>
        <soap:body use="literal"/>
      </input>
      <output>
        <soap:body use="literal"/>
      </output>
    </operation>
  </binding>
  <service name="ViewEndpointService">
    <port name="ViewEndpointPort" binding="m:ViewEndpointPortBinding">
      <soap:address location=""/>
    </port>
  </service>
</definitions>

---

wsgen -wsdl correctly exposes only the method with the @WebMethod annotation:

---
ViewEndpointService.wsdl
---
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions targetNamespace="http://ws.example.com/" [^] name="ViewEndpointService" xmlns="http://schemas.xmlsoap.org/wsdl/" [^] xmlns:tns="http://ws.example.com/" [^] xmlns:xsd="http://www.w3.org/2001/XMLSchema" [^] xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> [^]
  <types>
    <xsd:schema>
      <xsd:import namespace="http://ws.example.com/" [^] schemaLocation="ViewEndpointService_schema1.xsd"/>
    </xsd:schema>
  </types>
  <message name="getTime">
    <part name="parameters" element="tns:getTime"/>
  </message>
  <message name="getTimeResponse">
    <part name="parameters" element="tns:getTimeResponse"/>
  </message>
  <portType name="ViewEndpoint">
    <operation name="getTime">
      <input message="tns:getTime"/>
      <output message="tns:getTimeResponse"/>
    </operation>
  </portType>
  <binding name="ViewEndpointPortBinding" type="tns:ViewEndpoint">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" [^] style="document"/>
    <operation name="getTime">
      <soap:operation soapAction=""/>
      <input>
        <soap:body use="literal"/>
      </input>
      <output>
        <soap:body use="literal"/>
      </output>
    </operation>
  </binding>
  <service name="ViewEndpointService">
    <port name="ViewEndpointPort" binding="tns:ViewEndpointPortBinding">
      <soap:address location="REPLACE_WITH_ACTUAL_URL"/>
    </port>
  </service>
</definitions>

---
ViewEndpointService_schema1.xsd
---
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" targetNamespace="http://ws.example.com/" [^] xmlns:tns="http://ws.example.com/" [^] xmlns:xs="http://www.w3.org/2001/XMLSchema"> [^]
  <xs:element name="getTime" type="tns:getTime"/>
  <xs:element name="getTimeResponse" type="tns:getTimeResponse"/>
  <xs:complexType name="getTime"/>
  <xs:complexType name="getTimeResponse">
    <xs:sequence>
      <xs:element name="return" type="xs:string" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>
</xs:schema>

Attached Files  view.zip [^] (2,539 bytes) 07-05-07 11:34

- Relationships

- Notes
(0002214)
emil
08-21-07 18:39

This bug has been fixed, but the behavior is not exactly as described in the bug. Methods defined in @WebService classes that are not annotated with @WebMethod are exposed if no other method is annotated with @WebMethod. In other words, if any method is annotated with @WebMethod, then all other methods are implicitly excluded. Unless... all the methods annotated with @WebMethod have the "exclude" property set to true.
 

- Issue History
Date Modified Username Field Change
07-05-07 11:34 djulian New Issue
07-05-07 11:34 djulian File Added: view.zip
07-05-07 11:35 djulian Issue Monitored: djulian
08-21-07 18:39 emil Status new => closed
08-21-07 18:39 emil Note Added: 0002214
08-21-07 18:39 emil Resolution open => fixed
08-21-07 18:39 emil Fixed in Version  => 3.1.3


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
31 total queries executed.
26 unique queries executed.
Powered by Mantis Bugtracker