After reading this article you will know:
- How to create a Webservice that posts XML
XML can be used to transfer data between applications. To be able to send XML data from you Betty Blocks application, you'll need a Webservice. Go to Webservices through the Tool menu in the Builder Bar.
Setting up the Webservice
Create a new Webservice for your XML. Instead of selecting the JSON option at the Request Content-Type, keep it on Other. For the Response Content-Type, select the XML or Other option, both work in most cases.
These settings are required when setting one up:
- Name: The name of the Webservice
- Protocol: Is the receiving end using HTTP or HTTPS?
- Host: The domain that the Webservice will use in the request
Your Webservice should look something like the following:
Setting up the endpoint
Create a new Endpoint for your Webservice. Change the Http method to a POST method and fill in a name and path. At the bottom of the form, you’ll find a dropdown for Template. Select New to create your own XML template. Rename it to your liking and create the XML body. It should look something like the following:
Add an endpoint to the Webservice. (Top right subview). Insert at least:
- Name: The name of the endpoint.
- Http method: What kind of request is used in the Webservice.
- Path: The path of the Webservice. (example.com/path).
- Template: Select
Newfor an empty template, or select an existing SOAP template.
Setting up the XML body
The XML will be placed in the template of the endpoint. Give a small description, place the XML and hit save. Learn about creating variable XML data here.
Testing the Webservice
After you have successfully created your Webservide Endpoint, you can test it by clicking the Run Test button in the top right corner of your Webservice Endpoint. This should look something like the following: