How to call soap API in PHP and Postman soap » How to call soap API in PHP and Postman soap

How to call soap API in PHP and Postman soap

soap api in postman
soap api in postman
This entry is part 2 of 7 in the series PHP Advance Tutorial

SOAP – Simple Object Access uses the only XML for exchanging information From the client-side to the server-side. we can use any of the languages to consume this api.there is no language dependency. you can use any internet protocol like TCP, UDP. also soap API use user-defined Https codes. these APIs are more secure than other APIs. so that mostly used by the banking industry.

In this, We will use soap API with

SOAP API with the Postman

Step 1. Download and install the postman 

Step 2. We will use this

soap API for testing

Step 3. Request data for this API 

<Envelope xmlns="">
		<ListOfContinentsByName xmlns=""/>

If you unable to produce the request data add  this  chrome extension wizdler

wizdler soap api extension
wizdler soap api extension

Click on ListOfCountryByName. you will redirect on the new tab then copy the request data.

Step 4. Then a select  method to Post 

postman api call method
postman api call method

Step 5. Add content type in the header to text/XML

set header in postman
set header in postman

Step 6. Welldone All set now press the send button and we will the response in XML formate from your soap API.

soap api call in postman

Calling soap api using the PHP

For consuming the soap API in PHP we will use the predefined curl method 

To call this API in PHP by curl method you have to set these parameters


This is the demo code for reference. past this code into your project  and remember pls change the  CURLOPT_URL and CURLOPT_POSTFIELDS

$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => "",
  "<Envelope xmlns=\"\">
      <ListOfContinentsByCode xmlns=\"\"/>
  CURLOPT_HTTPHEADER => array("content-type: text/xml"),
$response = curl_exec($curl);
$err = curl_error($curl);
if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
//call soap API in php
call soap api by php
call soap api by php

Make index.php into your project and try to access this file in the browser. Make sure you have made this project into the localhost root directory.

soap api call on localhost using chrome

Series Navigation<< How to Install and Use Composer or PHP Dependency ManagerHow to optimize the php two-dimensional search  >>
soap api in postman
Join the discussion

1 comment
Translate »
Share via
Copy link
%d bloggers like this: