Update Guía para generar y consumir el WSDL del servicio
parent
8e8c21538f
commit
e2287a7635
1 changed files with 8 additions and 19 deletions
|
@ -8,19 +8,8 @@ WSDL (Web Services Description Language) es un formato XML que describe la funci
|
||||||
|
|
||||||
## Acceso al WSDL
|
## Acceso al WSDL
|
||||||
|
|
||||||
Una vez que el servicio está en ejecución, el WSDL está disponible en las siguientes URLs:
|
Una vez que el servicio está en ejecución, el WSDL está disponible en las siguiente URL:
|
||||||
|
|
||||||
- Para el endpoint con DataContractSerializer:
|
|
||||||
```
|
|
||||||
http://localhost:5050/WsServicioDeInformacion.svc?wsdl
|
|
||||||
```
|
|
||||||
|
|
||||||
- Para el endpoint con XmlSerializer:
|
|
||||||
```
|
|
||||||
http://localhost:5050/WsServicioDeInformacion.asmx?wsdl
|
|
||||||
```
|
|
||||||
|
|
||||||
En un entorno de producción, la URL sería similar a la siguiente:
|
|
||||||
```
|
```
|
||||||
https://dnic.mz.uy/WsServicioDeInformacion.asmx?wsdl
|
https://dnic.mz.uy/WsServicioDeInformacion.asmx?wsdl
|
||||||
```
|
```
|
||||||
|
@ -33,14 +22,14 @@ Existen múltiples formas de consumir un servicio SOAP, dependiendo de la plataf
|
||||||
|
|
||||||
1. Descarga e instala [SoapUI](https://www.soapui.org/)
|
1. Descarga e instala [SoapUI](https://www.soapui.org/)
|
||||||
2. Crea un nuevo proyecto SOAP
|
2. Crea un nuevo proyecto SOAP
|
||||||
3. En la URL del WSDL, introduce la URL del servicio (ej. `http://localhost:5050/WsServicioDeInformacion.asmx?wsdl`)
|
3. En la URL del WSDL, introduce la URL del servicio (ej. `https://dnic.mz.uy/WsServicioDeInformacion.asmx?wsdl`)
|
||||||
4. SoapUI generará automáticamente las solicitudes de ejemplo para cada operación
|
4. SoapUI generará automáticamente las solicitudes de ejemplo para cada operación
|
||||||
|
|
||||||
### Usando Postman
|
### Usando Postman
|
||||||
|
|
||||||
1. Abre Postman y crea una nueva solicitud
|
1. Abre Postman y crea una nueva solicitud
|
||||||
2. Establece el método a POST
|
2. Establece el método a POST
|
||||||
3. Introduce la URL del servicio (ej. `http://localhost:5050/WsServicioDeInformacion.asmx`)
|
3. Introduce la URL del servicio (ej. `https://dnic.mz.uy/WsServicioDeInformacion.asmx`)
|
||||||
4. En Headers, agrega `Content-Type: text/xml`
|
4. En Headers, agrega `Content-Type: text/xml`
|
||||||
5. En el cuerpo, coloca tu solicitud SOAP
|
5. En el cuerpo, coloca tu solicitud SOAP
|
||||||
|
|
||||||
|
@ -139,7 +128,7 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
// Generar cliente del servicio usando:
|
// Generar cliente del servicio usando:
|
||||||
// dotnet tool install --global dotnet-svcutil
|
// dotnet tool install --global dotnet-svcutil
|
||||||
// dotnet-svcutil http://localhost:5050/WsServicioDeInformacion.asmx?wsdl
|
// dotnet-svcutil https://dnic.mz.uy/WsServicioDeInformacion.asmx?wsdl
|
||||||
|
|
||||||
class Program
|
class Program
|
||||||
{
|
{
|
||||||
|
@ -147,7 +136,7 @@ class Program
|
||||||
{
|
{
|
||||||
// Crear el cliente
|
// Crear el cliente
|
||||||
var binding = new BasicHttpBinding();
|
var binding = new BasicHttpBinding();
|
||||||
var endpoint = new EndpointAddress("http://localhost:5050/WsServicioDeInformacion.asmx");
|
var endpoint = new EndpointAddress("https://dnic.mz.uy/WsServicioDeInformacion.asmx");
|
||||||
var client = new WsServicioDeInformacionClient(binding, endpoint);
|
var client = new WsServicioDeInformacionClient(binding, endpoint);
|
||||||
|
|
||||||
// Crear parámetros
|
// Crear parámetros
|
||||||
|
@ -180,7 +169,7 @@ class Program
|
||||||
|
|
||||||
```java
|
```java
|
||||||
// Usar JAX-WS o wsimport para generar clases cliente
|
// Usar JAX-WS o wsimport para generar clases cliente
|
||||||
// wsimport -keep -p uy.gub.dnic http://localhost:5050/WsServicioDeInformacion.asmx?wsdl
|
// wsimport -keep -p uy.gub.dnic https://dnic.mz.uy/WsServicioDeInformacion.asmx?wsdl
|
||||||
|
|
||||||
import uy.gub.dnic.*;
|
import uy.gub.dnic.*;
|
||||||
|
|
||||||
|
@ -222,7 +211,7 @@ public class Main {
|
||||||
from zeep import Client
|
from zeep import Client
|
||||||
|
|
||||||
# Crear cliente SOAP
|
# Crear cliente SOAP
|
||||||
client = Client('http://localhost:5050/WsServicioDeInformacion.asmx?wsdl')
|
client = Client('https://dnic.mz.uy/WsServicioDeInformacion.asmx?wsdl')
|
||||||
|
|
||||||
# Preparar parámetros
|
# Preparar parámetros
|
||||||
param = {
|
param = {
|
||||||
|
@ -247,7 +236,7 @@ else:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
const soap = require('soap');
|
const soap = require('soap');
|
||||||
const url = 'http://localhost:5050/WsServicioDeInformacion.asmx?wsdl';
|
const url = 'https://dnic.mz.uy/WsServicioDeInformacion.asmx?wsdl';
|
||||||
|
|
||||||
// Crear cliente SOAP
|
// Crear cliente SOAP
|
||||||
soap.createClient(url, function(err, client) {
|
soap.createClient(url, function(err, client) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue