Could you please help me why a dynamic dropdown doesn't load data from my web service
- Here is web service: @RequestMapping(value="/country", method = RequestMethod.GET) public @ResponseBody String country() { try{ return "<countries><country abbreviation=\"CA\" name=\"Canada\"/></countries>"; } catch (Exception ex) { throw ServiceException.wrap(ex); } } - Here is web service result by RESTClient: <countries><country abbreviation="CA" name="Canada"/></countries> - Here is dropdown properties: Please note dropdown successfully calls the web service however it doesn't show the data Resource URL: http://localhost:9090/smartform/admin/public/RefWService/country Items : /countries/country name: @name value: @abbreviation |
Administrator
|
Hi Pouyan,
Everything looks good, from what I can see, so it is hard to say. Do you get any error in the orbeon.log? Alex On Wed, Mar 25, 2015 at 8:43 PM, pouyan <[hidden email]> wrote: > Could you please help me why a dynamic dropdown doesn't load data from my web > service > > - Here is web service: > > @RequestMapping(value="/country", method = RequestMethod.GET) > public @ResponseBody String country() { > try{ > return "<countries><country abbreviation=\"CA\" > name=\"Canada\"/></countries>"; > } catch (Exception ex) { > throw ServiceException.wrap(ex); > } > } > > - Here is web service result by RESTClient: > > <countries><country abbreviation="CA" name="Canada"/></countries> > > - Here is dropdown properties: > Please note dropdown successfully calls the web service however it doesn't > show the data > > Resource URL: > http://localhost:9090/smartform/admin/public/RefWService/country > Items : /countries/country > name: @name > value: @abbreviation > <http://discuss.orbeon.com/file/n4659708/Screen_Shot_2015-03-25_at_11.png> > > > > > -- > View this message in context: http://discuss.orbeon.com/Dynamic-dropdown-not-load-data-tp4659708.html > Sent from the Orbeon Forms community mailing list mailing list archive at Nabble.com. > > -- > You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. > To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. > To post to this group, send email to [hidden email]. -- You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Thank you Alex,
I got an error on log file 2015-03-28 17:07:20,996 ERROR XFormsServer - |Body received with non-XML media type for replace="instance": text/plain | then I have added content type=application/xml to my web service and it fixed the problem @RequestMapping(produces = MediaType.APPLICATION_XML_VALUE, value="/country", method = RequestMethod.GET) public @ResponseBody String country() { try{ return "<countries><country abbreviation=\"CA\" name=\"Canada\"/></countries>"; } catch (Exception ex) { throw ServiceException.wrap(ex); } } |
Administrator
|
Hi Pouyan, Excellent, I'm glad you found the solution to this one. Alex On Sat, Mar 28, 2015 at 3:18 PM pouyan <[hidden email]> wrote: Thank you Alex, You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Hi Alex
I have added second dynamic dropdown "state" and connected to "country" drop down , I followed the instruction in http://wiki.orbeon.com/forms/doc/developer-guide/xbl-components/databound-select1 The issue I have now is the state drop down not calling the state web service on country change drop down it seems onchange event not trigger on country drop down change if I hardcode country value in resource url ("state?country-key=canada") of state dropdown I can get the state values that means the web service and dropdown works fine Here is my code: <xf:model id="fr-form-model" xxf:expose-xpath-types="true"> ....... <xf:instance id="country-state-instance"> <databound-select1> <country>canada</country> <state/> </databound-select1> </xf:instance> </xf:model> ............ <xh:td> <fr:databound-select1 ref="country" id="plh_personal_information_country-control" appearance="minimal" resource="http://localhost:9090/smartform/admin/public/RefWService/country" bind="plh_personal_information_country-bind"> <xf:label ref="$form-resources/plh_personal_information_country/label"/> <xf:hint ref="$form-resources/plh_personal_information_country/hint"/> <xf:alert ref="$fr-resources/detail/labels/alert"/> <xf:itemset ref="/countries/country"> <xf:label ref="@label"/> <xf:value ref="@key"/> </xf:itemset> </fr:databound-select1> </xh:td> <xh:td> <fr:databound-select1 ref="state" id="plh_personal_information_state-control" appearance="minimal" resource="http://localhost:9090/smartform/admin/public/RefWService/state?country-key={../country}" bind="plh_personal_information_state-bind"> <xf:label ref="$form-resources/plh_personal_information_state/label"/> <xf:hint ref="$form-resources/plh_personal_information_state/hint"/> <xf:alert ref="$fr-resources/detail/labels/alert"/> <xf:itemset ref="/states/state"> <xf:label ref="@label"/> <xf:value ref="@key"/> </xf:itemset> </fr:databound-select1> </xh:td> |
Administrator
|
Hi Pouyan,
-- It is hard to say what's wrong with that code without being able to run it. See the example linked below, which does something very similar, with 3 dropdowns (state -> city -> zip code). Maybe you can see what it does, and figure why things are not working in your case. If not, could you update your example to use the same services used by that example, so it would run independently from your services, create a minimal example using those services that reproduces the problem, and attach the full source of that example. Alex On Fri, Apr 3, 2015 at 11:29 AM pouyan <[hidden email]> wrote: Hi Alex You received this message because you are subscribed to the Google Groups "Orbeon Forms" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Free forum by Nabble | Edit this page |