Azure将XML转换为JSON

问题描述 投票:1回答:2

我正在尝试使用Azure液体映射将以下XML转换为JSON以查找会话ID。

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<LogInResponse xmlns="http://tempuri.org/RLXSOAP19/RLXSOAP19">
<LogInResult>
<ExceptionCode>0</ExceptionCode>
<ExceptionDescription>No error</ExceptionDescription>
</LogInResult>
<SessionID>A VALUE</SessionID>
</LogInResponse>
</soap:Body>
</soap:Envelope>

我正在尝试使用此液体文件转换XML以在JSON中查找sessionID。

{
"Session": "{{content.soap:Envelope.soap:Body.LogInResponse.SessionID}}"
}

这只是在输出中没有返回值:

{
  "Session": ""
}

有人可以帮我弄这个吗?

json xml azure azure-logic-apps dotliquid
2个回答
2
投票

作为使用液体贴图的替代方法,您可以将xml数据包装在json()工作流程函数中。声明如下:

@json(xml(outputs('Mock_example_data')))['soap:Envelope']['soap:Body']['LogInResponse']['SessionID']

使用上面的xml函数是因为来自名为Mock_example_data的Compose动作的outputs是字符串形式。


1
投票

得到了答案,

{

"Session": "{{content.Envelope.Body.LogInResponse.SessionID}}"

}
© www.soinside.com 2019 - 2024. All rights reserved.