使用REST适配器剥离JSON中的标签名称

2020-08-21 16:46发布

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

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


你好

我们必须将来自SAP的多个地址记录发布到第三方REST服务。我们在PO 7.5上。

我们正在使用ABAP PROXY到PI到REST的接口。

我已经使用出现0-n的Address元素创建了数据类型。 已将其分配给消息类型MT_ADDRESS。

REST适配器上的XML至JSON转换已用于将输入XML转换为JSON。

使用此设置,下面的JSON被发送到REST服务。

{" 地址":[

{"代码":" POST1","名称":" Test POS Address 1"," erpId":" POST1"," line1":" Address 1 Line 1"," line2":" Address 1 Line" 2"," city":" City1"," state":" MA"," zip":19501," country":" US"," shipTo":true," billTo":true," invoiceTo":true }

{"代码":" POST2","名称":" Test POS Address 2"," erpId":" POST2"," line1":" Address 2 Line 1"," line2":" Address 2 Line" 2"," city":" City2"," state":" MA"," zip":19502," country":" US"," shipTo":true," billTo":true," invoiceTo":true }

]}

预期格式:

[

{"代码":" POST1","名称":" Test POS Address 1"," erpId":" POST1"," line1":" Address 1 Line 1"," line2":" Address 1 Line" 2"," city":" City1"," state":" MA"," zip":19501," country":" US"," shipTo":true," billTo":true," invoiceTo":true }

{"代码":" POST2","名称":" Test POS Address 2"," erpId":" POST2"," line1":" Address 2 Line 1"," line2":" Address 2 Line" 2"," city":" City2"," state":" MA"," zip":19502," country":" US"," shipTo":true," billTo":true," invoiceTo":true }

]

我的消息类型是MT_ADDRESS,由于设置了"剥离外部元素",该消息类型已经被剥离。

但是我找不到剥离"地址"标签的方法吗?

请帮助?

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

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


你好

我们必须将来自SAP的多个地址记录发布到第三方REST服务。我们在PO 7.5上。

我们正在使用ABAP PROXY到PI到REST的接口。

我已经使用出现0-n的Address元素创建了数据类型。 已将其分配给消息类型MT_ADDRESS。

REST适配器上的XML至JSON转换已用于将输入XML转换为JSON。

使用此设置,下面的JSON被发送到REST服务。

{" 地址":[

{"代码":" POST1","名称":" Test POS Address 1"," erpId":" POST1"," line1":" Address 1 Line 1"," line2":" Address 1 Line" 2"," city":" City1"," state":" MA"," zip":19501," country":" US"," shipTo":true," billTo":true," invoiceTo":true }

{"代码":" POST2","名称":" Test POS Address 2"," erpId":" POST2"," line1":" Address 2 Line 1"," line2":" Address 2 Line" 2"," city":" City2"," state":" MA"," zip":19502," country":" US"," shipTo":true," billTo":true," invoiceTo":true }

]}

预期格式:

[

{"代码":" POST1","名称":" Test POS Address 1"," erpId":" POST1"," line1":" Address 1 Line 1"," line2":" Address 1 Line" 2"," city":" City1"," state":" MA"," zip":19501," country":" US"," shipTo":true," billTo":true," invoiceTo":true }

{"代码":" POST2","名称":" Test POS Address 2"," erpId":" POST2"," line1":" Address 2 Line 1"," line2":" Address 2 Line" 2"," city":" City2"," state":" MA"," zip":19502," country":" US"," shipTo":true," billTo":true," invoiceTo":true }

]

我的消息类型是MT_ADDRESS,由于设置了"剥离外部元素",该消息类型已经被剥离。

但是我找不到剥离"地址"标签的方法吗?

请帮助?

付费偷看设置
发送
3条回答
1楼-- · 2020-08-21 17:14

嗨Soumya,

AFAIK,"条形外部元素"只是删除了消息的操作。 另外,由于要删除标头标记,因此可以在将XML Anoymizer bean转换为JSON之前使用它-

在XML中通过XMLAnonymizer Bean删除PI中的命名空间| | | SCN

问候,

Nitin

大简至美
2楼-- · 2020-08-21 17:21

嗨Soumya,

是的,你是正确的,我不好。 我想您可以应用定制适配器模块。 这是现成的代码,您可以实现它们并替换Message标签。

适配器模块:ReplaceString

此致

Nitin

95年老男孩
3楼-- · 2020-08-21 17:21

嗨,

请在模块密钥级别的RestAdapterBean模块选项卡下面的以下位置添加以下参数。

1 sap.com/com.sap.aii.adapter。 rest.app/RESTAdapterBean 本地企业Bean rest

ModuleKey ParameterName ParameterValue

rest setIgnoredElements PersonalInfo(无论您想从Json跳过什么标签)

此致

尼泊尔。

一周热门 更多>