Web Service
- Eliot Muir
- Aryn Wiebe
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:
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!
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:
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.Parses HTTP request: The data is parsed into an HTTP request object using
net.http.parseRequest()
.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!
Â