Uploaded image for project: 'Axis'
  1. Axis
  2. AXIS-2417

Deserialization fails if your schema defines arrays within arrays.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Blocker
    • Resolution: Unresolved
    • 1.3
    • None
    • None
    • Windows XP / Java 1.5

    Description

      See the element PSWorkflow of the attached schema as an example. If you define subcomponents as arrays and these subcomponents specify an attribute named "id", array deserialization may fail because the deserialization context registers fixups based on the ids (prependend by #). If like in the supplied example multiple arrays and array comonents define an "id" and the id of different components is the same, deserialization may fail because the fixups are only mapped by the "#id".

      The fixups should instead be mapped by a fully qualified name. In the fix that I supplied I use the ArrayClass from the registered deserializer as qualifier. See org.apache.axis.encoding.DeserializationContext.registerFixup(String, Deserializer):

      public void registerFixup(String href, Deserializer dser)
      {
      if (fixups == null)
      fixups = new HashMap();

      +++ String qualifier = "";
      +++ Vector targets = dser.getValueTargets();
      +++ if (targets != null && !targets.isEmpty())
      +++ {
      +++ if (targets.get(0) instanceof DeserializerTarget)
      +++ {
      +++ DeserializerTarget target = (DeserializerTarget) targets.get(0);
      +++ if (target != null && target.target instanceof ArrayDeserializer)
      +++ {
      +++ ArrayDeserializer arrayDser = (ArrayDeserializer) target.target;
      +++ ArrayDeserializer.ArrayListExtension listExtension =
      +++ (ArrayDeserializer.ArrayListExtension) arrayDser.getValue();
      +++ if (listExtension != null)
      +++

      { +++ Class destClass = listExtension.getDestClass(); +++ if (destClass != null) +++ qualifier = "-" + destClass.getName(); +++ }

      +++ }
      +++ }
      +++ }

      +++ Deserializer prev = (Deserializer) fixups.put(href + qualifier, dser);

      // There could already be a deserializer in the fixup list
      // for this href. If so, the easiest way to get all of the
      // targets updated is to move the previous deserializers
      // targets to dser.
      if (prev != null && prev != dser) {
      dser.moveValueTargets(prev);
      if (dser.getDefaultType() == null)

      { dser.setDefaultType(prev.getDefaultType()); }

      }
      }

      While debugging this problem, I noticed that you do that same thing for attachement references. I would assume that that code will have the same issue.

      I noted that you use the attributes "id" and "href" for attachements and fixups. Does this mean that attributes with these names are reserved for Axis? I have not found any documentation regarding my question.

      Attachments

        1. systemServices.xsd
          16 kB
          Martin Genhart
        2. DeserializationContext.java
          42 kB
          Martin Genhart
        3. ArrayDeserializer.java
          31 kB
          Ross Mills
        4. BeanPropertyDescriptor.java
          9 kB
          Ross Mills

        Activity

          People

            Unassigned Unassigned
            mgenhart Martin Genhart
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: