Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Starting from 10.1.86 we introduced a new API called net.http.listen which makes it much simpler to port over web services code implemented in Iguana 6. To try it out do the followingThe 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:

Expand
titleSTEP 1 - Make sure you GIT cache : Import the Web Service component
Screen Shot 2024-09-23 at 3.55.54 PM.pngImage Added
Info

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

Add Components

screen.

Close the screen.

Wait a few minutes and then you should be able to see everything again.

Expand
titleSTEP 2 - Import the Web Service component
Image Removed

Expand
titleSTEP 3 - : Run the component

You should see something like this:

Image Removed

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.pngImage Added
Expand
titleSTEP 4 - 3: Click on the URL Link http://localhost:7777/ and use the interface
  • 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.

Expand
titleSTEP 5 - Play with the interface
  • You’ll see something like this:

Expand
titleSTEP 6 - Look 4: Now open up the Translator to look at the source code

You Your Translator should see look something like this:

Screen Shot 2024-09-23 at 3.59.59 PM.pngImage Added
  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:

Image Removed
  1. The data is parsed into an HTTP request object using net.http.parseRequest().

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

...

Expand
titleSTEP 7 - 5: Import some sample data
Image Removed

The you 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:

Image Removed

Expand
titleSTEP 8 - Click around, alter the code, stop and start it.

It will probably be easier for you to develop the webservice if you are in Development mode. See:

Using the DEVELOPMENT Commit

Screen Shot 2024-09-23 at 4.03.38 PM.pngImage Added

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