Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I think <a href="https://stackoverflow.com/questions/124269/simplest-soap-example-using-javascript">this Post</a> can help you. But most of web servers allows you to invoke webservices using plain HTTP Post (without SOAP format in the body request) if the request doesn't need SOAP headers or other weird things.</p> <p>An example in .NET and plain javaScript:</p> <p>.NET web service</p> <pre><code>&lt;System.Web.Services.WebService(Namespace:="http://JuntaEx/Agricultura/SegurInfo/GestorFirmaExterno/")&gt; _ &lt;System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)&gt; _ &lt;ToolboxItem(False)&gt; _ Public Class GestorFirmaExterno Inherits System.Web.Services.WebService &lt;WebMethod(Description:="Retorna los documentos originales asociados a un identificador de firma pasado como parámetro.")&gt; _ Public Function ObtenerDocumentoOriginal(ByVal idFirma As String) As DocumentoED() //code End Function End Class </code></pre> <p>web.config:</p> <pre><code> &lt;webServices&gt; &lt;protocols&gt; &lt;add name="HttpSoap"/&gt; &lt;add name="HttpPost"/&gt; &lt;!-- Allows plain HTTP Post --&gt; &lt;add name="HttpSoap12"/&gt; &lt;!-- Documentation enables the documentation/test pages --&gt; &lt;add name="Documentation"/&gt; &lt;/protocols&gt; &lt;/webServices&gt; </code></pre> <p>JavaScript request:</p> <pre><code>function crearRequest(url) { if (window.XMLHttpRequest) { peticion_http = new XMLHttpRequest(); } else if (window.ActiveXObject) { peticion_http = new ActiveXObject('Microsoft.XMLHTTP'); } peticion_http.open('POST', url, true); //sync peticion_http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); return peticion_http; } peticion_http = crearRequest('http://localhost/wspuenteFirma/serviciopuente.asmx/ObtenerDocumentoOriginal'); peticion_http.onreadystatechange = obtenerDocHandler; var query_string = 'IdFirma=' + encodeURIComponent(docId); peticion_http.setRequestHeader('Content-Length', query_string.length); peticion_http.send(query_string); </code></pre> <p>You send this request to the server:</p> <pre><code>POST /wsGestorFirmaExterno/GestorFirmaExterno.asmx/ObtenerDocumentoOriginal HTTP/1.1 Host: localhost Content-Type: application/x-www-form-urlencoded Content-Length: length idFirma=string </code></pre> <p>and recive this response from the server:</p> <pre><code>HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: length &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;ArrayOfDocumentoED xmlns="http://JuntaEx/Agricultura/SegurInfo/GestorFirmaExterno/"&gt; &lt;DocumentoED&gt; &lt;hash&gt;string&lt;/hash&gt; &lt;/DocumentoED&gt; &lt;DocumentoED&gt; &lt;hash&gt;string&lt;/hash&gt; &lt;/DocumentoED&gt; &lt;/ArrayOfDocumentoED&gt; </code></pre> <p>Parse it with javascript to obtain the info you need.</p> <p>PS: You can configure the server and the browser request to send and recive JSON data instead of XML.</p> <p>I hope it's helps.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload