Xml 使用Allen-Bradley 1768-EWEB模块在自定义网页之间进行通信

Xml 使用Allen-Bradley 1768-EWEB模块在自定义网页之间进行通信,xml,server,plc,Xml,Server,Plc,专家们 有人成功地建立了艾伦·布拉德利的1768-EWEB模块吗?。我的问题的范围是网页之间的通信,它将更新保存在EWEB模块内目录下的xml文件;然后由模块读取并传输回PLC 该手册非常具体,实现这一点的唯一方法是使用“网页表单和帖子处理程序” 手册中提供的代码示例如下: <html> <head> <title> Data View Javascript Demo Page </title>

专家们

有人成功地建立了艾伦·布拉德利的1768-EWEB模块吗?。我的问题的范围是网页之间的通信,它将更新保存在EWEB模块内目录下的xml文件;然后由模块读取并传输回PLC

该手册非常具体,实现这一点的唯一方法是使用“网页表单和帖子处理程序”

手册中提供的代码示例如下:

<html>
    <head>
      <title>
        Data View Javascript Demo Page
      </title>
      <script type="text/javascript">
    var xmlDoc;
    var xmlhttp;
    var DATAVIEW_URI = "/user/system/dataviews/Sample.xml";
    var DATAVIEW_NAMESPACE = "http://www.rockwellautomation.com/technologies/data_access/data_views/1.0/";
    var DATATYPES_NAMESPACE = "http://www.rockwellautomation.com/technologies/data_access/data_types/1.0/";
    var ARR_ACTIVEX = ["MSXML4.DOMDocument", "MSXML3.DOMDocument", "MSXML2.DOMDocument", "MSXML.DOMDocument",
    "Microsoft.XmlDom"];
    var STR_ACTIVEX = "";
    var isIE = navigator.userAgent.toLowerCase().indexOf("msie") > -1;
    if (isIE) {
    var bFound = false;
    for (var i=0; i < ARR_ACTIVEX.length && !bFound; i++) {
    try {
    var objXML = new ActiveXObject(ARR_ACTIVEX[i]);
    STR_ACTIVEX = ARR_ACTIVEX[i];
    bFound = true
    } catch (objException) {}
    }
    if (!bFound) {
    /* No DOM found, so throw a message and go back */
    alert("Creating/editing a data view requires Internet Explorer 5.5 or greater with XML support. Please
    upgrade your browser or load the appropriate patches to support XML.");
    history.go(-1);
    }
    } else {
    /* Not IE, so throw a message and go back */
    alert("Creating/editing a data view requires Internet Explorer 5.5 or greater with XML support. Please
    upgrade your browser or load the appropriate patches to support XML.");
    history.go(-1);
    }
    xmlDoc = new ActiveXObject(STR_ACTIVEX)
    xmlDoc.async = false;
    xmlDoc.setProperty("SelectionLanguage", "XPath");
    if (STR_ACTIVEX.indexOf(".DOMDocument") != -1) {
    xmlhttp = new ActiveXObject(STR_ACTIVEX.substring(0, STR_ACTIVEX.indexOf(".DOMDocument")) +
    ".XMLHTTP");
    } else {
    alert("Creating/editing a data view requires Internet Explorer 5.5 or greater with XML support. Please
    upgrade your browser or load the appropriate patches to support XML.");
    history.go(-1);
    }
    function refresh_value() {
    xmlDoc.load(DATAVIEW_URI);
    xmlDoc.setProperty("SelectionNamespaces", "xmlns:dv='" + DATAVIEW_NAMESPACE + "'");
    document.getElementById("tagvalue").value =
    xmlDoc.selectSingleNode("/dv:view/dv:tag[@name='TEST']/dv:value").childNodes[0].nodeValue;
    }
    function update_value() {
    xmlDoc.selectSingleNode("/dv:view/dv:tag[@name='TEST']/dv:value").childNodes[0].nodeValue =
    document.getElementById("tagvalue").value;
    xmlhttp.Open("POST", DATAVIEW_URI, false);
    xmlhttp.Send(xmlDoc);
    refresh_value();
    }
    </script>
    </head>
    <body onLoad="refresh_value();">
    TEST value is <input type="text" name="tagvalue" id="tagvalue" /><br/>
    <input type="button" onClick="refresh_value();" value="Refresh"/><input type="button"
    onClick="update_value();" value="Update"/>
    </body>
    </html>

数据视图Javascript演示页面
var-xmlDoc;
var-xmlhttp;
var DATAVIEW_URI=“/user/system/dataviews/Sample.xml”;
var DATAVIEW_名称空间=”http://www.rockwellautomation.com/technologies/data_access/data_views/1.0/";
var数据类型_名称空间=”http://www.rockwellautomation.com/technologies/data_access/data_types/1.0/";
var ARR_ACTIVEX=[“MSXML4.DOMDocument”、“MSXML3.DOMDocument”、“MSXML2.DOMDocument”、“MSXML.DOMDocument”,
“Microsoft.XmlDom”];
var STR_ACTIVEX=“”;
var isIE=navigator.userAgent.toLowerCase().indexOf(“msie”)>-1;
如果(isIE){
var bFound=假;
对于(var i=0;i
当我测试上面的代码(在IE10上)时,它不起作用。字段表单为空。根据手册,它应该显示125。(在向导中创建xml等步骤已经完成)

有人有机会使用此web模块吗?此设备是从2004年到2006年,它只处理.asp作为服务器端语言


提前谢谢。

在将原始代码复制到test.html文件并在IE10中打开后,正如您所说,它不起作用。我发现脚本中有换行符导致脚本无效,尤其是
警报(“”
)中的字符串文本。我过去发现,从手册、PDF和帮助文件中复制可能会包含不需要的字符,因此请使用好的代码编辑器仔细检查这些字符。它还有助于设置缩进,以便您可以轻松地看到代码中发生了什么

<html>
<head>
    <title>
        Data View Javascript Demo Page
    </title>
    <script type="text/javascript">
    var xmlDoc;
    var xmlhttp;
    var DATAVIEW_URI = "/user/system/dataviews/Sample.xml";
    var DATAVIEW_NAMESPACE = "http://www.rockwellautomation.com/technologies/data_access/data_views/1.0/";
    var DATATYPES_NAMESPACE = "http://www.rockwellautomation.com/technologies/data_access/data_types/1.0/";
    var ARR_ACTIVEX = ["MSXML4.DOMDocument", "MSXML3.DOMDocument", "MSXML2.DOMDocument", "MSXML.DOMDocument", "Microsoft.XmlDom"];
    var STR_ACTIVEX = "";
    var isIE = navigator.userAgent.toLowerCase().indexOf("msie") > -1;
    if (isIE) {
        var bFound = false;
        for (var i=0; i < ARR_ACTIVEX.length && !bFound; i++) {
            try {
                var objXML = new ActiveXObject(ARR_ACTIVEX[i]);
                STR_ACTIVEX = ARR_ACTIVEX[i];
                bFound = true
            } catch (objException) {}
        }
        if (!bFound) {
            /* No DOM found, so throw a message and go back */
            alert("Creating/editing a data view requires Internet Explorer 5.5 or greater with XML support. Please upgrade your browser or load the appropriate patches to support XML.");
            history.go(-1);
        }
    } else {
        /* Not IE, so throw a message and go back */
        alert("Creating/editing a data view requires Internet Explorer 5.5 or greater with XML support. Please upgrade your browser or load the appropriate patches to support XML.");
        history.go(-1);
    }
    xmlDoc = new ActiveXObject(STR_ACTIVEX)
    xmlDoc.async = false;
    xmlDoc.setProperty("SelectionLanguage", "XPath");
    if (STR_ACTIVEX.indexOf(".DOMDocument") != -1) {
        xmlhttp = new ActiveXObject(STR_ACTIVEX.substring(0, STR_ACTIVEX.indexOf(".DOMDocument")) + ".XMLHTTP");
    } else {
        alert("Creating/editing a data view requires Internet Explorer 5.5 or greater with XML support. Please upgrade your browser or load the appropriate patches to support XML.");
        history.go(-1);
    }
    function refresh_value() {
        xmlDoc.load(DATAVIEW_URI);
        xmlDoc.setProperty("SelectionNamespaces", "xmlns:dv='" + DATAVIEW_NAMESPACE + "'");
        document.getElementById("tagvalue").value =
        xmlDoc.selectSingleNode("/dv:view/dv:tag[@name='TEST']/dv:value").childNodes[0].nodeValue;
    }
    function update_value() {
        xmlDoc.selectSingleNode("/dv:view/dv:tag[@name='TEST']/dv:value").childNodes[0].nodeValue =
        document.getElementById("tagvalue").value;
        xmlhttp.Open("POST", DATAVIEW_URI, false);
        xmlhttp.Send(xmlDoc);
        refresh_value();
    }
    </script>
</head>
<body onLoad="refresh_value();">
    TEST value is <input type="text" name="tagvalue" id="tagvalue" /><br/>
    <input type="button" onClick="refresh_value();" value="Refresh"/>
    <input type="button" onClick="update_value();" value="Update"/>
</body>
</html>

数据视图Javascript演示页面
var-xmlDoc;
var-xmlhttp;
var DATAVIEW_URI=“/user/system/dataviews/Sample.xml”;
var DATAVIEW_名称空间=”http://www.rockwellautomation.com/technologies/data_access/data_views/1.0/";
var数据类型_名称空间=”http://www.rockwellautomation.com/technologies/data_access/data_types/1.0/";
var ARR_ACTIVEX=[“MSXML4.DOMDocument”、“MSXML3.DOMDocument”、“MSXML2.DOMDocument”、“MSXML.DOMDocument”、“Microsoft.XmlDom”];
var STR_ACTIVEX=“”;
var isIE=navigator.userAgent.toLowerCase().indexOf(“msie”)>-1;
如果(isIE){
var bFound=假;
对于(var i=0;i