WSDL2Java uses XmlObject for skeleton parameter when data in XML schema in same 
namespace as WSDL document
----------------------------------------------------------------------------------------------------------

         Key: AXIS2-844
         URL: http://issues.apache.org/jira/browse/AXIS2-844
     Project: Apache Axis 2.0 (Axis2)
        Type: Bug

  Components: databinding, Tools, wsdl  
    Versions: 1.0    
 Environment: JDK 5.0
    Reporter: Derek Foster
    Priority: Critical


I have discovered that the Axis WSDL2Java code generator produces incorrect 
results under the following circumstances:

1) The WSDL document declares a target namespace.
2) The 'types' section of the document imports a schema with the same namespace.
3) A 'message' is declared to use an element of a type declared within the 
schema.
4) An operation is declared to use the message as an input or output parameter.

When the above scenario occurs, the WSDL2Java code generator acts as if the 
elements declared in the schema do not exist and apparently goes to its 
fallback method of treating the data as if it were declared 'xs:any'. Note that 
schemas that do not share the same namespace with the WSDL document seem to 
work fine.

Using the WSDL and schema below, and the given WSDL2Java command line, I get 
XMLBeans classes generated. However, the generated skeleton methods take 
parameters of type OMElement and return a result of type OMElement (with the 
Axis 1.0 release. With the current nightly build they use type XmlObject 
instead), instead of using generated XMLBeans wrapper classes that are specific 
to the WSDL file being parsed.

According to various documentation I have read, there should be no problem with 
this. The same namespace should be perfectly legal to use both for the WSDL 
document itself and for XML elements and types declared within it. (Note, 
however, that the WSDL document messages, bindings, and so forth should occupy 
a different symbol space from the XML elements and types in the same namespace, 
so that one could have, for instance, both a message named "foo" as well as an 
xs:element named "foo" without conflict.)

This is a big problem for me, since sharing the same namespace for both of 
these elements is done both by several WSDL files within my own company, as 
well as those that have been given to my company to use from external sources. 
I MIGHT be able to change the WSDL produced by my company, but can't do much 
about the ones that we have been given from outside. This essentially makes 
WSDL2Java unusable for me until this issue is fixed.

A bit more information can be found in the developer list under the thread 
"[Axis2] Why do I get service skeletons taking OMElement, and uncompilable 
code?".

Here is an example of WSDL that reproduces the problem:

The WSDL:

<?xml version="1.0" encoding="UTF-8"?>

<definitions name="FDefinitions"
   targetNamespace="http://www.example.com/wsdl/2004-10-01/feu";
   xmlns:carshdr="http://www.example.com/wsdl/2004-10-01/cars";
   xmlns:carsfault="http://www.example.com/wsdl/2006-06-13/carsfault";
   xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
   xmlns:tns="http://www.example.com/wsdl/2004-10-01/feu";
   xmlns:feu="http://www.dummy-temp-address";
   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
   xmlns:xs="http://www.w3.org/2001/XMLSchema";
   xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";
   xmlns="http://schemas.xmlsoap.org/wsdl/";>

   <wsdl:types>
      <xs:schema>
         <xs:import namespace="http://www.dummy-temp-address";
schemaLocation="FEU.xsd"/>
      </xs:schema>
      <xs:schema targetNamespace="http://www.example.com/wsdl/2004-10-01/feu";>
         <xs:element name="full-event-updates">
            <xs:complexType>
               <xs:sequence>
                  <xs:element name="full-event-update" 
type="feu:FullEventUpdate" minOccurs="0" maxOccurs="unbounded"/>
               </xs:sequence>
            </xs:complexType>
         </xs:element>
         <xs:element name="full-event-update" type="feu:FullEventUpdate"/>
         <xs:element name="return" type="xs:string"/>
      </xs:schema>
      <xs:schema targetNamespace="http://www.example.com/wsdl/2004-10-01/cars";>
         <xs:element name="CPassword" type="xs:string"/>
         <xs:element name="CLogin" type="xs:string"/>
      </xs:schema>
      <xs:schema 
