Uploaded image for project: 'Axis2-C'
  1. Axis2-C
  2. AXIS2C-1373

Name matching fails with choice element

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Blocker
    • Resolution: Unresolved
    • 1.6.0
    • None
    • code generation
    • None

    Description

      In testing against an Exchange server using EWS (Exchange Web Services), I have discovered a blocking generated code issue.

      Given this schema:

      <xs:complexType name="ArrayOfResponseMessagesType">
      <xs:choice maxOccurs="unbounded">
      <xs:element name="CreateItemResponseMessage" type="m:ItemInfoResponseMessageType"/>
      <xs:element name="DeleteItemResponseMessage" type="m:ResponseMessageType"/>
      <xs:element name="GetItemResponseMessage" type="m:ItemInfoResponseMessageType"/>
      <xs:element name="UpdateItemResponseMessage" type="m:UpdateItemResponseMessageType"/>
      <xs:element name="SendItemResponseMessage" type="m:ResponseMessageType"/>
      <xs:element name="DeleteFolderResponseMessage" type="m:ResponseMessageType"/>
      <xs:element name="CreateFolderResponseMessage" type="m:FolderInfoResponseMessageType"/>
      <xs:element name="GetFolderResponseMessage" type="m:FolderInfoResponseMessageType"/>
      <xs:element name="FindFolderResponseMessage" type="m:FindFolderResponseMessageType"/>
      <xs:element name="UpdateFolderResponseMessage" type="m:FolderInfoResponseMessageType"/>
      <xs:element name="MoveFolderResponseMessage" type="m:FolderInfoResponseMessageType"/>
      <xs:element name="CopyFolderResponseMessage" type="m:FolderInfoResponseMessageType"/>
      <xs:element name="CreateAttachmentResponseMessage" type="m:AttachmentInfoResponseMessageType"/>
      <xs:element name="DeleteAttachmentResponseMessage" type="m:DeleteAttachmentResponseMessageType"/>
      <xs:element name="GetAttachmentResponseMessage" type="m:AttachmentInfoResponseMessageType"/>
      <!-- Generic reponse to enumerating the items below a folder -->
      <xs:element name="FindItemResponseMessage" type="m:FindItemResponseMessageType"/>
      <xs:element name="MoveItemResponseMessage" type="m:ItemInfoResponseMessageType"/>
      <xs:element name="CopyItemResponseMessage" type="m:ItemInfoResponseMessageType"/>
      <!-- ANR responses -->
      <xs:element name="ResolveNamesResponseMessage" type="m:ResolveNamesResponseMessageType"/>
      <xs:element name="ExpandDLResponseMessage" type="m:ExpandDLResponseMessageType"/>
      <!-- Notification responses -->
      <xs:element name="GetEventsResponseMessage" type="m:GetEventsResponseMessageType"/>
      <xs:element name="SubscribeResponseMessage" type="m:SubscribeResponseMessageType"/>
      <xs:element name="UnsubscribeResponseMessage" type="m:ResponseMessageType"/>
      <!-- Send Notification response -->
      <xs:element name="SendNotificationResponseMessage" type="m:SendNotificationResponseMessageType" />
      <!-- Sync responses -->
      <xs:element name="SyncFolderHierarchyResponseMessage" type="m:SyncFolderHierarchyResponseMessageType"/>
      <xs:element name="SyncFolderItemsResponseMessage" type="m:SyncFolderItemsResponseMessageType"/>
      <!-- Managed Folder responses -->
      <xs:element name="CreateManagedFolderResponseMessage" type="m:FolderInfoResponseMessageType"/>
      <!-- ConvertId response-->
      <xs:element name="ConvertIdResponseMessage" type="m:ConvertIdResponseMessageType"/>
      </xs:choice>
      </xs:complexType>

      Axis generates types:
      ArrayOfResponseMessagesType
      ArrayOfResponseMessagesTypeChoice
      FindItemResponseMesage
      ...

      A valid response message looks like this:

      <?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <soap:Header>
      <t:ServerVersionInfo MajorVersion="8" MinorVersion="1" MajorBuildNumber="375" MinorBuildNumber="1" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" />
      </soap:Header>
      <soap:Body>
      <m:FindItemResponse xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
      <m:ResponseMessages>
      <m:FindItemResponseMessage ResponseClass="Success">
      <m:ResponseCode>NoError</m:ResponseCode>
      <m:RootFolder TotalItemsInView="1" IncludesLastItemInRange="true">
      <t:Items>
      <t:Task>
      <t:ItemId Id="AAAQAGFvbmVhbEBhdmFsb24udXMARgAAAAAADubRCBB2Y068xYCH6WH0DgcAZ3A8uDQfUEKlwidoYrrErQAAAixOMgAArrJ7HqgcjEykQ1CwlhhwBQAAAiwIAQAA" ChangeKey="EwAAABYAAABncDy4NB9QQqXCJ2hiusStAABdzMRd" />
      </t:Task>
      </t:Items>
      </m:RootFolder>
      </m:FindItemResponseMessage>
      </m:ResponseMessages>
      </m:FindItemResponse>
      </soap:Body>
      </soap:Envelope>

      During deserialization of the ArrayOfResponseMessagesType, the first thing it does is look for a qname of ArrayOfResponseMessagesTypeChoice, but what it finds is a qname of FindItemResponseMessage (one of the choice types). The qnames fail to match and so deserialization terminates.

      I don't understand why it's looking for a "XXXChoice" qname when that's an artificial type generated by Axis. The real type as specified in the WSDL is what is returned in the response, so it's no surprise it doesn't match. Any idea what's going on?

      Attachments

        1. EWS.7z
          994 kB
          Incarnadine
        2. EWS-WSDL.7z
          25 kB
          Incarnadine

        Activity

          People

            Unassigned Unassigned
            aaron.oneal Incarnadine
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: