Orbeon autocomplete - Content is not allowed in prolog
I'm trying to add an autocomplete component in dynamic mode to a form created with the Orbeon Form Builder (version Orbeon Forms 3.9.0+.stable.201109261742 PE).

The xml below is a simple test form with the autocomplete that retrieves the data from a public webservice (currently with a static request body).
The first time the autocomplete loads the data it works just fine: the items are presented in a list. But the second time, when I type another character to narrow down the search results, or when I select an item from the list, I get the error message "Content is not allowed in prolog".

If I ignore the error and continue anyway, the error changes to "Got unexpected request sequence number".

I don't understand why it only works the first time since the data returned by the web service is always the same because of the static request body.

Below you find the complete xml of the test form.

	<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml"
	            xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
	            xmlns:xi="http://www.w3.org/2001/XInclude"
	            xmlns:ev="http://www.w3.org/2001/xml-events"
	            xmlns:xforms="http://www.w3.org/2002/xforms"
	            xmlns:saxon="http://saxon.sf.net/"
	            xmlns:xs="http://www.w3.org/2001/XMLSchema"
	            xmlns:exforms="http://www.exforms.org/exf/1-0"
	            xmlns:sql="http://orbeon.org/oxf/xml/sql"
	            xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
	            xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
	            xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
	            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
		   <xhtml:head>
			      <xhtml:title>Test form</xhtml:title>
			      <xforms:model id="fr-form-model">
				         <xforms:instance id="fr-form-instance">
					            <form>
						               <section-1>
							                  <codeSearch/>
						               </section-1>
					            </form>
				         </xforms:instance>
				         <xforms:bind id="fr-form-binds" nodeset="instance('fr-form-instance')">
					            <xforms:bind id="section-1-bind" nodeset="section-1">
						               <xforms:bind id="codeSearch-bind" nodeset="codeSearch" name="codeSearch" type="xforms:string"/>
					            </xforms:bind>
				         </xforms:bind>
				         <xforms:instance id="fr-form-metadata" xxforms:readonly="true">
					            <metadata>
						               <application-name>IRISbox</application-name>
						               <form-name>Test</form-name>
						               <title xml:lang="fr">Test form</title>
						               <description xml:lang="fr"/>
						               <author/>
						               <logo mediatype="" filename="" size=""/>
					            </metadata>
				         </xforms:instance>
				         <xforms:instance id="fr-form-attachments">
					            <attachments>
						               <css mediatype="text/css" filename="" size=""/>
						               <pdf mediatype="application/pdf" filename="" size=""/>
					            </attachments>
				         </xforms:instance>
				         <xforms:instance id="fr-form-resources" xxforms:readonly="false">
					            <resources>
						               <resource xml:lang="fr">
							                  <codeSearch>
								                     <label>Cities</label>
								                     <hint/>
								                     <help/>
								                     <alert/>
							                  </codeSearch>
							                  <section-1>
								                     <label>Test</label>
								                     <help/>
							                  </section-1>
						               </resource>
					            </resources>
				         </xforms:instance>
				         <xforms:instance id="fr-service-request-instance" xxforms:exclude-result-prefixes="#all">
					            <request/>
				         </xforms:instance>
				         <xforms:instance id="fr-service-response-instance" xxforms:exclude-result-prefixes="#all">
					            <response/>
				         </xforms:instance>
				
				
				<!-- Search Cities by Name HTTP service -->
				<xforms:instance id="searchCitiesByName-instance" class="fr-service"
				                             xxforms:exclude-result-prefixes="#all">
					               <body>&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.restfulwebservices.net/ServiceContracts/2008/01"&gt;
					   &lt;soapenv:Header/&gt;
					   &lt;soapenv:Body&gt;
					      &lt;ns:GetCitiesByCountry&gt;
					         &lt;ns:Country&gt;USA&lt;/ns:Country&gt;
					      &lt;/ns:GetCitiesByCountry&gt;
					   &lt;/soapenv:Body&gt;
					&lt;/soapenv:Envelope&gt;</body>
				</xforms:instance>
				<xforms:submission id="searchCitiesByName-submission" class="fr-service"
			                               ref="instance('fr-service-request-instance')"
			                               resource="http://www.restfulwebservices.net/wcf/WeatherForecastService.svc"
			                               method="post"
			                               serialization="application/xml"
			                               mediatype="application/soap+xml; action=GetCitiesByCountry"
			                               replace="instance"
			                               instance="searchCitiesByName-instance"/>
						
			            <xforms:action ev:event="xforms-submit" ev:observer="searchCitiesByName-submission">
				               <xxforms:variable name="request-instance-name" select="'searchCitiesByName-instance'"
			                                  as="xs:string"/>
				               <xforms:insert nodeset="instance('fr-service-request-instance')"
			                               origin="saxon:parse(instance($request-instance-name))"/>
				</xforms:action>
	
			</xforms:model>
		   </xhtml:head>
		   <xhtml:body>
			      <fr:view>
				         <xforms:label ref="instance('fr-form-metadata')/title"/>
				         <fr:body>
					            <fr:section id="section-1-section" bind="section-1-bind">
						               <xforms:label ref="$form-resources/section-1/label"/>
						               <xforms:help ref="$form-resources/section-1/help"/>
						               <fr:grid columns="1">
							                  <xhtml:tr>
								                     <xhtml:td>
								
										<fr:autocomplete
 
											id="codeSearch" 
											bind="codeSearch-bind"
											dynamic-itemset="true"
											max-results-displayed="50">
											
											<xforms:label ref="$form-resources/codeSearch/label"/>
											
											<!-- React to user searching -->
											<xforms:action ev:event="fr-search-changed">
												<xxforms:variable name="search-value" select="event('fr-search-value')"/>
												<xxforms:variable name="make-suggestion" select="string-length($search-value) &gt;= 2"/>
										
												<xforms:action if="$make-suggestion">
													<xforms:setvalue ref="instance('code-search-instance')/searchFor" value="$search-value"/>
													<xforms:send submission="searchCitiesByName-submission"/>
												</xforms:action>
										
												<xforms:action if="not($make-suggestion)">
													<!-- Delete itemset -->
													<xforms:delete nodeset="instance('searchCitiesByName-instance')//*:GetCitiesByCountryResult/*:string"/>
												</xforms:action>
											</xforms:action>
											
											<xforms:itemset nodeset="instance('searchCitiesByName-instance')//*:GetCitiesByCountryResult/*:string">
												<xforms:label ref="text()"/>
												<xforms:value ref="text()"/>
											</xforms:itemset>
										</fr:autocomplete>
										
								                     </xhtml:td>
							                  </xhtml:tr>
							                  <xhtml:tr>
								                     <xhtml:td>
									                        <widget:xforms-instance-inspector xmlns:widget="http://orbeon.org/oxf/xml/widget" id="orbeon-xforms-inspector"/>
								                     </xhtml:td>
							                  </xhtml:tr>
						               </fr:grid>
					            </fr:section>
				         </fr:body>
			      </fr:view>
		   </xhtml:body>
	</xhtml:html>

