问题描述
要求是从包含HTML代码的XML中提取元素(HTML页面),然后发送自定义的json负载作为响应。
<HTMLPage>
<html>
<head>
<script type="text/javascript">function postToTlg(){document.getElementById('hdncopsPage').submit();}</script>
<title>copS</title>
</head>
<body onload="postToTlg();">
<form id="hdncopsPage" method="post" action="" />
</body>
</html>
</HTMLPage>
Extract变量和Assign策略如下所示。
<Variable name="HTMLPage" type="string">
<XPath>/cops:CreateCardTransactionRedirectv2Response/cops:HTMLPage</XPath>
</Variable>
<Set>
<Payload contentType="application/json">{
"copSReference":"{payment.copSReference}","ApplicationReference" : "{payment.ApplicationReference}","HTMLPage" : "{payment.HTMLPage}","Result" : {
"Code" : "{payment.Code}","Text" : "{payment.Text}"
}
}
</Payload>
</Set>
但是JSON响应如下所示,
{
"copSReference": "12","ApplicationReference": "P/w/217sq44",**"HTMLPage": "function postToTlg(){document.getElementById('hdncopsPage').submit();}copS",**
"Result": {
"Code": "0","Text": "Success"
}
}
我希望收到类似的答复
{
"copSReference": "12","HTMLPage": " <html> <head> <script type="text/javascript">function postToTlg(){document.getElementById('hdncopsPage').submit();}</script> <title>copS</title> </head> <body onload="postToTlg();"> <form id="hdncopsPage" method="post" action="" /> </body> </html>","Result": {
"Code": "0","Text": "Success"
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)