You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by bu...@apache.org on 2003/11/10 03:43:03 UTC

DO NOT REPLY [Bug 24548] New: - Java2WSDL -C opt leads to bad wsdl

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24548>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24548

Java2WSDL -C opt leads to bad wsdl

           Summary: Java2WSDL -C opt leads to bad wsdl
           Product: Axis
           Version: 1.1
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: WSDL processing
        AssignedTo: axis-dev@ws.apache.org
        ReportedBy: jhrabows@brooks.com


This problem occurres only the Schema passed in -C option does not declare the 
XSD namespace to be the default namespace. On the other hand Java2WSDL assumes 
that all Schemas included in WSDL have such default defined. Here is an exampe:
Try to generate WSDL for the following interface:

package wsdltest;
public interface WSDLTest {
public Abean aMethod();
}

where Abean is defined as

package wsdltest;
public class Abean {
    private String _a;
    public String getA() { return _a; }
    public void setA(String a) { _a = a; }
}

We want Abean to reside in the same namespace as the Bbean defined by

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://www.schematest" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:complexType name="Bbean">
<xsd:sequence>
<xsd:element name="b" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>

Note that this Schema does not define a default namespace and this carries over 
when -C option is used. Here is the command line:

java ... org.apache.axis.wsdl.Java2WSDL
-Cfile:TestSchema.xsd
-n http://www.wsdltest
-N http://www.schematest
-pwsdltest http://www.schematest
wsdltest.WSDLTest

(TestSchema.xsd is the file containing the Bbean schema)

The types section of the generated WSDL looks as below
(The Abean appears without a schema prefix).
This WSDL is clearly invalid - you cannot run it through WSDL2Java.

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://www.wsdltest" 
xmlns:impl="http://www.schematest" xmlns:intf="http://www.wsdltest" 
xmlns:apachesoap="http://xml.apache.org/xml-soap" 
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
xmlns="http://schemas.xmlsoap.org/wsdl/">
 <wsdl:types>
  <xsd:schema targetNamespace="http://www.schematest" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema">

   <xsd:complexType name="Bbean">

    <xsd:sequence>

     <xsd:element name="b" type="xsd:string"/>

    </xsd:sequence>

   </xsd:complexType>

   <complexType name="Abean">
    <sequence>
     <element name="a" nillable="true" type="xsd:string"/>
    </sequence>
   </complexType>
  </xsd:schema>
 </wsdl:types>


.... rest of WSDL