28 February 2019

Call a Microsoft Dynamics 365 Business Central function through a Web Service : SOAPAction

Today I did some work with a Logic Apps and one of the requirement was to call a Business Central function through a Web Service. 

I normally use Postman to simulate requests, export the collection and use that to create the Logic App connector. 

Codeunit which I published as a web service had few functions exposed. I wanted to call one of those functions with values passing in and read the return value. 

If I just call (POST) Web Service with the SOAP Envelope (Like below image) it will just return the WDSL. Not the result I was expecting. 

Header :

SOAP Request and Response:

However, SOAP UI return the value I was expecting it to return. 

How that can be possible?  We looked into the "HTTP log" of the SOAP UI, and we saw SOAPAction is defined and its pointing to the function I want to call. 


I did the same thing in Postman and it worked. Below is my request header and you can notice that I add "SOAPAction" to the header. 
If you didn't define the "SOAPAction" in the request header, the result will bring back the WDSL regardless of your SOAP Envelope. 
I use the postman request to create my HTTP request in Logic App. There is a much easy way of doing this in Logic App with the help of custom connector. I will share those details in another day from a new blog post. 

** Thank you Stephen Gichure for helping me to prepare this blog post.

Please provide your feedback with a comment. 
Thank you and Regards,
Tharanga Chandrasekara

No comments:

Post a Comment