Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001852 [Resin] major always 07-05-07 11:11 09-04-07 11:56
Reporter djulian View Status public  
Assigned To
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 3.1.3 Product Version 3.1.1
  Product Build
Summary 0001852: Web Service schema generation neglects to add namespace to nested types
Description Given a web service endpoint (GreekEndpoint) that has a method that returns a bean (AlphaBean) that in turn contains a bean (BetaBean), the schema produced by Resin 3.1.1 fails to put the nested bean in the proper namespace.

In a sample project, the generated Resin schema looks like so:

    <xsd:schema version="1.0" targetNamespace="http://ws.example.com/" [^] xmlns:m="http://ws.example.com/"> [^]
      <xsd:complexType name="alphaBean">
        <xsd:sequence>
          <!-- NOTE: type="betaBean" -->
          <xsd:element minOccurs="0" type="betaBean" name="beta"/>
          <xsd:element minOccurs="0" type="xsd:string" name="value"/>
        </xsd:sequence>
      </xsd:complexType>
      <xsd:complexType name="betaBean">
        <xsd:sequence>
          <xsd:element minOccurs="0" type="xsd:string" name="value"/>
        </xsd:sequence>
      </xsd:complexType>
      <xsd:element name="getAlphaBean" type="m:getAlphaBean"/>
      <xsd:complexType name="getAlphaBean"/>
      <xsd:element name="getAlphaBeanResponse" type="m:getAlphaBeanResponse"/>
      <xsd:complexType name="getAlphaBeanResponse">
        <xsd:sequence>
          <xsd:element name="return" type="m:alphaBean" minOccurs="0"/>
        </xsd:sequence>
      </xsd:complexType>
      <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:schema>

However, the schema generated via wsgen:

<?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="getAlphaBean" type="tns:getAlphaBean"/>

  <xs:element name="getAlphaBeanResponse" type="tns:getAlphaBeanResponse"/>

  <xs:complexType name="getAlphaBean"/>

  <xs:complexType name="getAlphaBeanResponse">
    <xs:sequence>
      <xs:element name="return" type="tns:alphaBean" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="alphaBean">
    <xs:sequence>
      <!-- NOTE: type="tns:betaBean" --->
      <xs:element name="beta" type="tns:betaBean" minOccurs="0"/>
      <xs:element name="value" type="xs:string" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="betaBean">
    <xs:sequence>
      <xs:element name="value" type="xs:string" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>
</xs:schema>

The wsgen schema places the 'betaBean' type in the namespace of the service while Resin's generated schema leaves it to the default namespace of the containing WSDL, http://schemas.xmlsoap.org/wsdl/. [^]

This is reflected in clients that try to consume this WSDL.

SoapUI says: "Thu Jul 05 10:39:19 PDT 2007:WARN:Error: http://localhost:8080/greek/Greek?wsdl:0: [^] error: src-resolve.a: Could not find type 'betaBean@http://schemas.xmlsoap.org/wsdl/'. [^] Do you mean to refer to the type named betaBean@ href="http://ws.example.com/">http://ws.example.com/ [^] (in Greek_3Fwsdl)?"

Apache Axis 1.4 WSDL2Java says: "java.io.IOException: Type {http://schemas.xmlsoap.org/wsdl/}betaBean [^] is referenced but not defined."
Steps To Reproduce
Additional Information I am using "Resin-3.1.1 (built Mon, 07 May 2007 09:32:40 PDT)" with JDK 1.6.0_01.

Here is a sample project that illustrates this issue (all files are likewise contained in attached zip file):

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

---
GreekEndpoint.java
---
package com.example.ws;

import java.util.Date;

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

@WebService
public class GreekEndpoint {

    public String getTime() {
        return new Date().toString();
    }
    
    @WebMethod
    public AlphaBean getAlphaBean() {
        BetaBean beta = new BetaBean();
        beta.setValue("beta");
        AlphaBean alpha = new AlphaBean();
        alpha.setValue("alpha");
        alpha.setBeta(beta);
        return alpha;
    }
}

---
AlphaBean.java
---
package com.example.ws;

public class AlphaBean {
    private String value;
    private BetaBean beta;

    public String getValue() {
        return this.value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public BetaBean getBeta() {
        return this.beta;
    }

    public void setBeta(BetaBean beta) {
        this.beta = beta;
    }
    
}

---
BetaBean.java
---
package com.example.ws;

public class BetaBean {
    private String value;

    public String getValue() {
        return this.value;
    }

    public void setValue(String value) {
        this.value = value;
    }
    
}
Attached Files  greek.zip [^] (3,209 bytes) 07-05-07 11:11

- Relationships

- Notes
(0002101)
djulian
07-05-07 11:15

I considered setting the severity of this issue to 'block' as it strongly argues against deploying our services with Resin's JAX-WS capabilities. However, I realize this development is still early so I'm unsure as to its "official" status.

I learned the '<protocol type="soap" separate-schema="false" />' trick from issue 1838. The protocol tag and its attributes seem to be otherwise undocumented in the Resin documentation.
 
(0002258)
emil
09-04-07 11:56

Thanks for the report!
 

- Issue History
Date Modified Username Field Change
07-05-07 11:11 djulian New Issue
07-05-07 11:11 djulian File Added: greek.zip
07-05-07 11:11 djulian Issue Monitored: djulian
07-05-07 11:15 djulian Note Added: 0002101
09-04-07 11:56 emil Status new => closed
09-04-07 11:56 emil Note Added: 0002258
09-04-07 11:56 emil Resolution open => fixed
09-04-07 11:56 emil Fixed in Version  => 3.1.3


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