Helping you drive digital innovation
Subscribe
RSS Feed of the Mendix Blog
Thanks for Subscribing

Keep an eye out for Mendix resources coming straight to your inbox.

Calling Web Services

on March 1, 2012

Share:

Web services are the preferred way of integrating a Mendix application with external systems. They can be used to retrieve data, send updates and perform operations. In Mendix, calling a web service is something you do in a microflow using the Call Web Service action. Version 3.2.1 introduced the new ‘Mapping’ option and there are now four ways to build the request body (or header) for a web service. With this tech tip we want to help you make the right choice.

A simple web service like the Celsius to Fahrenheit converter from w3schools takes the Celsius value as a string and returns the Fahrenheit value as a string. The ‘Simple’ choice is adequate in this case. It can handle any number of parameters as long as they are primitive.

Celsius to Farenheit

Building a simple request

If the web service has one or more complex parameters, ‘Simple’ does not cut it anymore. In that case, we recommend using the new ‘Mapping’ option. You build the whole request using a domain-to-XML mapping. The advantage of the ‘Mapping’ option is that it support the ‘choice’ construct of XSD at top-level of the request.

Request Mapping

Using a mapping to build the request

The ‘Advanced’ option, which pulls out the top-level elements as parameters, is still around for old times’ sake. This option does not support ‘choice’ but it is used a lot in existing projects. It may disappear in the future, but if it does we will automatically convert usages to the ‘Mapping’ option.

Finally, the ‘Custom’ option is there for cases where the web service does not adhere to standards or uses arcane constructs. Here you can build the the XML of the request by hand.

We have only talked about requests so far. For handling the response of a web service there are two options. If the result is simple, like in the temperature conversion case, you can immediately store the result in a variable. Otherwise, you map the response to Mendix objects using an XML-to-domain mapping.

Look forward to additional improvements in the web service department this year!

Subscribe to Our Blog

Receive Mendix platform tips, tricks, and other resources straight to your inbox every two weeks.

RSS Feed of the Mendix Blog
Arjan van IJzendoorn

About Arjan van IJzendoorn

Arjan is a member of the Mendix R&D department. He started developing the Mendix Modeler a long time ago and is still working on that application most of the time. Currently, he focuses on the modeling side of pages and widgets, with the occasional excursion into the rest of the Modeler.

| Community Profile

Comments are closed.