Azure 转换 XML 到 JSON
Azure Transform XML to JSON
我正在尝试使用 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 中查找会话 ID。
{
"Session": "{{content.soap:Envelope.soap:Body.LogInResponse.SessionID}}"
}
这只是 returns 输出中没有值:
{
"Session": ""
}
有人可以帮我解决这个问题吗?
得到答案,
{
"Session": "{{content.Envelope.Body.LogInResponse.SessionID}}"
}
作为使用液体贴图的替代方法,您可以将 xml 数据包装在 json()
工作流函数中。该语句如下所示:
@json(xml(outputs('Mock_example_data')))['soap:Envelope']['soap:Body']['LogInResponse']['SessionID']
使用上面的 xml
函数是因为 outputs
来自名为 Mock_example_data[=20 的 Compose 操作=] 是字符串形式。
我正在尝试使用 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 中查找会话 ID。
{
"Session": "{{content.soap:Envelope.soap:Body.LogInResponse.SessionID}}"
}
这只是 returns 输出中没有值:
{
"Session": ""
}
有人可以帮我解决这个问题吗?
得到答案,
{
"Session": "{{content.Envelope.Body.LogInResponse.SessionID}}"
}
作为使用液体贴图的替代方法,您可以将 xml 数据包装在 json()
工作流函数中。该语句如下所示:
@json(xml(outputs('Mock_example_data')))['soap:Envelope']['soap:Body']['LogInResponse']['SessionID']
使用上面的 xml
函数是因为 outputs
来自名为 Mock_example_data[=20 的 Compose 操作=] 是字符串形式。