0

如果我调用我的JAX-WSWeb 服务,我会在服务器端收到以下错误消息。

com.sun.xml.internal.ws.transport.http.server.WSHttpHandler handleExchange
WARNING: Cannot handle HTTP method: OPTIONS

我的html代码是:

<html>

    <head>
        <script language="javascript">
            function call() {
                var side = sideid.value;
                var side1 = sideid1.value;
                var req = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema/\" xmlns:web=\"http://core.example.com/\"><soapenv:Body><web:rectangle><length>" + side + "</length><breadth>" + side1 + "</breadth></web:rectangle></soapenv:Body></soapenv:Envelope>";
                //var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
                //var reqXML = xmlDoc.loadXML(req);
                var xmlDoc = document.implementation.createDocument("", "", null);
                xmlDoc.async = false;
                xmlDoc.onload = req;
                //var reqXML = xmlDoc.load(req);
                var xmlhttp;
                if (window.XMLHttpRequest) {
                    xmlhttp = new XMLHttpRequest();
                }
                xmlhttp.onreadystatechange = function () {
                    if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                        alert(xmlhttp.status);
                        var response = xmlhttp.responseXML;
                        // xmlhttp.overrideMimeType("text/xml; charset=ISO-8859-1");
                        //alert(response.selectSingleNode(".//return").text);
                        alert("======" + response);
                    }
                }
                var soapaction = "http://core.example.com/rectangle";
                xmlhttp.open("POST", "http://localhost:8090/area?wsdl", true);
                xmlhttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
                xmlhttp.setRequestHeader("SOAPAction", soapaction);
                xmlhttp.send(req);
            }
        </script>
    </head>

    <body>Side Length:
        <input type="text" id="sideid"></input>Length:
        <input type="text" id="sideid1"></input>
        <button onclick="call();">area of square</button>
    </body>

</html>

请给我关于如何从 Javascript 调用 Web 服务的意见,该服务应该在 Mozilla 浏览器上运行。

4

0 回答 0