开发者

How to set a property of an object as required on one operation and not required on other operation on WSDL?

开发者 https://www.devze.com 2022-12-19 08:12 出处:网络
For example I have these complexTypes: <!-- will be use as a request parameter --> <complextType name=\"enrollStudentRequest\">

For example I have these complexTypes:

<!-- will be use as a request parameter -->
<complextType name="enrollStudentRequest">     
 <sequence>
  <element name="student" type="Student" />
 </sequence>
</complexType>

<!-- will be use as an operation response -->
<complextType name="retrieveStudentsResponse">
 <sequence>
  <element name="student" type="Student" minOccurs="0" maxOccurs="unbounded" />
 </sequence>
</complexType>

<!-- domain model --&开发者_高级运维gt;
<complexType name="Student">
 <sequence name="id" type="long" />
 <sequence name="firstName" type="string" />
 <sequence name="lastName" type="string" />
</complexType>

The question: How can I enforce so that on "enrollStudentRequest", Student.id is required BUT not required on "retrieveStudentsResponse"? Can I enforce such a restriction on the WSDL?


Not with the schema in its current form, no. You either need to restructure the WSDL/schema, or keep it as optional in the schema, and then perform additional manual validation in Java.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号