icon-arrow icon-check icon-mail icon-phone icon-facebook icon-linkedin icon-youtube icon-twitter icon-cheveron icon-download icon-instagram play close
Werken bij Whitehorses
Blog 02/01/2019

NTLM authentication with SOAP in Mule 4

SOAP

While connecting with system API’s, one is often confronted with some nice exotic protocols. While some protocols are not considered cool anymore (SOAP for example), some authentication schemes just gives you a headache. This blog post shows how to do that.

Consultant
Laurens van der Starre /
Integratiespecialist

While connecting with system API’s, one is often confronted with some nice exotic protocols. While some protocols are not considered cool anymore (SOAP for example), some authentication schemes just gives you a headache.

So when consuming a SOAP webservice in Mule 4 that is secured with Microsoft’s NTLM you just have to consider the following:

  • The Web Service connector won’t work. There is no NTLM authentication in there. That makes sense by the way: in the SOAP world we have the WSSecurity standards for that.
  • The DOMAIN name should always be in capitals (I want hours of my life back).
Web Service Consumer Connector instellingen
Web Service Consumer configuration

Instead of using the Web Service Consumer, use the HTTP Request connector (POST method). You can setup the NTLM configuration in the HTTP Request configuration:

HTTP Request Connector configuration

In my experience the DOMAIN should always be in all caps. It won’t work otherwise.

However, using the HTTP Request means that you should manually create the SOAP request message as XML payload. This is a bit cumbersome, but not that hard using DataWeave 2:

%dw 2.0
output text/xml
ns soapenv http://schemas.xmlsoap.org/soap/envelope/
ns wh ns.whitehorses.nl
---
{
 soapenv#Envelope: { 
   soapenv#Body: {
      wh#MyBodyElement: {
       <<ETC>>       
      }
    }
 }
}

 

Also, don’t forget the set the SOAPAction header as Header in the HTTP Request connector! This is often required by SOAP web services. (Or, when using Mule 3, set a SOAPAction property).

Happy coding!

Overzicht blogs
Consultant
Laurens van der Starre /
Integratiespecialist

Wil je deel uitmaken van een groep gedreven en ambitieuze integratiespecialisten? Stuur ons jouw CV!