I am trying to run below XPath expressions in Mule. Its giving me errors one after another.
Can someone help me correcting these Mule XPath expressions :
<xm:namespace-manager includeConfigNamespaces="true">
<xm:namespace prefix="acord" uri="ACORD.org/Standards/Life/2" />
<xm:namespace prefix="soap" uri="schemas.xmlsoap.org/soap/envelope/" />
</xm:namespace-manager>
<set-variable variableName="pwaHolding"
value="#[xpath('//acord:TXLife/acord:TXLifeRequest/acord:OLifE/acord:Relation[acord:RelationRoleCode/#tc = '37']/#OriginatingObjectID').value" />
<set-variable variableName="pwaPolNumber"
value="#[xpath('//acord:TXLife/acord:TXLifeRequest/acord:OLifE/acord:Holding[#id=$pwaHolding]/acord:Policy/acord:PolNumber').text]" />
I am getting below exception when trying to execute above XPATH expressions :
Message :Execution of the expression "xpath('//acord:TXLife/acord:TXLifeRequest/acord:OLifE/acord:Relation[acord:RelationRoleCode/#tc == '37']/#OriginatingObjectID').value" failed. (org.mule.api.expression.ExpressionRuntimeException). Message payload is of type: String
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. [Error: unexpected token: 37]
[Near : {... #tc == '37']/#OriginatingObjec ....}]
^
[Line: 1, Column: 96] (org.
mvel2.CompileException)
org.mvel2.compiler.ExpressionCompiler:247 (null)
2. Execution of the expression "xpath('//acord:TXLife/acord:TXLifeRequest/acord:OLifE/acord:Relation[acord:RelationRoleCode/#tc == '37']/#OriginatingObjectID').value" failed. (org.mule.api.expression.ExpressionRuntimeException)
org.mule.el.mvel.MVELExpressionLanguage:211 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/expression/ExpressionRuntimeException.html)
3. Execution of the expression "xpath('//acord:TXLife/acord:TXLifeRequest/acord:OLifE/acord:Relation[acord:RelationRoleCode/#tc == '37']/#OriginatingObjectID').value" failed. (org.mule.api.expression.ExpressionRuntimeException). Message payload is of type: String (org.mule.api.transformer.TransformerMessagingException)
org.mule.transformer.AbstractTransformer:123 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transformer/TransformerMessagingException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
[Error: unexpected token: 37]
[Near : {... #tc == '37']/#OriginatingObjec ....}] ^
[Line: 1, Column: 96]
at org.mvel2.compiler.ExpressionCompiler._compile(ExpressionCompiler.java:247)
at org.mvel2.util.ParseTools.subCompileExpression(ParseTools.java:1944)
at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:862)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
Hi David,
I even after replacing ' with " I am still getting below error :
Message : Execution of the expression "xpath('//acord:TXLife/acord:TXLifeRequest/acord:OLifE/acord:Relation[acord:RelationRoleCode/#tc == '37']/#OriginatingObjectID').value" failed. (org.mule.api.expression.ExpressionRuntimeException). Message payload is of type: String
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. [Error: unexpected token: 37]
[Near : {... #tc == '37']/#OriginatingObjec ....}]
^
[Line: 1, Column: 96] (org.mvel2.CompileException)
org.mvel2.compiler.ExpressionCompiler:247 (null)
2. Execution of the expression "xpath('//acord:TXLife/acord:TXLifeRequest/acord:OLifE/acord:Relation[acord:RelationRoleCode/#tc == '37']/#OriginatingObjectID').value" failed. (org.mule.api.expression.ExpressionRuntimeException)
org.mule.el.mvel.MVELExpressionLanguage:211 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/expression/ExpressionRuntimeException.html)
3. Execution of the expression "xpath('//acord:TXLife/acord:TXLifeRequest/acord:OLifE/acord:Relation[acord:RelationRoleCode/#tc == '37']/#OriginatingObjectID').value" failed. (org.mule.api.expression.ExpressionRuntimeException). Message payload is of type: String (org.mule.api.transformer.TransformerMessagingException)
org.mule.transformer.AbstractTransformer:123 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transformer/TransformerMessagingException.html)
I have my second XPATH expression in question which is also failing. Please help me get around this as well
The error comes from the fact you use a ' inside a string delimited by ', which can not work. For example in the following expression the issue is around '37':
value="#[xpath('//acord:TXLife/acord:TXLifeRequest/acord:OLifE/acord:Relation[acord:RelationRoleCode/#tc = '37']/#OriginatingObjectID').value" />
Another issue is that a closing ] is missing at the end of the MEL expression.
Try with:
value="#[xpath("//acord:TXLife/acord:TXLifeRequest/acord:OLifE/acord:Relation[acord:RelationRoleCode/#tc = '37']/#OriginatingObjectID").value" />
Looking at your second XPath, I see [#id=$pwaHolding]. I assume that at this point you are trying to use the pwaHolding flow variable extracted by the first XPath. This will not work as MVEL does not have string interpolation. You need to instead use concatenation and, by the way, not forget to single quote the value #id is compared to:
[#id='" + pwaHolding + "']
Related
When trying to load this tokenizer I am getting this error but I don't know why it can't take the ink_token strangely. Any ideas?
tokenizer = tokenizers.SentencePieceUnigramTokenizer(unk_token="", eos_token="", pad_token="")
----> 1 tokenizer = tokenizers.SentencePieceUnigramTokenizer(unk_token="", eos_token="", pad_token="")
TypeError: init() got an unexpected keyword argument 'unk_token'
In our team we sometimes get an GraphQl syntax error, when modifying our schema.
However, we don't seem to get the name of file causing the issue? The error looks like this:
GraphQLError: Syntax Error: Unterminated string.
at syntaxError (<full-path-to-project>>node_modules/graphql/error/syntaxError.js:15:10)
at readString (<full-path-to-project>>node_modules/graphql/language/lexer.js:513:38)
at readToken (<full-path-to-project>>node_modules/graphql/language/lexer.js:267:14)
at Object.lookahead (<full-path-to-project>>node_modules/graphql/language/lexer.js:54:43)
at Object.advanceLexer [as advance] (<full-path-to-project>>node_modules/graphql/language/lexer.js:44:33)
at Parser.parseStringLiteral (<full-path-to-project>>node_modules/graphql/language/parser.js:519:17)
at Parser.parseDescription (<full-path-to-project>>node_modules/graphql/language/parser.js:728:19)
at Parser.parseFieldDefinition (<full-path-to-project>>node_modules/graphql/language/parser.js:856:28)
at Parser.optionalMany (<full-path-to-project>>node_modules/graphql/language/parser.js:1497:28)
at Parser.parseFieldsDefinition (<full-path-to-project>>node_modules/graphql/language/parser.js:846:17)
at Parser.parseObjectTypeDefinition (<full-path-to-project>>node_modules/graphql/language/parser.js:798:23)
at Parser.parseTypeSystemDefinition (<full-path-to-project>>node_modules/graphql/language/parser.js:696:23)
at Parser.parseDefinition (<full-path-to-project>>node_modules/graphql/language/parser.js:146:23)
at Parser.many (<full-path-to-project>>node_modules/graphql/language/parser.js:1518:26)
at Parser.parseDocument (<full-path-to-project>>node_modules/graphql/language/parser.js:111:25)
at parse (<full-path-to-project>>node_modules/graphql/language/parser.js:36:17) {
message: 'Syntax Error: Unterminated string.',
locations: [ { line: 27, column: 51 } ]
}
Is this normal - and how do I get the file causing the problem?
I am trying to find the max of date from json data. But i am getting below error
Message : "You cannot compare a value of type :Null
Trace:
at reduce (Unknown)
at dw::Core::maxBy (line: 5535, column: 3)
at main (line: 1, column: 248)" evaluating expression:
"%dw 2.0 output application/json --- { Value2: ( if (vars.data.Value1 as String != "")
(payload maxBy((item) -> item.startDate)).startDate default vars.data.Value1
else "" ), RCount: sizeOf(payload) }".
Error type : MULE:EXPRESSION
Element : executeInterface/processors/8 # gg:gg.xml:121 (interface)
Element XML : <set-variable value="#[%dw 2.0 output application/json ---
{ Value2: ( if (vars.data.Value1 as String != "")
(payload maxBy((item) -> item.startDate)).startDate default vars.data.Value1
else "" ), RCount: sizeOf(payload) }]" doc:name="interface" doc:id="2c140185-2fc5-4e11-9b78-96fc2ddcfa2f" variableName="interface"></set-variable>
(set debug level logging or '-Dmule.verbose.exceptions=true' for everything).
The logic written in set variable component is
%dw 2.0
output application/json
---
{
Value2:
( if (vars.data.Value1 as String != "")
(payload maxBy((item) -> item.startDate)).startDate default vars.data.Value1
else ""
),
RCount: sizeOf(payload)
}
while running in the debug mode, found the problem is in maxby statement.
Please suggest.how to fix this issue
The error indicates that something is null when trying to compare. Given that you mentioned the error is at maxBy(), it is probable the the attribute startDate is null or not present in one of the elements. You should show also the values of the transformation so we could confirm it.
UPDATE: I can reproduce the error if the startDate attribute is not present or if it is misspelled. For example if I misspell item.StartDate (wrong uppercase 'S') it produces the error. Make sure the payload and script match exactly.
Could you help me with this Beanshell Assertion code:
I need to add 3 AND conditions & in the 3rd AND condition I need to add OR condition as well and I have tried the following code and I am getting the error
"BeanShellInterpreter: Error invoking bsh method: eval Sourced file: inline evaluation of: ``String Response1 = prev.getResponseDataAsString(); String Response2 = prev.getRe . . . '' : Operator: '"||"' inappropriate for objects
"
Please click on the link to view the code I tried:
Your or condition should be between boolean expressions. So end your line with
&& (Response3.contains("Value4") || Response3.contains("Value5"))
Notice also that the convention for Java variables is starting with a lowerCase character as response3
Here is the code to validate an xml file in PL_SQL using XMLTYPE
doc := dbms_xmldom.newdomdocument;
... xml file is build
v_xml:=DBMS_XMLDOM.GETXMLTYPE(doc);
v_schema:=v_xml.createSchemaBasedXML('xml.xsd');
BEGIN
v_schema.schemavalidate();
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('XML File is not valid');
END;
Is there way to know where the file is not valid, what node ?
Thank you
Note : the exception hidden that way is this one :
ORA-31154: invalid XML document
ORA-19202: Error occurred in XML processing
LSX-00333: literal "" is not valid with respect to the pattern
dbms_utility.format_error_stack is providing more error details, including LSX error messages, which gives you the type of validation error, like
dbms_output.put_line( dbms_utility.format_error_stack);
ORA-31154: invalid XML document
ORA-19202: Error occurred in XML processing
LSX-00220: "" is wrong length, should be 12
ORA-06512: at "SYS.XMLTYPE", line 354