I have this scenario in my service: When an XML payload is passed, the service will look for a specific tag if it's present in the payload, if present, it will do something with it. How do this in Gloop?
Depending what your XML looks like, or how are you sending or receiving the XML, you can do it in different ways. To give you an idea how, here's a sample service:
The screenshot above is a simple Gloop service that accepts a Gloop model and returns the same Gloop model passed to it. The input and output Gloop models were set to allow extra properties. Aside from the service returning the same model that was passed to it, it will also log in the Martini Console whether it contains the email field or not. Additionally, this service was exposed as an Ad-Hoc REST API.
When running the service, you can use Martini Desktop's HTTP Client to send request to this service via HTTP.
In the image above, An XML request body with tags that is already available in the sampleXml Gloop model from the service is going to be sent to the exposed endpoint. What's going to happen when this service is sent is that the service will return the same XML that will be sent to it, just like the image below.
Additionally, the Fork Step that has an expression of sampleXml.hasProperty('email') evaluates the XML payload the service received, and checks whether it contains an XML tag called email or not, and the logic in the service is to check sampleXml input if it has the email field. If it has the email field, log that the tag is there, if not, log that the tag isn't there. In the previous image, the service was given an XML that has no email field on it, so the expected output we should see in the console is:
If you give it an XML that has the email tag on it, it's going to log that the received XML has the email tag. Using the same approach used on this example, you can start working on your service logic.