How to consume webservice (WSDL) mails with javascript

2

I would like to use this web-service provided by mail for a small personal project (beginning, only the return address by the CEP): link

Is it possible to consume it via javascript (pure or jquery)?

The only time I used web-services was on a platform that practically set everything up automatically. Taking advantage of the question: What is the difference between WS extensions? I noticed that some are WSDL and some something like asmx.

    
asked by anonymous 15.11.2017 / 20:20

2 answers

2

You have many options, with JSON (more practical and easy) would look like this (using JQuery), in my example I'm using VIACEP, it works well too :)

$.getJSON('https://viacep.com.br/ws/11441080/json/', function(data) {         
    //informações do endereço (objeto data)
});

Full Html:

<html>
 <head>
    <title>JqueryCEP</title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script><scripttype="text/javascript">
       $.getJSON('https://viacep.com.br/ws/11441080/json/', function(data) {
       var bairro = data.bairro;
       alert(bairro); 
});

    </script>
</head>
<body>
    <h3>
        JqueryCEP :)
    </h3>
</body>
</html>

    
16.11.2017 / 11:30
0

I believe the official documentation will answer your questions. It's only 32 pages; and you will be asked to download and read in PDF. It has everything you need to set up your system. Best of all, it's official: directly from the Post Office.

Link:

04.09.2018 / 21:19