Generating code with Coded Workflows to send SOAP requests

Intro

This short tutorial is a small showcase of how to use the Coded Workflows feature in Studio to send your SOAP request. For added fun, we will also use the Generate Code functionality to skip the writing code part

As far as examples that we could work on, we can choose any service from the following Postman collection.

With the intro behind us, let’s jump straight to it.

If you’d like to learn a bit more about the basics of Coded Workflows, please refer to my previous tutorial on how to Replace Invoke code by invoking Coded Workflows inside your project, or consult our documentation over here.

Step 1 - ask Studio to generate your sample SOAP request

The first step would be to try and ask Studio to provide you with the required code snippet. In this case, the prompt was rather simple:

sample synchronous SOAP request

And the result looked like this:

Step 2 - fill it with the missing data

In our example, we want to issue the request to this URL: http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso, and with the following payload:

@"<?xml version=""1.0"" encoding=""utf-8""?>
	<soap12:Envelope xmlns:soap12=""http://www.w3.org/2003/05/soap-envelope"">
		<soap12:Body>
			<ListOfCountryNamesByName xmlns=""http://www.oorsprong.org/websamples.countryinfo"">
			</ListOfCountryNamesByName>
		</soap12:Body>
</soap12:Envelope>";

To do that, we can simply replace the automatically generated placeholders like so:

Step 3 - run the automation!

We are done here. We can run the automation and observe the results in the output panel:

Project files

You can download the sample project below:
SOAP Request and Coded Workflows.zip (3.3 KB)

What do you think?

Feel free to share your feedback. Our team is always listening :slight_smile:

7 Likes

Thanks for that amazing Add-On , with the AI Code generation the coded workflow development will be much faster , I’m excited to use the new add on

EDIT:- I’m encountering a challenge. While attempting to use the code generation feature, I noticed that the ‘Generate’ button is disabled for some unknown reason. I’m unsure if I’m overlooking something. Any insights on this issue would be greatly appreciated.

I replied in your topic with the bug report. We’ll investigate, it looks weird and like it shouldn’t be happening.

Thank you for this, it is really great.

If you are interested in the topic of SOAP requests, you might consider checking out its small follow-up: