Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

153
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!