SORU
23 EYLÜL 2008, Salı


En basit örnek SABUN

SABUN en basit örnek Javascript kullanarak nedir?

Mümkün olduğunca faydalı olmak için, cevap:

  • Fonksiyonel (diğer bir deyişle aslında iş)
  • Başka bir yerde kod olarak ayarlanabilir en az bir parametre göndermek
  • En az bir başka kod okunabilir sonuç değeri işlem
  • Çoğu modern tarayıcı sürümleri ile çalışır
  • Harici bir kütüphane kullanılmadan gibi net ve mümkün olduğunca kısa olması

CEVAP
9 Temmuz 2012, PAZARTESİ


Bu yaratabilirim basit JavaScript, SOAP İstemcisi.

<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 response');
                    }
                }
            }
            // 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>

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Ampisound

    Ampisound

    12 Kasım 2006
  • MW Technology

    MW Technolog

    28 EKİM 2009
  • Vortez

    Vortez

    27 Temmuz 2009