Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

155
Vistas
How to correctly consume a rest service created with Genexus?

I have been trying to consume a simple web service crated with GeneXus, it should receive a "nPais" variable (integer) and respond an object with the text property based on the given number. It just doesn't work. I have confirm that the service work by testing it with soapUI (adding the WSDL), but when trying to consume it with postman it responds the correct structure, but with the text property empty.

This is my source tab from the WS.

&sdtServicio = New()
&Servicio.SetEmpty()
Do Case
    Case &nPais = 1
        &sdtServicio.Texto = "Hola México"
    Case &nPais = 2
        &sdtServicio.Texto = "Hola Argentina"
    Otherwise
        &sdtServicio.Texto = "HOLA MUNDO"
Endcase

This is on rules tab

Parm(in:&nPais, out:&sdtServicio);

And here is how I have been trying to consume the service on JS.

function getGreeting(value) {
    var myHeaders = new Headers();
    myHeaders.append("Content-Type", "application/json");
    myHeaders.append("Cookie", "GX_CLIENT_ID=54f383cc-0719-444d-a252-c8799c1202a0");

    var raw = JSON.stringify({
    "nPais": 1
    });

    var requestOptions = {
        method: 'POST',
        headers: myHeaders,
        body: raw,
        redirect: 'follow'
    };

    fetch("http://localhost:8080/PotentorDesaPotDesa/rest/WSHolaMundo", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));
}

This is the response I get.

{"sdtServicio":{"Texto":""}}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The trick was only to change the protocol from SOAP to internal on the properties of my object.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda