IBM Content Collector error receiving response after external WS call - filenet-p8

In my current project using IBM Content Collector 4.0.1 SP5 with IBM Filenet P8 Content Engine 5.2.1 I need to collect files from file system and add them to a certain P8's object store.
This issue is related and comes after this one.
The WS response must conform to a custom metadata source called Esito which contains two metadata properties called resultCode and message.
The call seems correct but when getting the response I can read this message in the log and the file is not uploaded into P8 Content Manager:
2017-11-10T08:54:05.708Z FINEST [52] [ctms-native]
2017-11-10T08:54:05Z Trace2 0x15a4 Feeding JavaTask with 1 TaskInputs
ufibridge.dll:0x114ac [com.ibm.afu.ufibridge.logging.LoggingAdapter
log] [CTMS-task-15a4 45] 2017-11-10T08:54:05.708Z FINEST [53] Prepared
content to send to
webservice:{"e:\report\amm_000001_00001\2017\11\201711_amm_000001_00001_qxn_report_00.pdf":{"esito":"KO","fileName":"201711_AMM_000001_00001_QXN_REPORT_00(1)(2)(3).pdf"},"e:\report\amm_000001_00001\2017\11\201711_amm_000001_00001_qxn_report_00.xml":{"esito":"KO","fileName":"201711_AMM_000001_00001_QXN_REPORT_00(1)(2)(3).xml"}}
[com.ibm.afu.connector.webservice.task.InvokeServiceTask
getInputHttpEntity] [CTMS-task-15a4 45] 2017-11-10T08:54:05.708Z
FINEST [54] Configuration:
property name="message" type="STRING" displayName="message"
property name="resultCode" type="STRING" displayName="resultCode"
http://192.168.8.29:8080/sirfAcq/filenet/notificaArchiviazione
fileName esito
[com.ibm.afu.connector.webservice.task.InvokeServiceTask execute]
[CTMS-task-15a4 45] 2017-11-10T08:54:05.708Z FINEST [55] Invoking
webservice
URI:http://192.168.8.29:8080/sirfAcq/filenet/notificaArchiviazione
[com.ibm.afu.connector.webservice.task.InvokeServiceTask execute]
[CTMS-task-15a4 45] 2017-11-10T08:54:05.739Z FINEST [56] Invocation
took time (ms): 31
[com.ibm.afu.connector.webservice.task.InvokeServiceTask execute]
[CTMS-task-15a4 45] 2017-11-10T08:54:05.739Z SEVERE [57]
java.lang.String incompatible with com.ibm.json.java.JSONObject
[com.ibm.afu.connector.webservice.task.InvokeServiceTask execute]
[CTMS-task-15a4 45]Exception [java.lang.ClassCastException]:
java.lang.String incompatible with com.ibm.json.java.JSONObject
com.ibm.afu.connector.webservice.task.InvokeServiceTask.processResponse(InvokeServiceTask.java:140)
com.ibm.afu.connector.webservice.task.InvokeServiceTask.execute(InvokeServiceTask.java:112)
Could someone please explain me the correct format of the WS response JSON?
Could it be possible to use the One-Way mode instead of the Request-Response mode?

