WSDL to SOAP Envelope

WSDL to SOAP Envelope

本文关键字:Envelope SOAP to WSDL      更新时间:2023-09-26

我有一个WSDL web服务http://portal.strongtech.com/i/services/ivos?wsdl,我想使用AJAX向函数发送请求。我知道如何使用AJAX或JQuery发送请求,虽然我不确定如何为我想要请求的功能编写SOAP信封。

你能帮我写SOAP信封从给定的服务URL登录功能?非常感谢。

检查call- SOAP - xml -web-services-with- jQuery -ajax和jQuery Plugin SOAP

下面是一个来自http://www.icloud.com/wiki/index.php/Getting_started_-_jquery_ajax_guide

的例子
<html>
  <head>
    <script type="text/javascript" src="http://os.icloud.com/live/jqueryloader.js"></script>
    <script type="text/javascript">
      function printResult(doc, status, xhr) {
        var p = document.getElementById("output");
        if( status == "error" ) {
          p.innerHTML = doc.responseText.replace(/</g, "&lt;");
          login("/", "/"); // reset username
        } else {
          p.innerHTML = xhr.responseText.replace(/</g, "&lt;");
        }
      }
      function createSoapEnvelope(contents) {
        return '<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" ' +
          'SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">' +
          '<SOAP-ENV:Body>' + contents + '</SOAP-ENV:Body></SOAP-ENV:Envelope>';
      }
      function login(username, password, callback, errback) {
        icloud.ajax({
         type: "POST",
         async: true,
         cache: false,
         contentType: "text/xml; charset=utf-8",
         dataType: "xml",
         processData: false,
         url: "http://os.icloud.com/v1/",
         username: username,
         password: password,
         data: createSoapEnvelope("<login/>"),
         beforeSend: function(xhr) {
           xhr.setRequestHeader("SOAPAction", "login");
         },
         success: callback,
         error: errback
        });
      }
      function buttonClicked() {
        login(document.getElementById("username").value, document.getElementById("password").value, printResult, printResult);
      }
      initIcloudAPI();
    </script>
  </head>
  <body>
    <h2>Login example</h2>
    username:<input type="text" name="username" id="username"/>
    password:<input type="password" name="password" id="password"/>
    <input type="submit" name="login" value="Login" onclick="buttonClicked()"/>
    <p id="output"/>
  </body>
</html>