I'm building a code first web service in java and building it with maven. The web service itself works fine but I can't get rid of
minOccurs="0"
in my generated wsdl:
<xs:complexType name="getHOP">
<xs:sequence>
<xs:element minOccurs="0" name="getHopRequest" type="getHopRequest"/>
</xs:sequence>
</xs:complexType>
<xs:element name="getHOPResponse" type="getHOPResponse"/>
<xs:complexType name="getHOPResponse">
<xs:sequence>
<xs:element minOccurs="0" name="return" type="getHopResponse"/>
</xs:sequence>
</xs:complexType>
My interface looks like this
@WebService
public interface GetHop {
GetHopResponse getHOP(
@WebParam(name = "getHopRequest") GetHopRequest getHopRequest);
}
And this is my request class
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "getHopRequest", propOrder = { "companyId", "countryIsoCode",
"currencyIsoCode", "paymentMethodId", "customerId", "totalAmount",
"cartId", "successUrl", "failureUrl", "notifyUrl" })
public class GetHopRequest {
@XmlElement(required = true)
private String companyId;
@XmlElement(required = true)
private String countryIsoCode;
@XmlElement(required = true)
private String currencyIsoCode;
@XmlElement(required = true)
private String paymentMethodId;
@XmlElement(required = true)
private String customerId;
@XmlElement(required = true)
private String totalAmount;
@XmlElement(required = true)
private String cartId;
@XmlElement(required = true)
private String successUrl;
@XmlElement(required = true)
private String failureUrl;
@XmlElement(required = true)
private String notifyUrl;
// Getter and setter here
}
Already was able to set all elements in the getHopRequest as required by
@XmlElement(required = true)
But I can't figure out how to do this for the request/response itself.
Can anyone tell me how to do this?