I am trying to pass multiple query parameters through browser as
http://localhost:8081/test?SourceQueue=mqinput&PayloadMsgId=11004a90Test0001-3
My flow is as follows,
I am setting the query params to the payload using set payload transformer and then passing those values to the stored procedure. But I am not able to retrieve the values from the database. The payload is null after the database connector.
My config xml for the flow is as follows:
<http:listener config-ref="HTTP_Listener_Configuration" path="/test"
doc:name="HTTP"/>
<set-payload value="SourceQueue=#[message.inboundProperties.'http.query.params'.SourceQueue],PayloadMsgId=#[message.inboundProperties.'http.query.params'.PayloadMsgId]" doc:name="Set Payload"/>
<logger message="#[payload]----------------before db" level="INFO" doc:name="Logger"/>
<db:stored-procedure config-ref="Generic_Database_Configuration" doc:name="Database">
<db:parameterized-query><![CDATA[{CALL E_Enquiry(:SourceQueue1,:PayloadMsgId1)}]]></db:parameterized-query>
<db:in-param name="PayloadMsgId1" type="VARCHAR" value="#[payload.SourceQueue]"/>
<db:in-param name="SourceQueue1" type="VARCHAR" value="#[payload.PayloadMsgId]"/>
</db:stored-procedure>
<logger message="#[payload]----output" level="INFO" doc:name="Logger"/>
My stored procedure is as follows:
CREATE OR REPLACE PROCEDURE E_Enquiry
(IN SourceQueue1 VARCHAR(30) DEFAULT NULL,
IN PayloadMsgId1 VARCHAR(100) DEFAULT NULL)
LANGUAGE SQL
DYNAMIC RESULT SETS 1
BEGIN
DECLARE C1 CURSOR WITH RETURN TO CLIENT FOR
select PayloadMsgId,ExceptionId,EventSource,E_Message.InterfaceId,
CreationTime,SourceProtocol,ErrorMessage,Severity,InterfaceName
from E_Message,E_Config
where (SourceQueue=SourceQueue1 and PayloadMsgId=PayloadMsgId1);
open c1;
END;
Your expression :-
<set-payload value="SourceQueue=#[message.inboundProperties.'http.query.params'.SourceQueue],PayloadMsgId=#[message.inboundProperties.'http.query.params'.PayloadMsgId]" doc:name="Set Payload"/>
is not correct and you cannot achieve this by setting it into payload as the payload is a String format for now and not an Object.
The ideal solution will be using variables like the following :-
<set-variable variableName="SourceQueuevar" value="#[message.inboundProperties.'http.query.params'.SourceQueue]" doc:name="Set SourceQueuevar"/>
<set-variable variableName="PayloadMsgIdvar" value="#[message.inboundProperties.'http.query.params'.PayloadMsgId]" doc:name="Set PayloadMsgIdvar"/>
Once this is set, you can easily use it anywhere, in you SQL or logger in the following expression like :- #[flowVars.SourceQueuevar] #[flowVars.PayloadMsgIdvar]
FlowVars are an opction, however you could also create a map easily using the following notation:
<set-payload value="#[['SourceQueue':message.inboundProperties.'http.query.params'.SourceQueue,'PayloadMsgId':message.inboundProperties.'http.query.params'.PayloadMsgId]]" doc:name="Set Payload"/>
In this way you could access to the payload as an object (because it is a map). You can access to the payload value with an expression like this:
#[payload.SourceQueue]
or
#[payload.PayloadMsgId]
Related
I'm implementing retrieving XMPP chat history with XEP-0313 Message Archive Management using XMPPFramework for iOS. I receive messages page by page using XMPPFramework's class XMPPMessageArchiveManagement. I'm able to receive the pages in the reverse order providing the message before which the next page should be.
let resultSet = XMPPResultSet(max: 50, before: theIdOfTheOldestReceivedMessage ?? "")
self.xmppMAM?.retrieveMessageArchive(at: to,
withFields: [field],
with: resultSet)
But I also would like to receive the messages on each page in the reverse order from the last one to the first one. According to the documentation I should provide the element in the query:
A client wishing for a reversed page should include the <flip-page/> element in its query, like so:
<iq type='set' id='q29309'>
<query xmlns='urn:xmpp:mam:2'>
<x xmlns='jabber:x:data' type='submit'>
<field var='FORM_TYPE' type='hidden'><value>urn:xmpp:mam:2</value></field>
<field var='start'>\<value>2010-08-07T00:00:00Z\</value>\</field>
</x>
<set xmlns='http://jabber.org/protocol/rsm'>
<max>10</max>
<after>09af3-cc343-b409f\</after>
</set>
<flip-page/>
</query>
</iq>
The source: https://xmpp.org/extensions/xep-0313.html#query-paging-flip.
The problem is that I don't populate the query myself: XMPPFramework is responsible for that. The framework generates the final XML and I'm only able to provide fields and a result set. The provided fields will be inside the x element, the provided result set will be a separate element of the queue. But how to provide the <flip-page/> element to the queue with XMPPMessageArchiveManagement by XMPPFramework?
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
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
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 );
I'm sure this is quite simple but I can't seem to get it right
In ColdFusionI've encrypted a querystring and then decrypted the CGI.Query_String value easily enough. I then have a single string which looks like a querystring. But I need to reference the querystring values as I would normally using URL. notation (for example).
How do I do this?
I've tried the code below but can't seem to parse the values out of the structure:
<cfscript>
myStruct = structNew();
for(i=1; i LTE listLen(decrypted,'&');i=i+1) {
structInsert(myStruct, i, listGetAt(decrypted,i,'&'));
}
</cfscript>
Any help appreciated.
UPDATE: (More info if I wasn't clear)
I'm sending data via CFLOCATION with an encrypted querystring. Just to hide some irrelevant info from the user. What I want to do is use the querystring information after it has been decrypted. But I can no longer use the ColdFusion URL structure. So I'm asking how do I parse the information from the decrypted string so I can use it (e.g. within a where clause of a SQL query or simply just display on the page).
Say my decrypted string is update=0&balance=1145.00
How do I go about using something like <cfoutput>#update#</cfoutput>?
If str is your querystring:
<CFSET str = "asdf=1&asd&as=3" />
<CFSET mystruct = structnew() />
<CFLOOP list="#str#" delimiters="&" index="i">
<CFSET key = listfirst(i,"=") />
<CFIF listlen(i,"=") GT 1>
<CFSET value = listlast(i,"=") />
<CFELSE>
<CFSET value = "" />
</CFIF>
<CFSET mystruct[key] = value />
</CFLOOP>