从Javascript调用jax ws web服务

从Javascript调用jax ws web服务,java,javascript,ajax,web-services,Java,Javascript,Ajax,Web Services,如果我调用我的JAX-WSWeb服务,我将在服务器端收到以下错误消息 com.sun.xml.internal.ws.transport.http.server.WSHttpHandler handleExchange WARNING: Cannot handle HTTP method: OPTIONS 我的html代码是: <html> <head> <script language="javascript">

如果我调用我的
JAX-WS
Web服务,我将在服务器端收到以下错误消息

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>

函数调用(){
var side=sideid.value;
var side1=sideid1.0值;
var req=“”+”+侧边+“+侧边1+”;
//var xmlDoc=新的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=新的XMLHttpRequest();
}
xmlhttp.onreadystatechange=函数(){
if(xmlhttp.readyState==4&&xmlhttp.status==200){
警报(xmlhttp.status);
var response=xmlhttp.responseXML;
//overrideMimeType(“text/xml;charset=ISO-8859-1”);
//警报(response.selectSingleNode(“.//return”).text);
警报(“=======”+响应);
}
}
var soapaction=”http://core.example.com/rectangle";
open(“POST”http://localhost:8090/area?wsdl“,对);
setRequestHeader(“内容类型”,“text/xml;charset=utf-8”);
setRequestHeader(“SOAPAction”,SOAPAction);
发送(req);
}
边长:
长度:
广场面积

请告诉我您对如何从Javascript调用Web服务的意见,该服务应在Mozilla浏览器上运行。

您确定问题的根源是此Javascript代码吗?是的……我想是的……因为我的Web服务工作正常……我已使用SOAPUI工具对其进行了测试……得到了响应……可能有什么问题?您能回答吗添加java代码?