title: Returning complex type response at BPEL
body: <p>Basically I want to be able to generate a response from BPEL ODE engine with complex type that has an unbounded number of elements.
  The idea is very basic, I get a list of objects as an input then I do some filtering based on a certain category. Then I need to generate response based on the filtering, which might be more than one elements. But the BPEL copy assignment only allow one to one assignment.
  I already try using array but can't seem to assign to more than one element also.
  The snippets below is for both the input and the output.</p>
  
  <pre><code>        &lt;complexType name="hospitalType"&gt;
          &lt;sequence minOccurs="1" maxOccurs="unbounded"&gt;
            &lt;element name="patients"&gt;
            &lt;complexType&gt;
              &lt;sequence&gt;
                &lt;element name="patient" minOccurs="1" maxOccurs="unbounded"&gt;
                  &lt;complexType&gt;
                    &lt;sequence&gt;
                      &lt;element type="string" name="name"/&gt;
                      &lt;element type="date" name="dob"/&gt;
                      &lt;element type="byte" name="age"/&gt;
                      &lt;element type="string" name="status"/&gt;
                    &lt;/sequence&gt;
                    &lt;attribute name="pid" type="ID"/&gt;
                  &lt;/complexType&gt;
                &lt;/element&gt;
              &lt;/sequence&gt;
            &lt;/complexType&gt;
          &lt;/element&gt;
  </code></pre>
  
  <p>So far the following is what I tried</p>
  
  <pre><code>       &lt;bpel:copy&gt;
                  &lt;bpel:from part="payload" variable="input"&gt;
  
                              &lt;bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"&gt;
                                  &lt;![CDATA[tns:patients/tns:patient[1]]]&gt;
                              &lt;/bpel:query&gt;
                          &lt;/bpel:from&gt;
                  &lt;bpel:to part="inload" variable="output"&gt;
  
                              &lt;bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"&gt;
                                  &lt;![CDATA[tns:patients/tns:patient]]&gt;
                              &lt;/bpel:query&gt;
                          &lt;/bpel:to&gt;
  
          &lt;/bpel:copy&gt;
  </code></pre>
  
  <p>I can't even do a simple assignment if the input has more than one element..</p>