Skip to Content
Technical Articles
Author's profile photo Anuj Suryawanshi

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.

Mapping%20in%20Link%20Editor

Mapping in Link Editor of Web Service action block

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:

WSDL%20Input%20Parameter

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.

Passing%20Key-Value%20to%20Inputs%20parameter

Passing Key-Value to Inputs parameter

 

That’s all. Execute the transaction to successfully post the data to the web service.

Web%20Service%20Response

Web Service Response

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.

 

Thank You,

Anuj Suryawanshi

Assigned Tags

      3 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Archisman Das
      Archisman Das

      I can see this coming in handy very soon!

      Author's profile photo Anuj Suryawanshi
      Anuj Suryawanshi
      Blog Post Author

      Glad to hear that 🙂

      Author's profile photo Beyhan MEYRALI
      Beyhan MEYRALI

      Hi,

      Thanks for information. You can call a web service from MII and then you will regret it once you need to debug it :). So call a RFC on SAP and let RFC to do all the business logic. Do not put any biz logic to MII drag drop 4gl screen, instead use it as controller in MVC model.

      Regards