Uploaded image for project: 'JBoss Web Services'
  1. JBoss Web Services
  2. JBWS-2975

JAXBSerializer does not use defaultNamespace to create JAXBContext

XMLWordPrintable

      The namespace prefix of type attribute in return element is lost in the marshaled message for GetCars object:

      -------Car.java----------
      @XmlSeeAlso(

      {Toyota.class, Ford.class}

      )

      public abstract class Car {
      private String model;
      private String make;

      public String getModel()

      { return model; }

      public void setModel(String model)

      { this.model = model; }

      public String getMake()

      { return make; }

      public void setMake(String make) { this.make = make; }
      }

      -----Ford.java----------
      public class Ford extends Car {

      private String color;
      private final String make="Ford";

      public Ford() { setMake("Ford"); }

      public String getMake() { return make; }

      public Ford(String model, String color)

      { setModel(model); this.color = color; }

      public String getColor()

      { return color; }

      public void setColor(String color)

      { this.color = color; }

      }

      --GetCars.java---------
      @XmlRootElement(name = "getSedansResponse", namespace = "http://jbossws.jboss.org")
      @XmlAccessorType(XmlAccessType.FIELD)
      @XmlType(name = "getSedansResponse", namespace = "http://jbossws.jboss.org")
      public class GetCars {

      @XmlElement(name = "return", namespace = "")
      private List<Car> _return;

      /**

      • @return
      • returns List<Car>
        */
        public List<Car> getReturn() { return this._return; }

      /**

      • @param _return
      • the value for the _return property
        */
        public void setReturn(List<Car> _return) { this._return = _return; }

        }

              rhn-engineering-ema Jim Ma
              rhn-engineering-ema Jim Ma
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: