Hi,
How can I check the response returned by the process URL, based on which I want to call back another URL? Eg: Below is the save process configuration 'properties-local-prod.xml' file. <property as="xs:string" name="oxf.fr.detail.process.save.*.*" value='send(uri = "http://localhost:8080/app/save" , method="POST", data-format-version="edge", prune="false", replace="text") then if ("//form/main/bill = '1000'") then navigate("javascript:alert('XYZ');") then if ("//form/main/bill = '2000'") then send("http://localhost:8080/app/saveSuccess") recover navigate("javascript:alert('Failed');")'> </property> When the save button is pressed, it should submit to 'save' url, which will returns XML that has bill element [<form><main><bill> ..../>] and if the result bill id is '1000' it should alert a message and if not should submit to another url. Should that be possible to parse the returned XML as in above configuration? PS: the above did not work. Thanks, Karthi |
CONTENTS DELETED
The author has deleted this message.
|
Hi,
Save is another process. When I click on 'Save' button the 'send(...)' works fine and the send URL returns an XML response. I want to parse this response XML from 'save' process definition and forward to different URL based on the response XML node value. Thanks, |
I have the same question, Karthi did you find the answer ?
|
Administrator
|
Hi Karthi, Frederic,
Could you try replace="instance" in the send()? This isn't officially supported per the documentation, but should store the XML document returned by the service in the instance('fr-send-submission-response'). So you might then be able to test instance('fr-send-submission-response')/main/bill. You'll let us know if this works for you. Alex
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Hi Alex,
I get instance not found message in log file. Below is the log and the configuration. LOG 2016-07-07 17:17:04,187 DEBUG XFormsServer - interpreter - start executing {action name: "xf:setvalue"} 2016-07-07 17:17:04,187 DEBUG XFormsServer - xf:setvalue - setting instance value {source: "setvalue", old value: "false", new value: "", instance: "fr-persistence-instance"} 2016-07-07 17:17:04,187 DEBUG XFormsServer - start dispatching {name: "xxforms-value-changed", target: "fr-persistence-instance"} 2016-07-07 17:17:04,187 DEBUG XFormsServer - start handler {name: "xxforms-value-changed", phase: "target", observer: "fr-persistence-instance"} 2016-07-07 17:17:04,187 DEBUG XFormsServer - interpreter - not executing {action name: "xf:action", condition type: "if", reason: "condition evaluated to 'false'", condition: "name(event('node')) = 'data-status' and event('old-value') != event('new-value')"} 2016-07-07 17:17:04,187 DEBUG XFormsServer - end handler {time (ms): "0"} 2016-07-07 17:17:04,187 DEBUG XFormsServer - end dispatching {time (ms): "0", regular handlers called: "1", native handlers called: "0"} 2016-07-07 17:17:04,187 DEBUG XFormsServer - interpreter - end executing {time (ms): "0", action name: "xf:setvalue"} 2016-07-07 17:17:04,187 DEBUG XFormsServer - end handler {time (ms): "0"} 2016-07-07 17:17:04,187 DEBUG XFormsServer - end dispatching {time (ms): "0", regular handlers called: "1", native handlers called: "1"} 2016-07-07 17:17:04,187 DEBUG XFormsServer - end dispatching {time (ms): "1784", regular handlers called: "1", native handlers called: "0"} 2016-07-07 17:17:04,187 DEBUG XFormsServer - end process: running action {time (ms): "1784", result: "success"} 2016-07-07 17:17:04,187 DEBUG XFormsServer - process: combining with then {action: "ConditionNode(instance('fr-send-submission-response')/RequestInfo/action = 'Failed',ActionNode(navigate,Map(None -> javascript:alert('failed'))),None)"} 2016-07-07 17:17:04,187 WARN XFormsServer - instance() - instance not found {instance id: "fr-send-submission-response"} 2016-07-07 17:17:04,187 DEBUG XFormsServer - process: combining with then {action: "ActionNode(navigate,Map(None -> javascript:alert('Redirect')))"} 2016-07-07 17:17:04,187 DEBUG XFormsServer - start process: running action {action: "ActionNode(navigate,Map(None -> javascript:alert('Redirect')))"} 2016-07-07 17:17:04,187 DEBUG XFormsServer - end process: running action {time (ms): "0", result: "success"} 2016-07-07 17:17:04,187 DEBUG XFormsServer - process: combining with recover {action: "ActionNode(navigate,Map(None -> javascript:alert('Validation is failed')))"} 2016-07-07 17:17:04,187 DEBUG XFormsServer - end process: running {time (ms): "1784"} 2016-07-07 17:17:04,187 INFO lifecycle - event: {"request": "666", "session": "78BC16C4E2FCBEE80639465C7ABE40D2", "source": "fr", "message": "end: process", "time": "1,784 ms"} 2016-07-07 17:17:04,187 DEBUG XFormsServer - interpreter - end executing {time (ms): "1784", action name: "xf:action"} 2016-07-07 17:17:04,187 DEBUG XFormsServer - end handler {time (ms): "1784"} 2016-07-07 17:17:04,187 DEBUG XFormsServer - end dispatching {time (ms): "1784", regular handlers called: "1", native handlers called: "0"} 2016-07-07 17:17:04,187 DEBUG XFormsServer - start performing recalculate {model: "fr-persistence-model"} 2016-07-07 17:17:04,187 DEBUG XFormsServer - evaluated model variables {count: "12"} 2016-07-07 17:17:04,187 DEBUG XFormsServer - start performing bind recalculate {model id: "fr-persistence-model"} 2016-07-07 17:17:04,187 DEBUG XFormsServer - evaluated model variables {count: "12"} 2016-07-07 17:17:04,187 DEBUG XFormsServer - end performing bind recalculate {time (ms): "0"} 2016-07-07 17:17:04,187 DEBUG XFormsServer - end performing recalculate {time (ms): "0"} 2016-07-07 17:17:04,187 DEBUG XFormsServer - start performing revalidate {model: "fr-persistence-model"} Config <property as="xs:string" name="oxf.fr.detail.process.save.*.*" value='send(uri = "http://localhost:8080/app/saveBill" , method="POST", data-format-version="edge", prune="false", replace="instance") then if ("instance('fr-send-submission-response')/RequestInfo/action = 'Failed'") then navigate("javascript:alert('failed')") then navigate("javascript:alert('Redirect')") recover navigate("javascript:alert('Validation is failed')")'> </property> |
Administrator
|
Hi Karthi,
Got it, and thanks for trying. I've created and RFE for this: https://github.com/orbeon/orbeon-forms/issues/2852 In the meantime, I would write this logic in XForms, with your own <xf:submission> added to the model of the form, and the logic triggered by an xf:dispatch() in your process. Would this make sense? Alex
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Administrator
|
Karthi,
This should work with: xxf:instance('fr-send-submission-response') Can you confirm? -Erik |
Free forum by Nabble | Edit this page |