How to make input fields mandatory for BPEL process in the XML schema file

We build a schema file (for custom requirements) for the input parameters for a BPEL process. Out of them, we want to make few parameters as mandatory. In this post you will learn how to achieve this.

Specifying how many times an element can app ear is referred to as cardinality. Cardinality is specified using the attributes minOccurs and maxOccurs, and allows an element to be specified as mandatory, optional, or that it can appear many times. minOccurs can be assigned any non-negative integer value (e.g. 0, 1, 2, 3… etc.), and maxOccurs can be assigned any non-negative integer value or the string constant “unbounded” meaning no maximum.
The default values for minOccurs and maxOccurs is 1. Therefore, if both the minOccurs and maxOccurs attributes are absent, as in all the previous examples, the element must appear once and once only.

<xs:element name=”Customer_dob

If we don’t specify minOccurs or maxOccurs, then the default values of 1 are used, so in this case there has to be one and only one occurrence of Customer_dob. Here by default all the fields in the schema will be manadatory.

<xs:element name=”Customer_order
            minOccurs =”0

Here, a customer can have any number of Customer_orders (even 0). So to make any field optional in the schema file, you need to add minOccurs =”0″ in the schema file.

<xs:element name=”Customer_hobbies

In this example, the element Customer_hobbies must appear at least twice, but no more than 10 times

This entry was posted in BPEL, Service Oriented Architecture (SOA 11g) and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s