开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