Web Service

The built-in Web Service component provides a simple framework for creating a web service endpoint in Iguana to receive and handle HTTP requests.

Follow the steps below to import and try it out in your Iguana:

Screen Shot 2024-09-23 at 3.55.54 PM.png

If you cannot find the Web Service component, make sure your Git Cache is up to date. Use the Refresh Cache link at the bottom of the screen. Wait a few minutes and then you should be able to see everything again.

You should see something like this:

Confirm you are in Development mode, it will be easier to edit and test your changes!

Screen Shot 2024-09-23 at 3.57.44 PM.png
  • Click on the URL Link http://localhost:7777/. If your Iguana instance is running remotely you might need to figure out what the public IP address is instead and use that.

  • You’ll see something like this:

Your Translator should look something like this:

  1. Listens for HTTP requests: If you are coming from Iguana v6, notice line 8. In IguanaX, we introduced a new API called net.http.listen{} which makes it much simpler to port over web services code implemented in Iguana v6.

  2. Parses HTTP request: The data is parsed into an HTTP request object using net.http.parseRequest().

  3. Builds and sends an HTML response: Constructs an HTML response header and body to send back to the client.

Try adding your own sample data. You can add different types of sample HTTP requests from the Iguana logs. You should see a screen like this:

This way you can test how your web service handles different types of requests!

 

Related pages