js 调用webservice 问题

如何用js 调用 webservice 我现在做的是 j2ee项目
谁能给提供一个例子,调用webservice 能否提供一个 通用的 js 跟各个js框架无关的
谢谢!!!!!

[b]问题补充:[/b]

是 能否给写个简单的 例子 谢谢

[b]问题补充:[/b]

我的webservice 文件
<?xml version="1.0" encoding="UTF-8"?>

<service>
    <name>SimpleWs</name>
     <namespace>wsclient.server.ws.mjp.com</namespace>
    <serviceClass>com.mjp.ws.server.ISimpleWs</serviceClass>
    <implementationClass>com.mjp.ws.server.SimpleWsImpl</implementationClass>
    <style>wrapped</style>
    <use>literal</use>
    <scope>application</scope>
</service></beans>

ws 方法:
public String example(String message);

js 调用 soap 数据
<?xml version="1.0" encoding="utf-8"?>soap:Body{aa:123}/soap:Body/soap:Envelope
然后返回 500 错误
soap:Bodysoap:Faultsoap:ClientInvalid operation: {wsclient.server.ws.mjp.com}sample/soap:Fault/soap:Body/soap:Envelope
是啥原因? 谢谢
[b]问题补充:[/b]
我java 客户程序调用没有问题
主要是 看的 js ajax调用 是不是有问题?
<?xml version="1.0" encoding="UTF-8" ?>

[code="java"]
var WSDLS = {};

var WebService = new Class({

url : '',
method : '',
options: 
{
    method:'GET',
    data: null,
    update: null,
    onComplete: Class.empty,
    onError:Class.empty,
    evalScripts: false,
    evalResponse: false
},

initialize: function(url,method,options)
{
    this.url = url;
    this.method = method;
    this.options = options;

},

request : function()
{
    var wsdl = WSDLS[this.url];
    if(!wsdl) 
    {
        var op = {method:'GET',async: false};
        var wsdlAjax = new XHR(op).send(this.url + "?wsdl", null);          
        wsdl = wsdlAjax.transport.responseXML;
        WSDLS[this.url] = wsdl;
    }
    this.setSoap(wsdl);
},

setSoap : function(wsdl)
{

    var ns = (wsdl.documentElement.attributes["targetNamespace"] + "" == "undefined") ? wsdl.documentElement.attributes.getNamedItem("targetNamespace").nodeValue : wsdl.documentElement.attributes["targetNamespace"].value;
    var sr = 
            "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
            "<soap:Envelope " +
            "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " +
            "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " +
            "xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
            "<soap:Body>" +
            "<" + this.method + " xmlns=\"" + ns + "\">" +
                 (this.options.data === null ?"":this.options.data) +
            "</" + this.method + "></soap:Body></soap:Envelope>";

    this.options.method = 'post';
    this.options.data = null;

    var soapaction = ((ns.lastIndexOf("/") != ns.length - 1) ? ns + "/" : ns) + this.method;

    var soapAjax = new Ajax(this.url,this.options);
    soapAjax.setHeader("SOAPAction", soapaction);
    soapAjax.setHeader("Content-type", "text/xml; charset=utf-8");
    soapAjax.request(sr);
}

});
[/code]
[code="java"]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">


JavaScript SOAP Client - DEMOS | GURU4.net


<script type="text/javascript">

function ajaxRequest()
{
    var url = "http://127.0.0.1:8080/wstest/services/test";

    //设置webService传入参数
    //    调用java(xfire) 发布的webService
    //           传入的参数必须与调用方法的参数数量相等,且按传入值的顺序进行匹配
    //

    var para = "<t>bbbbbb</t><tt>aaaaaaaaaaa</tt>";

    var op = {
                data:para,
                onComplete: showResponse,
                onFailure:showError,
                update:'ajaxBack'
             };

    var service = new WebService(url,"test",op);
    service.request();
    return false;
}
function showError(obj)
{
    //obj 是一个xmlHttpRequest对象
    alert("error");
}
function showResponse(requestText,requestXML)
{
    //requestText 返回的文本
    //requestXML 返回的XML
    alert("ok");
}
</script>






[/code]

ws发送的是soap 只要你能够通过http协议发送soap任何语言都可以 和框架首先肯定无关 框架主要是为了编码简单

500 错误一般都是ws服务端的 你先写个java程序调用试试 如果成功了再用js测试

看看这个吧 我一直都是用这个的