I have created a POST request that is performed after some defined action.
Here I have its body:
<json type="object">
<variables type="object">
<customerId type="object">
<value ref="control-1">CUSTOMERID</value>
<type>String</type>
</customerId>
</variables>
</json>
What I'm trying to do is to get value from control-1 and replace the customerId->value value. It doesn't work. However, I noticed that setting name= instead of ref= makes the value empty.
The solution is to set service request value using XPath in action's editor:
/json/variables/customerId/value
Related
I am using Orbeon Forms as my form builder. I have modified "submit" button of the Form Builder to have custom behaviors, please look at my snippet below:
<property as="xs:string" name="oxf.fr.detail.process.send.*.*">
save()
then send(
uri = "{xxf:property('ORBEON_API')}/api/submitForm",
replace = "none",
method = "POST",
content = "xml",
content-type = "application/xml",
nonrelevant = "keep",
serialization = "application/xml"
)
then set-workflow-stage(name = "submitted")
then success-message("save-success")
Now, I am trying to get response of the send() action but can't really find a document describing how to do this in Orbeon CE. I plan to receive an URI from this "{xxf:property('ORBEON_API')}/api/submitForm" so that I can use it to navigate to another page.
I found it is possible to store an Action's response into dataset using Action Settings in PE edition. Sadly, I am using the CE one.
My question is that: Is there a way/workaround for storing and manipulating Action's response in Orbeon CE? Any suggestions are much appreciated 👍.
Thanks in advance.
Currently, actions in processes can't return data, and this is really what you would want here (see #1688). However, send() stores the XML returned by your service in an instance called fr-send-submission-response. So you can access that instance and extract information returned by your service. From XPath, you'd use the following to access that instance:
xxf:instance('fr-send-submission-response')
For instance, the following will make a GET request on a URL that returns breakfast menu, and show the first item on the menu as the success message. (Yes, I know, this isn't a very realistic example! But at least it is one that anyone should be be able to run locally.)
<property as="xs:string" name="oxf.fr.detail.process.submit.*.*">
send(
method = "GET",
uri = "https://www.w3schools.com/XML/simple.xml",
replace = "instance"
)
then success-message(
message = "First item on the menu: {xxf:instance('fr-send-submission-response')/food[1]/name}"
)
</property>
The success message will show like:
I have a subflow that ensures an OAuth access token is current. The token value is saved in an object store that expires the entry shortly before it times out. When expired, a new token value is retrieved and placed in the object store.
I didn't find any straightforward examples of a Mule v3 methodology to refresh a token that utilizes an object store, so here's the code, if anyone's interested.
<sub-flow name="get_token">
<objectstore:retrieve config-ref="TokenStore" key="StatusToken" defaultValue-ref="#['expired']" targetProperty="StatusToken" doc:name="Get token from Object Store"/>
<choice doc:name="Expired?">
<when expression="#[flowVars.StatusToken == 'expired']">
<set-payload value="#[{'grant_type':'refresh_token', 'refresh_token':'${RefreshToken}'}]" doc:name="Set payload for token refresh"/>
<http:request config-ref="HTTP-Token" path="${tokenPath}" method="POST" doc:name="Get new token">
<http:request-builder>
<http:header headerName="Content-Type" value="application/x-www-form-urlencoded"/>
</http:request-builder>
</http:request>
<dw:transform-message doc:name="Write token to flowVar">
<dw:set-variable variableName="StatusToken">
<![CDATA[
%dw 1.0
%output application/java
---
payload.access_token
]]>
</dw:set-variable>
</dw:transform-message>
<objectstore:store config-ref="TokenStore" key="StatusToken" value-ref="#[flowVars.StatusToken]" doc:name="Put token to Object Store"/>
</when>
<otherwise>
<set-variable variableName="Useless" value="#['']" doc:name="Useless placeholder"/>
</otherwise>
</choice>
</sub-flow>
The flow works well as designed, but here's my question. A choice router checks to see if the token has expired. There is no action required otherwise, and the flow errors out if the default path is empty. What's the simplest element to minimize processing and any resource utilization on the default path?
Following Ryan Carter's comment, this could be marked as a duplicate, but not really.
Here's the link:
How do I implement IF in mulesoft
Summary
Mule 4:
The <otherwise> tag is not needed
Mule 3:
A component is needed. I tend to use Logger with the level of TRACE, since log4j2 is smart and won't substitute parameters if the level is set to DEBUG and higher. However, if you really need to debug a flow, it would be good to see that it got routed correctly.
I have used the ol.format.WFS#writeTransaction method successfully to serialize the WFS-t XML for an insert operation to GeoServer, but when I attempt to do the same thing for an update operation the method produces an invalid WFS-t request. Is it possible that I am initializing the ol.format.WFS object incorrectly? Or maybe I am passing the wrong options to the writeTransaction method? Or maybe it's a bug in OpenLayers3?
Here is the gist of my Javascript:
var wfst = new ol.format.WFS({
featureNS: "mypoints",
featureType: "test_points"
});
var options = {
gmlOptions: {srsName: "EPSG:3857"},
featureNS: "mypoints",
featureType: "test_points"
};
var node = wfst.writeTransaction(null, [thePoint], null, options);
var shouldBeValidXML = new XMLSerializer().serializeToString(node)
Here's an example of the XML that that produces:
<Transaction xmlns="http://www.opengis.net/wfs" service="WFS" version="1.1.0" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Update typeName="feature:test_points" xmlns:feature="mypoints">
<Property>
<Name>geometry</Name>
<Value>
<Point xmlns="http://www.opengis.net/gml" srsName="EPSG:3857"><pos>-10606301.721251432 4226568.758428884</pos></Point>
</Value>
</Property>
<Filter xmlns="http://www.opengis.net/ogc">
<FeatureId fid="test_points.fid--62e21e8_153971e1869_-7ffe"/>
</Filter>
</Update>
</Transaction>
The issue is in line 2, where it says:
<Update typeName="feature:test_points" xmlns:feature="mypoints">
That makes GeoServer throw a NoApplicableCodeException, which in turn is somehow related to a generic java.lang.NullPointerException. However, when I replace that line with the following, the request works beautifully:
<Update typeName="mypoints:test_points">
My specific questions are as follows:
Is typeName="mypoints:test_points" actually the correct way to form the request?
If so, what am I doing wrong with ol.format.WFS to get this bad XML? Where is feature coming from?
Thank you in advance!
featureNS: "mypoints" is wrong, you should be using a URI instead
Issue: I am unable to access portlet action URL from within panel in my struts2 liferay portlet.
Description:
I need to access "var"
<portlet:actionURL var="Overview" ../>
from inside
<sj:tabbedpanel href=%{Overview}.../>
but I am unable to access it , it gives blank value!
options I have tried:
<sj:tab href=${Overview}..../>
It gave exception:"according to tld or attribute href, does not accept any expressions" ,
also tried <sj:tab href=%{#Overview}..../>
didnt gave any exception but it did not fetch any value either.
Please help!!
I want to get in ColdFusion 10 an URL parameter from CGI.QUERY_STRING by its name. How to do it without looping?
Any values passed in to a page via the query string are available in the URL scope.
Assume you have a query string that looks like http://mydomain.com?val1=42&val2=moo you would access the variables by referencing them as such
<cfset myVal1 = url.val1 />
<cfset myVal2 = url.val2 />
Or, in cfscript
myVal1 = url.val1;
myVal2 = url.val2;
To see all the values passed in via query string, you can also dump out the URL scope.
<cfdump var="#url#" />
or, in cfscript
writeDump( url );