Any help is appreciated.
Orbeon autocomplete - Content is not allowed in prolog
===

I'm trying to add an autocomplete component in dynamic mode to a form created with the Orbeon Form Builder (version Orbeon Forms 3.9.0+.stable.201109261742 PE).

The xml below is a simple test form with the autocomplete that retrieves the data from a public webservice (currently with a static request body).
The first time the autocomplete loads the data it works just fine: the items are presented in a list. But the second time, when I type another character to narrow down the search results, or when I select an item from the list, I get the error message "Content is not allowed in prolog".

If I ignore the error and continue anyway, the error changes to "Got unexpected request sequence number".

I don't understand why it only works the first time since the data returned by the web service is always the same because of the static request body.

Below you find the complete xml of the test form.

	<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml"
	            xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
	            xmlns:xi="http://www.w3.org/2001/XInclude"
	            xmlns:ev="http://www.w3.org/2001/xml-events"
	            xmlns:xforms="http://www.w3.org/2002/xforms"
	            xmlns:saxon="http://saxon.sf.net/"
	            xmlns:xs="http://www.w3.org/2001/XMLSchema"
	            xmlns:exforms="http://www.exforms.org/exf/1-0"
	            xmlns:sql="http://orbeon.org/oxf/xml/sql"
	            xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
	            xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
	            xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
	            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
		   <xhtml:head>
			      <xhtml:title>Test form</xhtml:title>
			      <xforms:model id="fr-form-model">
				         <xforms:instance id="fr-form-instance">
					            <form>
						               <section-1>
							                  <codeSearch/>
						               </section-1>
					            </form>
				         </xforms:instance>
				         <xforms:bind id="fr-form-binds" nodeset="instance('fr-form-instance')">
					            <xforms:bind id="section-1-bind" nodeset="section-1">
						               <xforms:bind id="codeSearch-bind" nodeset="codeSearch" name="codeSearch" type="xforms:string"/>
					            </xforms:bind>
				         </xforms:bind>
				         <xforms:instance id="fr-form-metadata" xxforms:readonly="true">
					            <metadata>
						               <application-name>IRISbox</application-name>
						               <form-name>Test</form-name>
						               <title xml:lang="fr">Test form</title>
						               <description xml:lang="fr"/>
						               <author/>
						               <logo mediatype="" filename="" size=""/>
					            </metadata>
				         </xforms:instance>
				         <xforms:instance id="fr-form-attachments">
					            <attachments>
						               <css mediatype="text/css" filename="" size=""/>
						               <pdf mediatype="application/pdf" filename="" size=""/>
					            </attachments>
				         </xforms:instance>
				         <xforms:instance id="fr-form-resources" xxforms:readonly="false">
					            <resources>
						               <resource xml:lang="fr">
							                  <codeSearch>
								                     <label>Cities</label>
								                     <hint/>
								                     <help/>
								                     <alert/>
							                  </codeSearch>
							                  <section-1>
								                     <label>Test</label>
								                     <help/>
							                  </section-1>
						               </resource>
					            </resources>
				         </xforms:instance>
				         <xforms:instance id="fr-service-request-instance" xxforms:exclude-result-prefixes="#all">
					            <request/>
				         </xforms:instance>
				         <xforms:instance id="fr-service-response-instance" xxforms:exclude-result-prefixes="#all">
					            <response/>
				         </xforms:instance>
				
				
				<!-- Search Cities by Name HTTP service -->
				<xforms:instance id="searchCitiesByName-instance" class="fr-service"
				                             xxforms:exclude-result-prefixes="#all">
					               <body>&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.restfulwebservices.net/ServiceContracts/2008/01"&gt;
					   &lt;soapenv:Header/&gt;
					   &lt;soapenv:Body&gt;
					      &lt;ns:GetCitiesByCountry&gt;
					         &lt;ns:Country&gt;USA&lt;/ns:Country&gt;
					      &lt;/ns:GetCitiesByCountry&gt;
					   &lt;/soapenv:Body&gt;
					&lt;/soapenv:Envelope&gt;</body>
				</xforms:instance>
				<xforms:submission id="searchCitiesByName-submission" class="fr-service"
			                               ref="instance('fr-service-request-instance')"
			                               resource="http://www.restfulwebservices.net/wcf/WeatherForecastService.svc"
			                               method="post"
			                               serialization="application/xml"
			                               mediatype="application/soap+xml; action=GetCitiesByCountry"
			                               replace="instance"
			                               instance="searchCitiesByName-instance"/>
						
			            <xforms:action ev:event="xforms-submit" ev:observer="searchCitiesByName-submission">
				               <xxforms:variable name="request-instance-name" select="'searchCitiesByName-instance'"
			                                  as="xs:string"/>
				               <xforms:insert nodeset="instance('fr-service-request-instance')"
			                               origin="saxon:parse(instance($request-instance-name))"/>
				</xforms:action>
	
			</xforms:model>
		   </xhtml:head>
		   <xhtml:body>
			      <fr:view>
				         <xforms:label ref="instance('fr-form-metadata')/title"/>
				         <fr:body>
					            <fr:section id="section-1-section" bind="section-1-bind">
						               <xforms:label ref="$form-resources/section-1/label"/>
						               <xforms:help ref="$form-resources/section-1/help"/>
						               <fr:grid columns="1">
							                  <xhtml:tr>
								                     <xhtml:td>
								
										<fr:autocomplete
 
											id="codeSearch" 
											bind="codeSearch-bind"
											dynamic-itemset="true"
											max-results-displayed="50">
											
											<xforms:label ref="$form-resources/codeSearch/label"/>
											
											<!-- React to user searching -->
											<xforms:action ev:event="fr-search-changed">
												<xxforms:variable name="search-value" select="event('fr-search-value')"/>
												<xxforms:variable name="make-suggestion" select="string-length($search-value) &gt;= 2"/>
										
												<xforms:action if="$make-suggestion">
													<xforms:setvalue ref="instance('code-search-instance')/searchFor" value="$search-value"/>
													<xforms:send submission="searchCitiesByName-submission"/>
												</xforms:action>
										
												<xforms:action if="not($make-suggestion)">
													<!-- Delete itemset -->
													<xforms:delete nodeset="instance('searchCitiesByName-instance')//*:GetCitiesByCountryResult/*:string"/>
												</xforms:action>
											</xforms:action>
											
											<xforms:itemset nodeset="instance('searchCitiesByName-instance')//*:GetCitiesByCountryResult/*:string">
												<xforms:label ref="text()"/>
												<xforms:value ref="text()"/>
											</xforms:itemset>
										</fr:autocomplete>
										
								                     </xhtml:td>
							                  </xhtml:tr>
							                  <xhtml:tr>
								                     <xhtml:td>
									                        <widget:xforms-instance-inspector xmlns:widget="http://orbeon.org/oxf/xml/widget" id="orbeon-xforms-inspector"/>
								                     </xhtml:td>
							                  </xhtml:tr>
						               </fr:grid>
					            </fr:section>
				         </fr:body>
			      </fr:view>
		   </xhtml:body>
	</xhtml:html>

Any help is appreciated.