在纯javascript环境中实现soap

在纯javascript环境中实现soap,javascript,angularjs,soap,ember.js,Javascript,Angularjs,Soap,Ember.js,我正在尝试使用soap作为后端服务,并为我的应用程序提供数据 我的问题是,我们是否只使用javascript框架(ex:Ember,Angular),而不使用服务器端语言(ex:php) 这有可能实现吗 非常感谢 如果不使用任何服务器端语言,就无法使用javascript框架创建SOAP服务。只能从java脚本访问SOAP WSDL。 下面是一个例子: <script type="text/javascript"> function soap() { var

我正在尝试使用soap作为后端服务,并为我的应用程序提供数据

我的问题是,我们是否只使用javascript框架(ex:Ember,Angular),而不使用服务器端语言(ex:php)

这有可能实现吗


非常感谢

如果不使用任何服务器端语言,就无法使用javascript框架创建SOAP服务。只能从java脚本访问SOAP WSDL。 下面是一个例子:

<script type="text/javascript">
    function soap() {
        var xmlhttp = new XMLHttpRequest();
        xmlhttp.open('POST', 'https://testSoapURL.com/', true);

        // build SOAP request
        var service =
            '<?xml version="1.0" encoding="utf-8"?>' +
            '<soapenv:Envelope ' + 
                'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' +
                'xmlns:api="http://127.0.0.1/Integrics/Enswitch/API" ' +
                'xmlns:xsd="http://www.w3.org/2001/XMLSchema" ' +
                'xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">' +
                '<soapenv:Body>' +
                '<api:some_api_callsoapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">' +
                        '<username xsi:type="xsd:string">login_uName</username>' +
                        '<password xsi:type="xsd:string">pass</password>' +
                    '</api:some_api_call>' +
                '</soapenv:Body>' +
            '</soapenv:Envelope>';

        xmlhttp.onreadystatechange = function () {
            if (xmlhttp.readyState == 4) {
                if (xmlhttp.status == 200) {

                    alert('done check the response');
                }
            }
        }
        // Send the POST request
        xmlhttp.setRequestHeader('Content-Type', 'text/xml');
        xmlhttp.send(service);
        //Now send the request        
    }
</script>

函数soap(){
var xmlhttp=new XMLHttpRequest();
xmlhttp.open('POST','https://testSoapURL.com/",对),;
//生成SOAP请求
var服务=
'' +
'' +
'' +
'' +
“登录\u uName”+
“通过”+
'' +
'' +
'';
xmlhttp.onreadystatechange=函数(){
if(xmlhttp.readyState==4){
if(xmlhttp.status==200){
警报(“完成检查响应”);
}
}
}
//发送POST请求
setRequestHeader('Content-Type','text/xml');
发送(服务);
//现在发送请求
}

是的,我以前做过webDAV。您只需要建立一些ajax响应模板,并磨练XML dom技能。