Title: Message
Hi,
 
I am facing an issue with wsdl2java when I use substitution groups in the schema. I am using Axis 1.1 with Tomcat 5.0.
Has anyone faced similar issues with substitution groups using Axis wsdl2java? It seems like to make it work, one would have to modify the generated code.
 
I run the following wsdl2java command on PartyOperation.wsdl. (PartyOperation.wsdl and associated xsd files are included at the end of the mail)
 
java org.apache.axis.wsdl.WSDL2Java -O -1 -s -S true -d Session -Nhttp://www.examples.com/nm2/definitions=samples.party -Nhttp://www.examples.com/nm1=samples.party.nm1types -Nhttp://www.examples.com/nm2=samples.party.nm2types samples\party\PartyOperation.wsdl
 
Excerpts from generated Java files:
 
nm2types/PartyInfo.java
------------------------
public class PartyInfo  implements java.io.Serializable
{
    private samples.party.nm2types.PartyType[] party;
    ....
}
 
nm2types/PartyType.java 
------------------------
public class PartyType  extends samples.party.nm1types.PartyType  implements java.io.Serializable
{
    public PartyType() {}
    ...
}
 
nm1types/PartyType.java
------------------------
public class PartyType  implements java.io.Serializable
{
    private samples.party.nm1types.Name name;
 
    public PartyType() {}
 
    public samples.party.nm1types.Name getName() { return name; }
   
    public void setName(samples.party.nm1types.Name name) { this.name = name; }
}
 
The issue is that samples.party.nm2types.PartyType.java class extends from samples.party.nm1types.PartyType and has no "getName" method. The samples.party.nm1types.PartyType class has getName method, but returns samples.party.nm1types.Name.
 
Another issue is that element "CustomerParty" in nm1/PartyInfo.xsd does not get reflected in the Java code in nm1types/*.java.
 
Thanks and Regards
Shobha
 
============================= PartyOperation.wsdl ====================================
<?xml version="1.0" ?>
 
<definitions name="PartyFetcher"
             targetNamespace="http://www.examples.com/nm2/definitions"
             xmlns:tns="http://www.examples.com/nm2/definitions"
             xmlns:typens="http://www.examples.com/nm2"
             xmlns:xsd="http://www.w3.org/1999/XMLSchema"
             xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
             xmlns="http://schemas.xmlsoap.org/wsdl/">
 
  <import namespace="http://www.examples.com/nm2"
           location="./nm2/PartyInfo.xsd"/>
 
  <!-- message declns -->
  <message name="GetPartyRequest">
    <part name="partyreq" type="typens:PartyInfo"/>
  </message>
 
  <message name="GetPartyResponse">
    <part name="partyres" type="typens:PartyInfo"/>
  </message>
 
  <!-- port type declns -->
  <portType name="PartyOperation">
    <operation name="PartyOperation">
      <input message="tns:GetPartyRequest"/>
      <output message="tns:GetPartyResponse"/>
    </operation>
  </portType>
 
  <!-- binding declns -->
  <binding name="PartyOperationSOAPBinding" type="tns:PartyOperation">
    <soap:binding style="rpc"
                  transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="PartyOperation">
      <soap:operation soapAction=""/>
      <input>
        <soap:body use="encoded"
                   namespace="http://www.examples.com/nm2/definitions"
                   encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
      </input>
      <output>
        <soap:body use="encoded"
                   namespace="http://www.examples.com/nm2/definitions"
                   encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
      </output>
    </operation>
  </binding>
 
  <!-- service decln -->
  <service name="PartyOperationService">
    <port name="PartyOperation" binding="tns:PartyOperationSOAPBinding">
      <soap:address location="http://localhost:8080/axis/services/PartyOperation"/>
    </port>
  </service>
 
</definitions>
==================================================================================
================ PartyInfo.xsd (in NameSpace 1) ==========================================
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.examples.com/nm1" targetNamespace="http://www.examples.com/nm1" elementFormDefault="qualified" attributeFormDefault="unqualified">
 
        <xs:element name="PartyInfo" type="PartyInfo">
        </xs:element>
        <xs:complexType name="PartyInfo">
  <xs:sequence>
   <xs:element ref="Party" maxOccurs="unbounded"/>
  </xs:sequence>
        </xs:complexType>
 
        <xs:element name="Party" type="PartyType">
        </xs:element>
 
 <xs:element name="CustomerParty" type="PartyType" substitutionGroup="Party" />
 
        <xs:complexType name="PartyType">
  <xs:sequence>
   <xs:element ref="Name"/>
  </xs:sequence>
 </xs:complexType>
 
 <xs:complexType name="Name">
  <xs:sequence>
   <xs:element ref="FirstName" />
   <xs:element ref="LastName" />
  </xs:sequence>
 </xs:complexType>
 
 <xs:element name="Name" type="Name" />
 
 <xs:simpleType name="FirstName">
  <xs:restriction base="xs:string" />
 </xs:simpleType>
 
 <xs:element name="FirstName" type="FirstName" />
 
 <xs:simpleType name="LastName">
  <xs:restriction base="xs:string" />
 </xs:simpleType>
 
 <xs:element name="LastName" type="LastName" />
</xs:schema>
 
==================================================================================
================ PartyInfo.xsd (in NameSpace 2) ==========================================
 
<?xml version="1.0" encoding="utf-8"?>
 
<xs:schema targetNamespace="http://www.examples.com/nm2" elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:nm2="http://www.examples.com/nm2" xmlns:nm1="http://www.examples.com/nm1" xmlns:xs="http://www.w3.org/2001/XMLSchema">
 
 <xs:import namespace="http://www.examples.com/nm1" schemaLocation="../nm1/PartyInfo.xsd"/>
 

 <xs:element name="PartyInfo" type="nm2:PartyInfo"/>
 
 <xs:complexType name="PartyInfo">
  <xs:sequence>
   <xs:element ref="nm2:Party" maxOccurs="unbounded"/>
  </xs:sequence>
 </xs:complexType>
 
 <xs:element name="Party" type="nm2:PartyType">
 </xs:element>
 
 <xs:complexType name="PartyType">
  <xs:complexContent>
   <xs:extension base="nm1:PartyType" />
  </xs:complexContent>
 </xs:complexType>
 
 <xs:element name="Name" type="nm2:Name" substitutionGroup="nm1:Name"/>
 
 <xs:complexType name="Name">
  <xs:complexContent>
   <xs:extension base="nm1:Name">
    <xs:sequence>
     <xs:element name="MiddleName" type="xs:string"/>
    </xs:sequence>
   </xs:extension>
  </xs:complexContent>
 </xs:complexType>
</xs:schema>
 
==================================================================================

Reply via email to