Reuse HTTP Services

42 views
Skip to first unread message

Larry Beasley

unread,
Aug 11, 2022, 6:54:04 PM8/11/22
to Orbeon Forms
I would like to reuse HTTP Services. Is this possible? It doesn't seem possible and I cannot find anything in conversations. We have dynamic dropdowns and since there isn't a way to default the answer in the control itself then we have to go about it using HTTP services and corresponding actions. It seems feasible that a service could be used more than once since  there are ways to pass in parameters. This is why I am at odds to why is the HTTP is not showing up again once I use it in an action. Here is what I am trying to do:

We have an service for what we call descriptors. The data points are simple, name(label), and id(xpath value). The id is the database primary key. To access a particular descriptor, a parameter is passed in the uri. We publish an electronic health records software so each customer can have tons of "descriptors" like, "Yes, No" or specific ones that align with CDC or other state and federal agencies. So, the parameter could be (type=YesNo) or (type=Some%20Federal%20Agency%20Questions). I can set that up in the HTTP service to be a parameter but since we cannot reuse the HTTP service for multiple controls we basically need to do one of two things: Either use dynamic dropdowns and create an HTTP service and an action for ALL controls or use static dropdowns and create an HTTP service and an action for ALL controls. Is this correct?

For one form that has 30 dynamic dropdowns all of which could have default values that would mean 30 HTTP services and 30 actions. Instead, I feel like there should be 1 HTTP service since they are all referencing the same service and 30 actions to either populate the controls and default value or simply populate the choices. Let me know if there is a way to do the latter.

Alessandro Vernet

unread,
Aug 15, 2022, 6:35:26 PM8/15/22
to orb...@googlegroups.com
Hi Larry,

We've taken some steps to make services reusable by implementing the necessary support at the level of the action syntax (see issue #397 linked below). However, this isn't yet supported at the level of the UI (see issue #5024 linked below, on which I added a +1 from you).


Since you want this for dropdowns, would using Dynamic Dropdowns, without services or actions, work for you? Or is there a problem with that, which I didn't quite get from your message?

-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 orbeon+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/321d398f-5356-4929-8d7e-744ab64ecdd0n%40googlegroups.com.

Alessandro Vernet

unread,
Sep 15, 2022, 6:27:36 PM9/15/22
to orb...@googlegroups.com
Hi Larry,

Did you get a chance to try using the Dynamic Dropdown to reuse services across dropdowns? If so, did that work for you?

-Alex

Larry “Some Guy Named Larry” Beasley

unread,
Jul 16, 2023, 11:24:24 PM7/16/23
to Orbeon Forms
Hi Alex! I never responded to your question. Sorry about that. 

I am working on a large update that has quite a few additions and everyone wants these dynamic dropdowns. The problem is that each customer can have there own set of 'mapped values'. Pretty nice feature but a nightmare because it requires another web service to get the mapped value they choose. To make a long story short, I figured out that I could use a dynamic dropdown and I can make it work when I hard coded the web service uri but it lands on the blank row. The web service is designed to output only one row. How do I select that row by default. I need the dynamic dropdown to be a hidden field for reporting purposes only. Basically a crosswalk. 

I'm also needing to be able to build the resource URL using values from some of the controls.

Larry “Some Guy Named Larry” Beasley

unread,
Jul 16, 2023, 11:29:41 PM7/16/23
to Orbeon Forms
actually Alex, nevermind on the building the resource URL. I figured that out by applying something you helped a former colleague with. Basically this:

{xxf:get-request-parameter('HOSTTRANSLATOR')}/some/webService.xml?param1={//control-1}&param2={//control-2}

That should probably be in the help documents.


Alessandro Vernet

unread,
Jul 17, 2023, 3:10:58 PM7/17/23
to orb...@googlegroups.com
Hi Larry,

I'm glad you found how to use AVTs (those expressions within curly brackets), and that `xxf:get-request-parameter()` works for you. If the hostname doesn't need to be dynamic, and just changes, say, only based on the environment, you can also put its value in your `properties-local.xml`, and use `xxf:property(…)` to access the value of your own property.


Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
Message has been deleted
0 new messages