Update Guía para generar y consumir el WSDL del servicio
parent
e2287a7635
commit
a3e2e1cba3
1 changed files with 1 additions and 110 deletions
|
@ -113,9 +113,7 @@ Existen múltiples formas de consumir un servicio SOAP, dependiendo de la plataf
|
||||||
</s:Envelope>
|
</s:Envelope>
|
||||||
```
|
```
|
||||||
|
|
||||||
## Consumo del servicio desde diferentes lenguajes
|
## Consumo del servicio desde diferente C#
|
||||||
|
|
||||||
### C#
|
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
// Agregar referencia al servicio:
|
// Agregar referencia al servicio:
|
||||||
|
@ -165,113 +163,6 @@ class Program
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Java
|
|
||||||
|
|
||||||
```java
|
|
||||||
// Usar JAX-WS o wsimport para generar clases cliente
|
|
||||||
// wsimport -keep -p uy.gub.dnic https://dnic.mz.uy/WsServicioDeInformacion.asmx?wsdl
|
|
||||||
|
|
||||||
import uy.gub.dnic.*;
|
|
||||||
|
|
||||||
public class Main {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
try {
|
|
||||||
// Crear el servicio y el puerto
|
|
||||||
WsServicioDeInformacion service = new WsServicioDeInformacion();
|
|
||||||
IWsServicioDeInformacion port = service.getBasicHttpBindingIWsServicioDeInformacion();
|
|
||||||
|
|
||||||
// Crear parámetros
|
|
||||||
ParamObtDocDigitalizado param = new ParamObtDocDigitalizado();
|
|
||||||
param.setNroDocumento("49746161");
|
|
||||||
param.setTipoDocumento("DO");
|
|
||||||
param.setNroSerie("ABC123456");
|
|
||||||
param.setOrganismo("ServiPuntos");
|
|
||||||
param.setClaveAcceso1("Clave123");
|
|
||||||
|
|
||||||
// Llamar al servicio
|
|
||||||
ResultObtDocDigitalizado result = port.obtDocDigitalizado(param);
|
|
||||||
|
|
||||||
// Procesar resultado
|
|
||||||
if (result.getErrores() != null && !result.getErrores().getMensaje().isEmpty()) {
|
|
||||||
System.out.println("Error: " + result.getErrores().getMensaje().get(0).getDescripcion());
|
|
||||||
} else {
|
|
||||||
System.out.println("Nombre: " + result.getPersona().getNombre1() + " " +
|
|
||||||
result.getPersona().getPrimerApellido());
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Python (con zeep)
|
|
||||||
|
|
||||||
```python
|
|
||||||
from zeep import Client
|
|
||||||
|
|
||||||
# Crear cliente SOAP
|
|
||||||
client = Client('https://dnic.mz.uy/WsServicioDeInformacion.asmx?wsdl')
|
|
||||||
|
|
||||||
# Preparar parámetros
|
|
||||||
param = {
|
|
||||||
'NroDocumento': '49746161',
|
|
||||||
'TipoDocumento': 'DO',
|
|
||||||
'NroSerie': 'ABC123456',
|
|
||||||
'Organismo': 'ServiPuntos',
|
|
||||||
'ClaveAcceso1': 'Clave123'
|
|
||||||
}
|
|
||||||
|
|
||||||
# Llamar al servicio
|
|
||||||
result = client.service.ObtDocDigitalizado(param)
|
|
||||||
|
|
||||||
# Procesar resultado
|
|
||||||
if hasattr(result, 'Errores') and result.Errores:
|
|
||||||
print(f"Error: {result.Errores[0].Descripcion}")
|
|
||||||
else:
|
|
||||||
print(f"Nombre: {result.Persona.Nombre1} {result.Persona.PrimerApellido}")
|
|
||||||
```
|
|
||||||
|
|
||||||
### JavaScript/TypeScript (con node-soap)
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
const soap = require('soap');
|
|
||||||
const url = 'https://dnic.mz.uy/WsServicioDeInformacion.asmx?wsdl';
|
|
||||||
|
|
||||||
// Crear cliente SOAP
|
|
||||||
soap.createClient(url, function(err, client) {
|
|
||||||
if (err) {
|
|
||||||
console.error(err);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Preparar parámetros
|
|
||||||
const param = {
|
|
||||||
NroDocumento: '49746161',
|
|
||||||
TipoDocumento: 'DO',
|
|
||||||
NroSerie: 'ABC123456',
|
|
||||||
Organismo: 'ServiPuntos',
|
|
||||||
ClaveAcceso1: 'Clave123'
|
|
||||||
};
|
|
||||||
|
|
||||||
// Llamar al servicio
|
|
||||||
client.ObtDocDigitalizado({ param }, function(err, result) {
|
|
||||||
if (err) {
|
|
||||||
console.error(err);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const response = result.ObtDocDigitalizadoResult;
|
|
||||||
|
|
||||||
// Procesar resultado
|
|
||||||
if (response.Errores) {
|
|
||||||
console.log(`Error: ${response.Errores.Mensaje.Descripcion}`);
|
|
||||||
} else {
|
|
||||||
console.log(`Nombre: ${response.Persona.Nombre1} ${response.Persona.PrimerApellido}`);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
## Manipular el CI para obtener diferentes resultados
|
## Manipular el CI para obtener diferentes resultados
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue