繁体   English   中英

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中查找sessionID。

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

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

{
  "Session": ""
}

有人可以帮我弄这个吗?

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

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

使用上面的xml函数是因为名为Mock_example_dataCompose操作的outputs是字符串形式。

得到了答案,

{

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

}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM