Hi There,

I'm having a problem, that I need your help on. Using Axis2 1.3 I have 
generated java classes from a WSDL file. The data binding framework used 
is XMLBeans (the structure of the wsdl and xsd files is very complex, so 
we decided on XMLBeans instead of ADB, hoping that would result in more 
correct generated code).

The Web Service server is the Exchange Web Service interface that is a 
part of Microsoft Exchange 2007, so we have no way of changing the server 
side. We have downloaded the WSDL from the Exchange server (and added a 
service tag, as this was not included). The WSDL refers to two xsd files, 
one that defines Message stuff (error codes as ENUM and different basic 
stuff) and one that defines the different types and elements. Here is a 
small abstract of the XML Schema is appended:

 === START OF SCHEMA ===
  <xs:schema id="types"
                elementFormDefault="qualified"
                version="Exchange2007_SP1" 
 xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types";
 
targetNamespace="http://schemas.microsoft.com/exchange/services/2006/types";
 xmlns:tns="http://schemas.microsoft.com/exchange/services/2006/types";
                xmlns:xs="http://www.w3.org/2001/XMLSchema";>
 
  <xs:element name="Path" abstract="true" type="t:BasePathToElementType"/>
  <xs:element name="FieldURI" type="t:PathToUnindexedFieldType" 
substitutionGroup="t:Path"/>
  <xs:element name="IndexedFieldURI" type="t:PathToIndexedFieldType" 
substitutionGroup="t:Path" />
  <xs:element name="ExtendedFieldURI" type="t:PathToExtendedFieldType" 
substitutionGroup="t:Path"/>
 
    <xs:complexType name="TwoOperandExpressionType" abstract="true">
    <xs:complexContent>
      <xs:extension base="t:SearchExpressionType">
        <xs:sequence>
          <xs:element ref="t:Path"/>
          <xs:element name="FieldURIOrConstant" 
type="t:FieldURIOrConstantType"/>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
 
    <xs:complexType name="FieldURIOrConstantType">
    <xs:choice>
      <xs:element ref="t:Path"/>
      <xs:element name="Constant" type="t:ConstantValueType" />
    </xs:choice>
  </xs:complexType>
 
  <xs:complexType name="ConstantValueType">
    <xs:attribute name="Value" type="xs:string" use="required" />
  </xs:complexType>
 
  <xs:complexType name="IsEqualToType">
    <xs:complexContent>
      <xs:extension base="t:TwoOperandExpressionType"/>
    </xs:complexContent>
  </xs:complexType>
 
  <xs:element name="IsEqualTo" type="t:IsEqualToType" substitutionGroup 
="t:SearchExpression"/>
  === END OF SCHEMA ===
 
 
As I understand this schema. When I create a IsEqualTo element, I should 
be able to add either FieldURI, IndexedFieldURI, or ExtendedFieldURI 
element. However the generated code has a method called 
setPath(BasePathToElementType), and regardless what I do the request being 
sent to the server contains a Path element instead of one of the possible 
substitutes. The following classes are created:
PathDocument
FieldURIDocument
IndexedFieldURIDocument
ExtendedFieldURIDocument

I would expect the PathDocument to be an abstract class which each of the 
three substitution types extends; but the PathDocument class is in fact 
not abstract, and objects can be created.

If I call the method xmlText() on each of the three classes: 
FieldURIDocument, IndexedFieldURIDocument, and ExtendedFieldURIDocument, 
correct XML is returned (e.g. <FieldURI FieldURI="item:ItemClass" 
xmlns="http://schemas.microsoft.com/exchange/services/2006/types"/>). 
 
The ultimate goal is to produce this XML:
<typ:IsEqualTo 
xmlns:typ="http://schemas.microsoft.com/exchange/services/2006/types";>
        <FieldURI FieldURI="item:ItemClass" 
xmlns="http://schemas.microsoft.com/exchange/services/2006/types"; />
        <typ:FieldURIOrConstant>
                <typ:Constant Value="IPM.Note" />
        </typ:FieldURIOrConstant>
</typ:IsEqualTo>

But what the axis generated classes produce is this (see the path 
element):
<typ:IsEqualTo 
xmlns:typ="http://schemas.microsoft.com/exchange/services/2006/types";>
        <typ:Path FieldURI="item:ItemClass" 
xsi:type="typ:PathToUnindexedFieldType" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; />
        <typ:FieldURIOrConstant>
                <typ:Constant Value="IPM.Note" />
        </typ:FieldURIOrConstant>
</typ:IsEqualTo>

Anyone out there who can point/push me in the right direction? Any help is 
greatly appreciated.
Or is this simply related to a bug in the code generation?

For now, we have extended the generated code with methods for adding each 
of the three type, but in the long run, that's not a suitable solution.

Regards
Mads

Reply via email to