I have a web service like below, it contains a web method which will return a list of objects:
@WebService(name = "ClubMembershipPortType", serviceName = "ClubMembershipService", portName = "ClubMembershipSoapPort", targetNamespace = "http://club.com/api/ws")
public class ClubMembershipWS {
@WebMethod(operationName = "findClubMembershipsByClubId", action = "urn:findClubMembershipsByClubId")
@WebResult(name = "club_membership")
public List<ClubMembership> findClubMembershipsByClubId(@XmlElement(required=true)
@WebParam(name = "club_id") String clubId,
@WebParam(name = "status") StatusEnum status)
...
...
}
}
The response I got for the api request is like below:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:findClubMembersByClubIdResponse xmlns:ns2="http://club.com/api/ws">
<club_membership>
...
</club_membership>
<club_membership>
...
</club_membership>
</ns2:findClubMembersByClubIdResponse>
</S:Body>
</S:Envelope>
The question is how to use @XmlElementWrapper
(or other way?) to make the response like below?
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:findClubMembersByClubIdResponse xmlns:ns2="http://club.com/api/ws">
<club_membership_list>
<club_membership>
...
</club_membership>
<club_membership>
...
</club_membership>
</club_membership_list>
</ns2:findClubMembersByClubIdResponse>
</S:Body>
</S:Envelope>