同步场景:如何使用Rest Adapter将响应JSON转换为XML

2020-08-22 09:21发布

点击此处---> 群内免费提供SAP练习系统(在群公告中)加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)您好, 我正在使用GET方法来...

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


您好,

我正在使用GET方法来获取到Rest Adapter的同步流代理以获取记录。

我能够发出成功的请求,当我在Return中获得响应时,它采用JSON格式,这会导致我的映射失败。

在Rest Receiver适配器中,"数据格式"选项卡,"同步消息的响应格式",如果我选择数据格式为JSON,则错误为

" MP:原因com.ctc.wstx.exc.WstxUnexpectedCharException捕获的异常:序言中的意外字符'{'(代码123);应为'<'

在[row,col {unknown-source}]:[1,1]"

如果选择XML格式,则会以JSON格式获得响应,并按期望的XML结构映射邮件。

示例JSON响应:

{
"数据":[
{
" ID":1,
" OverrideDateDueIndicator":false,
" BusinessUnitCode":" US",
" ReferenceNumber ":" 54",
" JournalID":" QRS",
" TransactionType":" GL",
" AccountNumber":" 1234",
" AccountingMonth":" 2015-07 -01T00:00:00",
" ActivityDate":" 2015-05-01T00:00:00",
" TransactionAmount":-4480.00,
" TransactionVolume":0.00,
" TransactionVolumeUnitOfMeasure":" MCF",
" RevenueGrossAmount":0.00,
" RevenueGrossVolume":0.00,
" SourceDescription":"来自收入的总帐",
" SourceDate":" 2015-10- 02T00:00:00",
" SinglePaymentIndicator":false,
" NonopJIBVoucherIndicator":false,
" OwnerBANumber":" 00123",
" OwnerBASub":1,
" Quantity1Amount ":0.0000000000,
" ArchiveCounter":3,
" ProcessQueueID":33455,
" BatchID":" 1",
" AccountTypeCode":" EX"
},
{
" ID":2,
" OverrideDateDueIndicator":否,
" BusinessUnitCode":" UV",
" ReferenceNumber":" 5455",
" JournalID":" QRS",
" TransactionT ype":" GL",
" AccountNumber":" 1300",
" AccountingMonth":" 2015-07-01T00:00:00",
" ActivityDate":" 2015-05-01T00 :00:00",
" TransactionAmount":480.00,
" TransactionVolume":0.00,
" TransactionVolumeUnitOfMeasure":" MCF",
" RevenueGrossAmount":0.00,
" RevenueGrossVolume" :0.00,
" SourceDescription":"来自收入的总帐",
" SourceDate":" 2015-10-02T00:00:00",
" SinglePaymentIndicator":false,
" NonopJIBVoucherIndicator" :false,
" PropertyNumber":"测试",
" MajorProductCode":" ALL",
" DivisionOrderType":" REV",
" Tier":1,
" Quantity1Amount ":0.0000000000,
" ArchiveCounter":3,
" CostCenter":" test",
" ProcessQueueID":358,
" BatchID":" 1",
" AccountTypeCode" :" IN"
}

],

"消息":[]
}

请告知我的响应源结构如何,以及如何配置Rest Adapter以将JSON转换为XML格式

rest-receiver-adapter-screenshot.jpg response-strucutre.jpg (88.1 kB)