Calling SOAP APIs using cURLs (With Picture)

cURL commands allow developers to easily create, send, test, and debug SOAP requests and communications. In this article, I will show you how to test a SOAP web service using cURL easily.

Steven Ang Cheong Seng

Steven Ang Cheong Seng

15 May 2025

Calling SOAP APIs using cURLs (With Picture)

The phrase "SOAP cURLs" comprises two popular technologies you may have heard before. Before anything else, this article discusses the technologies and their capabilities.

💡
Apidog, an API design-first development platform, provides its users with numerous modifications and specifications for an entire API lifecycle.

If you need an API platform to build, mock, debug, or document APIs, Apidog is an optimal choice. All you have to do is click the button below. 👇 👇 👇 

Basic Terminologies on SOAP and cURLs

The terms "SOAP" and "cURL" each refer to a unique technology.

When the terms are combined, "SOAP cURLs" refers to using a cURL's functionalities to specifically interact with SOAP-based web services.

Breakdown of How SOAP cURLs Work

1. Define the SOAP message:

2. Construct the cURL command:

3. Sending the request and receiving a response:

4. Further processing of the response:

How to Call SOAP API Using cURL

Step 1: First, you will need to prepare your SOAP message. In case this is your first time creating a SOAP message, you can refer to the code sample below - however, you will need to modify it to ensure it satisfies your needs.

Sample SOAP message:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://www.example.com/webservice">
   <soapenv:Header/>
   <soapenv:Body>
      <ws:getGreeting>
         <ws:name>John Doe</ws:name>
      </ws:getGreeting>
   </soapenv:Body>
</soapenv:Envelope>
Can you guess what the message is requesting from the web service?

Step 2: Prepare your cURL command on your terminal. Similar to the step above, you can take a look at the code sample.

Sample cURL command:

curl -X POST \
-H "Content-Type: text/xml; charset=utf-8" \
-H "SOAPAction: http://www.example.com/webservice/getGreeting" \
-d @soap_request.xml "https://dummy.webservice.com/path/to/service"

cURL command explanation:

Real-Life Applications of SOAP cURLs

1. Legacy system integration: SOAP was often used in older enterprise applications. If you need to interact with such legacy systems that haven't been migrated to newer protocols, cURL can provide a way to manually craft and send SOAP requests for data exchange.

2. Testing and debugging SOAP web services: Developers can use cURL to directly send specific SOAP requests and analyze the responses to troubleshoot issues with SOAP web services. This allows for granular control over the request and helps isolate potential problems.

3. Custom scripts and automation: cURL can be integrated into scripts and programs to automate tasks involving SOAP communication. This could be useful for scenarios like periodically fetching data from a SOAP service or triggering specific actions based on received SOAP messages.

Apidog - Makes SOAP Testing Easier

Apidog is an API development platform that provides numerous functionalities to personalize APIs to your liking. Whether you are planning to create a new API from scratch or import a personal API you have been working on for some time, Apidog supports either choice.

api design apidog test build
Apidog functions that users can enjoy
button

Apidog supports the imports of WSDL files so that you can view SOAP-based web services. On another note, you can also generate cURL commands using Apidog's client language code generation, so you do not have to second guess whether you are right or wrong!

Importing WSDL Files to View SOAP-based Web Services on Apidog

import wsdl file apidog
Importing WSDL File onto Apidog

Firstly, press the Settings button found on the left side of the vertical toolbar. Then, locate Import Data under the Data Management section. Lastly, choose WSDL to import WSDL files onto Apidog.

Editing WSDL Files on Apidog

edit wsdl file apidog
Editing a WSDL File with Apidog

If the WSDL file has been successfully imported, you will find your WSDL file on the left, as shown in the image pointed out by Arrow 1. You can then click the numbered arrows to start editing.

Once you have your WSDL file imported and debugged, you can start testing it on Apidog for any more errors. If you are still unsure whether your WSDL file is right or wrong, check out WSDL file examples for more details.

Importing cURL to Apidog

Apidog supports importing cURL command line codes for those who have it ready.

start curl import apidog
Initializing cURL import on Apidog

On the APIs section, find a purple + button found around the top left corner of the Apidog window. Then select Import cURL. If you cannot find the mentioned button, you can use the shortcut, Ctrl + I.

paste curl command apidog
Paste your cURL command in the empty field

Here, you can paste your cURL command. Once you have, press Enter on your keyboard or the OK button to view your cURL command.

curl code body edit apidog
Decide if you need to modify anything else

if successful, you can view the cURL command as part of the JSON body, as shown in the picture above. Here, you can do tweaks or changes, wherever and whenever required.

cURL Command Code Generation Using Apidog

curl comannd code generation apidog
Generating cURL command line code

To begin cURL code generation, locate and press the </> button found in the top right corner of the Apidog window. Then, select Generate Client Code.

curl code generate apidog
Select the cURL command line code using Apidog

A pop-up window will prompt you to select which client code to generate. Here, select Shell and cURL. once you have, you can copy the code and paste it into your terminal. However, ensure that you modify it to fit your needs.

Conclusion

SOAP cURLs are two technologies that can work hand in hand, where cURL commands can be used for SOAP-based web service communication. However, do note that their use is declining due to more popular architectural styles like REST.

Apidog is an all-in-one API development platform that promotes a design-first development for APIs. With Apidog, you can easily modify and design APIs visually thanks to its simple and intuitive UI. Moreover, it is a solid choice for any developers who are interested in trying a new platform as Apidog supports various file type imports, with Postman, WSDL, and many more.

Explore more

Why I Love Stripe Docs (API Documentation Best Practices)

Why I Love Stripe Docs (API Documentation Best Practices)

As a developer, I’ve had my fair share of late nights fueled by frustration and bad documentation. I think we all have. I can still vividly recall the cold sweat of trying to integrate a certain legacy payment processor years ago. It was a nightmare of fragmented guides, conflicting API versions, and a dashboard that felt like a labyrinth designed by a committee that hated joy. After hours of wrestling with convoluted SOAP requests and getting absolutely nowhere, I threw in the towel. A colleagu

20 June 2025

How to Install and Configure MongoDB MCP Server

How to Install and Configure MongoDB MCP Server

In the ever-evolving landscape of software development, the integration of Artificial Intelligence is no longer a futuristic concept but a present-day reality. AI-powered tools are rapidly becoming indispensable for developers, streamlining workflows, and enhancing productivity. Recognizing this trend, MongoDB has introduced a groundbreaking tool that bridges the gap between your database and AI: the MongoDB Model Context Protocol (MCP) Server. This tutorial provides a comprehensive, step-by-ste

20 June 2025

How to Use graphql-codegen, A Beginners' Guide

How to Use graphql-codegen, A Beginners' Guide

In the ever-evolving landscape of web development, GraphQL has emerged as a powerful alternative to traditional REST APIs, offering clients the ability to request precisely the data they need. However, this flexibility can introduce a new set of challenges, particularly when it comes to maintaining type safety between the frontend and backend. This is where graphql-codegen comes in, a revolutionary tool that automates the generation of typed code from your GraphQL schema, supercharging your deve

20 June 2025

Practice API Design-first in Apidog

Discover an easier way to build and use APIs