想要致电Soap Web服务 [英] Want to call soap web service

查看:58
本文介绍了想要致电Soap Web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我想调用基于soap的Web服务,我有一种简单的方法从该URL调用Web服务..
http://stackoverflow.com/questions/124269/simplest-soap-example-using-javascript [^ ]

但是我不知道在何处添加方法名称,以便它从服务中调用该方法,在Web服务中,有一些我想调用但无法调用的方法

你能帮我吗?


Hi i want to call soap based web service i got simple way to call web service from this url..
http://stackoverflow.com/questions/124269/simplest-soap-example-using-javascript[^]

But i don''t understand where to add method name so that it call that method from service, in web service there are some method which i want to call but unable to call

can you please help me..


<html>
<head>
    <title>SOAP JavaScript Client Test</title>
    <script type="text/javascript">
        function soap() {
            var xmlhttp = new XMLHttpRequest();
            xmlhttp.open('POST', 'https://somesoapurl.com/', true);

            // build SOAP request
            var sr =
                '<?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_call soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">' +
                            '<username xsi:type="xsd:string">login_username</username>' +
                            '<password xsi:type="xsd:string">password</password>' +
                        '</api:some_api_call>' +
                    '</soapenv:Body>' +
                '</soapenv:Envelope>';

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

                        alert('done use firebug to see responce');
                    }
                }
            }
            // Send the POST request
            xmlhttp.setRequestHeader('Content-Type', 'text/xml');
            xmlhttp.send(sr);
            // send request
            // ...
        }
    </script>
</head>
<body>
    <form name="Demo" action="" method="post">
        <div>
            <input type="button" value="Soap" onclick="soap();" />
        </div>
    </form>
</body>
<html>

推荐答案

有特定于浏览器的代码,请访问,它可以处理几乎所有浏览器:

http://code.google.com/p/xmlhttprequest/ [ http://code.google.com/p/xmlhttprequest/downloads/detail?name = XMLHttpRequest.1.0.4.zip [ ^ ]
There are browser specific codes, please visit, it handles almost all browsers:

http://code.google.com/p/xmlhttprequest/[^]

http://code.google.com/p/xmlhttprequest/downloads/detail?name=XMLHttpRequest.1.0.4.zip[^]


这篇关于想要致电Soap Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