targetNamespace="http://www.example.com/wsdl/2006-06-13/carsfault";>
         <xs:element name="generalFault" type="xs:string"/>
      </xs:schema>
   </wsdl:types>

   <message name="FEvent">
      <part name="contents" element="tns:full-event-update"/>
   </message>

   <message name="FRecap">
      <part name="contents" element="tns:full-event-updates"/>
   </message>

   <message name="FResponse">
      <part name="return" element="tns:return"/>
   </message>

   <message name="CPassword">
      <part name="CPassword" element="carshdr:CPassword"/>
   </message>

   <message name="CLogin">
      <part name="CLogin" element="carshdr:CLogin"/>
   </message>

   <message name="GeneralFault">
      <part name="faultDetail" element="carsfault:generalFault"/>
   </message>

   <portType name="FPortType">
      <documentation>F Port Type</documentation>

      <operation name="acceptFEvent" parameterOrder="contents">
         <input name="acceptFEventRequest" message="tns:FEvent"/>
         <output name="acceptFEventResponse" message="tns:FResponse"/>
         <fault name="GeneralFault" message="tns:GeneralFault"/>
      </operation>

      <operation name="acceptFRecap" parameterOrder="contents">
         <input name="acceptFRecapRequest" message="tns:FRecap"/>
         <output name="acceptFRecapResponse" message="tns:FResponse"/>
         <fault name="GeneralFault" message="tns:GeneralFault"/>
      </operation>
   </portType>

   <binding name="FSoapBinding" type="tns:FPortType">
      <documentation>F Soap Binding</documentation>
      <soap:binding style="document" 
transport="http://schemas.xmlsoap.org/soap/http"/>

      <operation name="acceptFEvent">
         <soap:operation soapAction="acceptFEventAction"/>
         <input>
            <soap:header message="tns:CLogin" part="CLogin" use="literal"/>
            <soap:header message="tns:CPassword" part="CPassword" 
use="literal"/>
            <soap:body use="literal"/>
         </input>
         <output>
            <soap:body use="literal"/>
         </output>
         <fault name="GeneralFault">
            <soap:fault name="GeneralFault" use="literal"/>
         </fault>
      </operation>

      <operation name="acceptFRecap">
         <soap:operation soapAction="acceptFRecapAction"/>
         <input>
            <soap:header message="tns:CLogin" part="CLogin" use="literal"/>
            <soap:header message="tns:CPassword" part="CPassword" 
use="literal"/>
            <soap:body use="literal"/>
         </input>
         <output>
            <soap:body use="literal"/>
         </output>
         <fault name="GeneralFault">
            <soap:fault name="GeneralFault" use="literal"/>
         </fault>
      </operation>
   </binding>

   <service name="FService">
      <documentation>F Web Service</documentation>
      <port name="FPort" binding="tns:FSoapBinding">
         <soap:address location="http://localhost:8080/axis/services/FService"/>
      </port>
   </service>
</definitions>
 
The schema:

<?xml version="1.0" encoding="UTF-8"?>

<xs:schema targetNamespace="http://www.dummy-temp-address";
           xmlns="http://www.dummy-temp-address";
           xmlns:xs="http://www.w3.org/2001/XMLSchema";
 
xmlns:cars="http://www.crc-corp.com/schemas/cars/schema_annotation";

           elementFormDefault="unqualified"
           attributeFormDefault="unqualified"
           version="DRAFT">

   <xs:element name="full-event-update" type="FullEventUpdate"/>

   <xs:complexType name="FullEventUpdate">
      <xs:sequence>
         <xs:element name="message-header" type="MessageHeader"/>
         <xs:element name="event-reference" type="EventReference"/>
         <xs:any/>
      </xs:sequence>
   </xs:complexType>

   <xs:complexType name="MessageHeader">
      <xs:sequence>
         <xs:any/>
      </xs:sequence>
   </xs:complexType>

   <xs:complexType name="EventReference">
      <xs:sequence>
         <xs:element name="event-id" type="xs:string"/>
         <xs:element name="update" type="xs:unsignedInt"/>
         <xs:element name="response-plan-id" type="xs:string" minOccurs="0"/>
      </xs:sequence>
   </xs:complexType>
</xs:schema>



The WSDL command line:

   WSDL2Java --databinding-method xmlbeans 
             --uri FEUImport.wsdl 
             --server-side 
             --generate-all 
             --service-description 
             --output generatedSrc 
             --package crc.feuimport.wsdl2java 

The skeleton interface that is getting generated:


    /**
     * FEUServiceSkeletonInterface.java
     *

       * This file was auto-generated from WSDL
     * by the Apache Axis2 version: 1.0 May 05, 2006 (12:31:13 IST)
     */
    package crc.feuimport.wsdl2java;
    /**
     *  FServiceSkeletonInterface java skeleton interface for the axisService
     */
    public interface FServiceSkeletonInterface {
     
   
        /**
         * Auto generated method signature
         
          * @param param0
         
         */
        public  org.apache.axiom.om.OMElement acceptFEURecap
                  (org.apache.axiom.om.OMElement param0 )
         
           throws 
crc.feuimport.wsdl2java.FServiceSkeleton.GeneralFaultException;
     
   
        /**
         * Auto generated method signature
         
          * @param param4
         
         */
        public  org.apache.axiom.om.OMElement acceptFEUEvent
                  (org.apache.axiom.om.OMElement param4 )
         
           throws 
crc.feuimport.wsdl2java.FServiceSkeleton.GeneralFaultException;
     
    }
 


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to