How to define a list of objects in XSD for a JAX-B webservice project
posted 3 years ago
Below are the files for my project:-
Requirement : Returning a list of promotion based on particular id.
Here in the above method toContract(), when i was returning a single Promotion object based on a id(not a primary key) on database,i was getting proper response in the soap ui.
But when tried to return list from the same method(based on a goiven criteria) and handled the same in requests-1-0.xsd(file given above) by giving
<xs:element name="promotion" type="beans:Promotion" minOccurs="0" maxOccurs="unbounded" />(handling list of Promotion bean object,previously gave maxOccurs="1")
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project com.sybase365.mobiliser.custom.project.services.endpoint: Compilation failure
[ERROR] /home/mobiliser/workspace/custom/services/endpoint/src/main/java/com/sybase365/mobiliser/custom/project/services/endpoint/PromotionEndpoint.java:[49,9] setPromotionList(com.sybase365.mobiliser.custom.project.services.contract.v1_0.beans.PromotionList) in com.sybase365.mobiliser.custom.project.services.contract.v1_0.GetPromotionResponseType cannot be applied to (java.util.List)[ERROR]
Question : Does this auto-generated method setPromotion() bases on config defined in xsd takes single object as argumemt? If no..how to define the list of objects within xsd
as defining maxoccurs="unbounded" for that object is not working?