Dynamic Web Service Call
Dear SAP MII Colleagues,
What comes to our mind when we talk about building an application? Optimization, performance, modularity and what not? I was no different and in the process of exploring the options for dynamically calling a web service through a Web Service action block, along with even passing the input request XML dynamically, I came across a few questions on the community website related to this, however there was no definite answer, especially on how to go about dynamically passing the input request XML to the WSDL (Web Services Description Language). So, here is a short blog post detailing about it, which I hope will help you during this type of implementation.
(Note – In this blog post, I will just talk about calling the web services dynamically. For static configuration and call using Configure Object option, please refer MII’s help page and other content available on community website.)
As shown in the below screenshot, we need to pass the minimum parameters (CredentialAlias is also optional, depending on your web service’s authorization requirement) through the Link Editor of Web Service action block. For sake of testing, I have hard-coded these parameters in the Expression Editor, but all these can be passed dynamically through a Transaction/Local/Shared property.
Now, our focus is on the Inputs parameter of the action block. This is of datatype Map, so we can pass N number of Key-Value combinations, depending on the number of inputs and their corresponding data type the WSDL is expecting. My WSDL expects just one input of datatype XML, so I map it as below.
Name of the input parameter of WSDL:
So, SAP_PROCESS_ORDER becomes my Key which I have stored in Local.Input property and I want to pass Local.TestXML as the request XML, so this becomes my Value.
That’s all. Execute the transaction to successfully post the data to the web service.
Hope this will help eliminate using the Web Service action blocks separately/repeatedly for each web service call and thus allowing to optimize the implementation. Cheers!
Please do leave your comments with your feedback/suggestions.