gpt4 book ai didi

mule - 数据编织错误 : You called the function 'Value Selector' with these arguments when converting Excel to JSON

转载 作者:行者123 更新时间:2023-12-02 17:06:18 26 4
gpt4 key购买 nike

我正在使用 Anypoint 7 和 Mule 4.1。

我想从我计算机上的文件夹中读取一个 Excel (xlsx) 文件并将其转换为 JSON,但我收到错误消息:

You called the function 'Value Selector' with these arguments:

我认为这是流式传输的问题,但不确定如何解决。

感谢您的帮助

XML:

<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw"
xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
xmlns:ftp="http://www.mulesoft.org/schema/mule/ftp"
xmlns:sftp="http://www.mulesoft.org/schema/mule/sftp" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/sftp http://www.mulesoft.org/schema/mule/sftp/current/mule-sftp.xsd
http://www.mulesoft.org/schema/mule/ftp http://www.mulesoft.org/schema/mule/ftp/current/mule-ftp.xsd
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd">
<flow name="testFlow" doc:id="3030b14f-b215-4c85-a6a4-96236516c552" >
<scheduler doc:name="Scheduler" doc:id="d0985a96-a23c-4e2c-80ae-d78a9acd938e" >
<scheduling-strategy >
<fixed-frequency timeUnit="SECONDS"/>
</scheduling-strategy>
</scheduler>
<file:read doc:name="Read xlsx file" doc:id="90b40273-ec58-47de-a48b-9812c52a74ea" path="C:\apps\test-api\src\test\resources\input\myTestExcelFile.xlsx" config-ref="File_Config">
<ee:repeatable-file-store-stream />
</file:read>
<ee:transform doc:name="Transform Message" doc:id="36dbec15-6e02-4fdf-8176-025ad7fdce61" >
<ee:message >
<ee:set-payload ><![CDATA[%dw 2.0
input payload application/xlsx
output application/json
---
payload.CUSTOMER map ( cUSTOMER , indexOfCUSTOMER ) -> {
custId: cUSTOMER."Customer Code" default "",
custName: cUSTOMER.Name default ""
}
]]></ee:set-payload>
</ee:message>
</ee:transform>
<logger level="INFO" doc:name="Log Message" doc:id="5142b6ff-9d04-4cb2-ba3b-7fec5e52dd9b" message='#[payload]' category="com.test"/>
</flow>
</mule>

错误信息

ERROR 2018-08-03 11:03:34,628 [[MuleRuntime].cpuLight.02: [test-api].testFlow.CPU_LITE @75c313f3] [event: 0-7a8a0890-9704-11e8-900d-a44cc83a8228] org.mule.runtime.core.internal.exception.OnErrorPropagateHandler: 
********************************************************************************
Message : "You called the function 'Value Selector' with these arguments:
1: Binary
2: Name ("CUSTOMER")

But it expects one of these combinations:
(Array, Name)
(Array, String)
(Date, Name)
(DateTime, Name)
(LocalDateTime, Name)
(LocalTime, Name)
(Object, Name)
(Object, String)
(Period, Name)
(Time, Name)

5| payload.CUSTOMER map ( cUSTOMER , indexOfCUSTOMER ) -> {
^^^^^^^^^^^^^^^^
Trace:
at map (line: 5, column: 1)
at main (line: 5, column: 18)" evaluating expression: "%dw 2.0
input payload application/xlsx
output application/json
---
payload.CUSTOMER map ( cUSTOMER , indexOfCUSTOMER ) -> {
custId: cUSTOMER."Customer Code" default "",
custName: cUSTOMER.Name default ""
}
".
Error type : MULE:EXPRESSION
Element : testFlow/processors/1 @ test-api:test.xml:21 (Transform Message)
Element XML : <ee:transform doc:name="Transform Message" doc:id="36dbec15-6e02-4fdf-8176-025ad7fdce61">
<ee:message>
<ee:set-payload>%dw 2.0
input payload application/xlsx
output application/json
---
payload.CUSTOMER map ( cUSTOMER , indexOfCUSTOMER ) -> {
custId: cUSTOMER."Customer Code" default "",
custName: cUSTOMER.Name default ""
}</ee:set-payload>
</ee:message>
</ee:transform>

(set debug level logging or '-Dmule.verbose.exceptions=true' for everything)

XLSX 文件

enter image description here

最佳答案

我发现问题是我没有将文件连接器上的 MIME 类型设置为 application/xlsx

enter image description here

一旦我设置了它,它就起作用了。

关于mule - 数据编织错误 : You called the function 'Value Selector' with these arguments when converting Excel to JSON,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51670465/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com