Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <title>
- </title>
- <head>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.2/d3.min.js"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.6.0/underscore-min.js"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.js"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/accounting.js/0.4.1/accounting.min.js"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/datejs/1.0/date.min.js"></script>
- <script>
- var apptoken = "mytoken";
- $.ajaxSetup({data: {apptoken: apptoken}});
- function soapRequest(){
- var str =
- '<?xml version="1.0" encoding="utf-8"?>' +
- '<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:tem="http://tempuri.org/">' +
- '<soap:Header/>' +
- '<soap:Body>' +
- '<tem:BaixarVendas>' +
- '<tem:Token>RFRTMzlfVElNX0lOT1ZBSU5GTw==</tem:Token>' +
- '<tem:DataInicial>2016-05-23</tem:DataInicial>' +
- '<tem:DataFinal>2016-05-23</tem:DataFinal>' +
- '</tem:BaixarVendas>' +
- '</soap:Body>' +
- '</soap:Envelope>';
- function createCORSRequest(method, url) {
- var xhr = new XMLHttpRequest();
- if ("withCredentials" in xhr) {
- xhr.open(method, url, false);
- } else if (typeof XDomainRequest != "undefined") {
- alert("indefinido");
- xhr = new XDomainRequest();
- xhr.open(method, url);
- } else {
- console.log("CORS not supported");
- alert("CORS not supported");
- xhr = null;
- } return xhr;
- }
- var xhr = createCORSRequest("POST", "https://wsintegracaoclientes.datasys.online/Clientes/ConsultasDatasys.asmx?WSDL");
- if(!xhr){
- console.log("XHR issue");
- return;
- }
- xhr.onload = function (){
- var results = xhr.responseText;
- console.log(results);
- };
- xhr.setRequestHeader('Content-Type', 'text/xml');
- xhr.send(str);
- }
- </script>
- </head>
- <body>
- <input type = "button" value = "SOAP Request" onclick = "soapRequest();" />
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment