0

I have a very simple webservice running who is represented through the following class: (Note that the WSMachineObject class already works on another webservice!)

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "MachinehallObject")
public class WSMachinehallObject {

    @XmlElement(name = "machine_list")
    private ArrayList<WSMachineObject> machines = new ArrayList<>();

    @XmlElement(name = "name")
    protected String name;

    public WSMachinehallObject(IMachineHall machineHall) {

        for (IMachine machine : machineHall.getMachines()) {
            machines.add(new WSMachineObject(machine));
        }

        this.name = machineHall.getName();
    }

}

If I connect to this webservice in Birt I get the name of the machinehall and on the server side i can see that all WSMachineObject's are ceated also.

My question is: How can I create a dataset that shows the name of the machinehall (which already works) AND show selected information from all WSMachineObjects also in a report.

The SOAP response from my webservice looks like that:

Webservice SOAP response

As you can I see I get the hall name and a list of machines with their attributes. I tried putting the machine_list into my report but it simply put the String "machine_list" into the report. When I tried to add the parameter of the machines and added it to the report the same happened.

So basically I want to know how to show a list of SOAP objects that are part of another SOAP object.

Markus
  • 1,452
  • 2
  • 21
  • 47

1 Answers1

0

I found the solution to the described problem.

Basically we have to change this code piece

 @XmlElement(name = "machine_list")
    private ArrayList<WSMachineObject> machines = new ArrayList<>();

with this one

@XmlElementWrapper
@XmlElement(name = "machine_list")
private ArrayList<WSMachineObject> machines = new ArrayList<>();

So what we basically did was to tell the marshaller that we are dealing with a list of objects here using the @XmlElementWrapper Annotation.

Markus
  • 1,452
  • 2
  • 21
  • 47