This issue seems to happen because of the incompatibility between the produce and the response body definition, based on the code snippet I had for your first post, your problem should be here:
produces = {MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE })
#ResponseBody
String notificaArchiviazione(#RequestParam("fileName") String fileName, #RequestParam("esito") String esito)
The first parameter in produce is sat as JSONMediaType.APPLICATION_JSON_VALUE while in the response body you expect a string #RequestParam("fileName") String fileName

Related

Unable to get DeliverToCompID (Tag128) value on acceptor application in QuickFix/J

I am trying to make the DeliverToCompID (tag128) mandatory on NewOrderSingle Message. I am able to send the message from Banzai with tag128 present, but still getting this --> 58=Required tag missing371=128 error message.
I have declared the DeliverToCompID (tag128) value in the config file
[session]
SocketConnectPort=9878
DeliverToCompID=FIXIMULATOR3
SenderCompID=BANZAI
TargetCompID=FIXIMULATOR
and in Banzai Application I am fetching the value from the config and setting it in the message.
String tag128 = settings.getString(sessionID,"DeliverToCompID");
System.out.println("tag 128 "+tag128);
message.getHeader().setField(new DeliverToCompID(tag128));
and I am sending a NewOrderSingle Message, and TAG 128 is present in the logs of both the banzai(sender) and fiximulator(acceptor) application.
BANZAI LOG <20221111-05:28:39, FIX.4.2:BANZAI->FIXIMULATOR, outgoing> (8=FIX.4.29=15435=D34=749=BANZAI52=20221111-05:28:39.66056=FIXIMULATOR128=FIXIMULATOR311=166814451964721=138=256340=154=155=AAA59=060=20221111-05:28:39.65810=238)
FIXIMULATOR LOG <20221111-05:28:39, FIX.4.2:FIXIMULATOR->BANZAI, incoming> (8=FIX.4.29=15435=D34=749=BANZAI52=20221111-05:28:39.66056=FIXIMULATOR128=FIXIMULATOR311=166814451964721=138=256340=154=155=AAA59=060=20221111-05:28:39.65810=238)
But I am getting this :: <20221111-05:28:39, FIX.4.2:FIXIMULATOR->BANZAI, event> (Message 7 Rejected: Required tag missing:128)
<20221111-05:28:39, FIX.4.2:FIXIMULATOR->BANZAI, outgoing> (8=FIX.4.29=12635=334=749=FIXIMULATOR52=20221111-05:28:39.66456=BANZAI115=FIXIMULATOR345=758=Required tag missing371=128372=D373=110=084)
I have used custom FIX42.xml file
<message name="NewOrderSingle" msgtype="D" msgcat="app">
<field name="DeliverToCompID" required="Y"/>
and in the FIXIMLATOR config I have made
ValidateIncomingMessage=Y
DataDictionary=config/FIX42.xml
UseDataDictionary=Y

How to use READ - FTPs in Mule

I am trying to pass a .csv file that came to me via FTPs, it comes in a binary format (I think) and I want to pass it to some format where I can edit the columns and rows.
I use Anypoint Studio version: 7.12.1, FTPS connector 1.7.1, Runtime version 4.4.0 EE
read XML:
<ftps:read doc:name="Read" doc:id="34e4139b-606e-4cd0-8650-4e3b2bab01d7" config-ref="FTPS_Config_OneHub" path="test_Dec.csv"/>
I'm doing it with a transform message:
<ee:transform doc:name="Transform Message" doc:id="165835a6-da27-442a-82bd-a3a28552611f" >
<ee:message >
<ee:set-payload ><![CDATA[%dw 2.0
output application/csv
---
read(payload, "application/string")]]></ee:set-payload>
</ee:message>
</ee:transform>
But I get the following error:
""You called the function 'AnonymousFunction' with these arguments:
1: Array ([{"PK\u0003\u0004\u0014\u0000\b\b\b\u0000": "q",column_1: "^",column_2: ""}, ...)
2: String ("application/string")
But it expects arguments of these types:
1: String | Binary
2: String
3: Object
4| read(payload, "application/string")
^^^^
Trace:
at anonymous::main (line: 4, column: 1)" evaluating expression: "%dw 2.0
output application/csv
---
read(payload, "application/string")"."
The payload with the file looks like this:
PK (\!T [Content_Types].xmlµSËnÂ0ü•È×*6ôPUEƒMCÇ©ô\{“Xø%¯¡ð÷]8”R‰
ƒM†õ9Ç!PEƒMEƒMõà$òEƒMÁEƒEƒMMÒ†äd¦cêD”j);·£ÑPÁgð¹ÎEƒMEƒM'OÐÊ•ÍÕEƒMãî¾H7LÆh’™R‰µ×G¢EƒMEƒMõ^'EƒMEƒM°
Thank you very much!
The input file is not a CSV. It is zip file. You should first decompress it and then see if it has a CSV file inside. You can use the Compression Module in Mule to decompress it.

Mulesoft EC2 *describeInstances* with *filter* option

I'm having problems using the EC2 connector with filters for DescribeInstances. Specifically, I'm trying to find all instances that have the tag "classId" set.
I've also tried to find all instances that have the classId tag with specific string, e.g. "123".
Below are the XMLs of the describeInstance for both scenarios.
tag-key ------
<ec2:describe-instances doc:name="Describe instances" doc:id="ca64b7d4-99bb-4045-bbb4-16c0c27b1df5" config-ref="Amazon_EC2_Configuration">
<ec2:filters>
<ec2:filter name="tag-key" values="#[['classId']]">
</ec2:filter>
</ec2:filters>
</ec2:describe-instances>
tag:classId:----
<ec2:describe-instances doc:name="Describe instances" doc:id="ca64b7d4-99bb-4045-bbb4-16c0c27b1df5" config-ref="Amazon_EC2_Configuration">
<ec2:filters>
<ec2:filter name="tag:classId">
<ec2:values >
<ec2:value value="#['123']" />
</ec2:values>
</ec2:filter>
</ec2:filters>
</ec2:describe-instances>
Each time I receive an error like the following (for tag:classId):
ERROR 2021-03-29 08:32:49,693 [[MuleRuntime].uber.04: [ec2-play].ec2-playFlow.BLOCKING #1092a5bc] [processor: ; event: df5e2df0-908a-11eb-94b5-38f9d38da5c3] org.mule.runtime.core.internal.exception.OnErrorPropagateHandler: 
********************************************************************************
Message        : The filter 'null' is invalid (Service: AmazonEC2; Status Code: 400; Error Code: InvalidParameterValue; Request ID: 33e3bbfb-99ea-4382-932f-647662810c92; Proxy: null)
Element        : ec2-playFlow/processors/0 # ec2-play:ec2-play.xml:33 (Describe instances)
Element DSL      : <ec2:describe-instances doc:name="Describe instances" doc:id="ca64b7d4-99bb-4045-bbb4-16c0c27b1df5" config-ref="Amazon_EC2_Configuration">
<ec2:filters>
<ec2:filter name="tag:classId">
<ec2:values>
<ec2:value value="#['123']"></ec2:value>
</ec2:values>
</ec2:filter>
</ec2:filters>
</ec2:describe-instances>
Error type      : EC2:INVALID_PARAMETER_VALUE
FlowStack       : at ec2-playFlow(ec2-playFlow/processors/0 # ec2-play:ec2-play.xml:33 (Describe instances))
 (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
NOTE: The code works without a filter, returning all instances. But, that isn't what I want or need. The more filtering I can do the faster the response.
Does anyone have samples of the filter option working? Can you tell me what I'm doing wrong?
Thanks!
This surely is a bug. I tried the same and it was not working for me as well. I enabled debug logging and found that the connector is not sending the filter.1.Name=tag:classId as a query parameter in the request. Here is the debug log that I found. (Notice there is no filter.1.Name=tag:classId in the query string)
DEBUG 2021-04-02 21:55:17,198 [[MuleRuntime].uber.03: [test-aws-connector].test-aws-connectorFlow.BLOCKING #2dff3afe] [processor: ; event: 91a34891-93d0-11eb-af49-606dc73d31d1] org.apache.http.wire: http-outgoing-0 >> "Action=DescribeInstances&Version=2016-11-15&Filter.1.Value.1=123"
However, I tried to use the Expression or Bean Reference option and set the expression directly as [{name: 'tag:classId', values:['123']}] like this:
and it worked correctly. Here is the same debug log after this change
DEBUG 2021-04-02 21:59:17,198 [[MuleRuntime].uber.03: [test-aws-connector].test-aws-connectorFlow.BLOCKING #2dff3afe] [processor: ; event: 91a34891-93d0-11eb-af49-606dc73d31d1] org.apache.http.wire: http-outgoing-0 >> "Action=DescribeInstances&Version=2016-11-15&Filter.1.Name=tag%3AclassId&Filter.1.Value.1=123"
Also, I want to point out very weird behaviour, this does not work if you try to format [{name: 'tag:classId',values: ['123']}] across multiple lines in the expression and will give an error during deployment.

illegal characters at line 1 and col 1 in xml response in jmeter

I am trying to validate the xml response from an REST API using JMETER. I am using xml schema assertion to validate the response using xsd.
I am getting the following error on XML Schema Assertion
Assertion error: true
Assertion failure: false
Assertion failure message: fatal: line=1 col=1 Content is not allowed in prolog.
When i see the response that i have received i see there are some illegal characters that is added at the beginning of the response xml.
enter image description here
I have tried to modify jmeter.properties file and changed the following values
jmeter.save.saveservice.output_format=xml
jmeter.save.saveservice.data_type=true
jmeter.save.saveservice.label=true
jmeter.save.saveservice.response_code=true
jmeter.save.saveservice.successful=true
jmeter.save.saveservice.thread_name=true
Please help me in understanding how to remove the illegal characters in the response and allow the xsd validation to pass through.
These characters indicate Byte Order Mark so you can use BOMInputStream from the JSR223 PostProcessor in order to remove them from the response and replace the response data with "sanitized" XML.
Add JSR223 PostProcessor as a child of the HTTP Request sampler where you want to remove this BOM
Put the following code into "Script" area:
def is = new ByteArrayInputStream(prev.getResponseData())
def bOMInputStream = new org.apache.commons.io.input.BOMInputStream(is)
def bom = bOMInputStream.getBOM()
def charsetName = bom == null ? 'UTF-8' : bom.getCharsetName()
def reader = new InputStreamReader(new BufferedInputStream(bOMInputStream), charsetName)
prev.setResponseData(org.apache.commons.io.IOUtils.toByteArray(reader, 'UTF-8'))
That's it, your assertion shouldn't be failing anymore.
More information on Groovy scripting in JMeter: Apache Groovy - Why and How You Should Use It

Freemarker Performance

Hi i have a legacy program which uses struts 2.0.11 with spring 2 and using freemarker 2.4.23 as the template engine.
My struts.properties are as follows:
struts.freemarker.wrapper.altMap=true
struts.freemarker.mru.max.strong.size =250
struts.freemarker.beanwrapperCache=true
struts.freemarker.templatesCache=true
struts.freemarker.templatesCache.updateDelay=600000
We notice that there is always a delay of a few seconds when the last line of our jsp content is processed. For example, this is an extract from our log:
[6/12/16 15:41:42:253 SGT] 0000014b SystemOut O [12/6/2016 15:41:42] INFO [WebContainer : 5] | End Session:2016-06-12 15:41:42.252
[6/12/16 15:41:44:794 SGT] 0000014b TimerIntercep I com.opensymphony.xwork2.interceptor.TimerInterceptor doLog Executed action [/!execute] took 4195 ms.
I am still not sure what causes the 2 second delay. Can any experts on freemarker explain this?
Part of the thread dump
at com.ibm.wsspi.webcontainer.facade.ServletContextFacade.getRealPath(ServletContextFacade.java:243)
at freemarker.cache.WebappTemplateLoader.findTemplateSource(WebappTemplateLoader.java:103)
at freemarker.cache.MultiTemplateLoader.findTemplateSource(MultiTemplateLoader.java:73)
at freemarker.cache.TemplateCache.findTemplateSource(TemplateCache.java:788)
at freemarker.cache.TemplateCache.lookupTemplateWithAcquisitionStrategy(TemplateCache.java:748)
at freemarker.cache.TemplateCache.access$500(TemplateCache.java:58)
at freemarker.cache.TemplateCache$TemplateCacheTemplateLookupContext.lookupWithAcquisitionStrategy(TemplateCache.java:914)
at freemarker.cache.TemplateCache$TemplateCacheTemplateLookupContext.lookupWithLocalizedThenAcquisitionStrategy(TemplateCache.java:934)
at freemarker.cache.TemplateLookupStrategy$Default020300.lookup(TemplateLookupStrategy.java:105)
at freemarker.cache.TemplateCache.lookupTemplate(TemplateCache.java:736)
at freemarker.cache.TemplateCache.getTemplateInternal(TemplateCache.java:372)
at freemarker.cache.TemplateCache.getTemplate(TemplateCache.java:291)
at freemarker.template.Configuration.getTemplate(Configuration.java:2383)
at freemarker.core.Environment.getTemplateForInclusion(Environment.java:2478)
at freemarker.core.Include.accept(Include.java:162)
at freemarker.core.Environment.visit(Environment.java:326)
at freemarker.core.Environment.visit(Environment.java:332)
at freemarker.core.Environment.include(Environment.java:2505)
at freemarker.core.Include.accept(Include.java:171)
at freemarker.core.Environment.visit(Environment.java:326)
at freemarker.core.Environment.visit(Environment.java:332)
at freemarker.core.Environment.process(Environment.java:305)
at freemarker.template.Template.process(Template.java:384)
at org.apache.struts2.components.template.FreemarkerTemplateEngine.renderTemplate(FreemarkerTemplateEngine.java:168)
at org.apache.struts2.components.UIBean.mergeTemplate(UIBean.java:530)
at org.apache.struts2.components.UIBean.end(UIBean.java:484)
at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:43)
at com.ibm._jsp._generalenquirysearch._jspx_meth_s_select_0(_generalenquirysearch.java:3500)
at com.ibm._jsp._generalenquirysearch._jspx_meth_s_form_0(_generalenquirysearch.java:7904)
at com.ibm._jsp._generalenquirysearch._jspService(_generalenquirysearch.java:806)
at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:99)

Resources