Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6379247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:06:48+00:00 2026-05-25T02:06:48+00:00

I was looking for way to perform form (post) request with SOAP using jQuery/AJAX.

  • 0

I was looking for way to perform form (post) request with SOAP using jQuery/AJAX.

I have found following solution for jQuery/AJAX SOAP request with ColdFusion background.

Posting XML SOAP Requests With jQuery

Anyone know how to implement that with PHP?

Please note:

  • ssl connection will be required
  • soap authentication(user & pass) will be required.

Any help/suggestion much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T02:06:48+00:00Added an answer on May 25, 2026 at 2:06 am

    SOAP request example:

    • with HTTPS / SSL
    • with password and username auth
    • tested and working!
    • two echo examples – for single and multiple results

         <?php 
            //Data, connection, auth
            $dataFromTheForm = $_POST['fieldName']; // request data from the form
            $soapUrl = "https://connecting.website.com/soap.asmx?op=DoSomething"; // asmx URL of WSDL
            $soapUser = "username";  //  username
            $soapPassword = "password"; // password
    
            // xml post structure
    
            $xml_post_string = '<?xml version="1.0" encoding="utf-8"?>
                                <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
                                  <soap:Body>
                                    <GetItemPrice xmlns="http://connecting.website.com/WSDL_Service"> // xmlns value to be set to your's WSDL URL
                                      <PRICE>'.$dataFromTheForm.'</PRICE> // data from the form, e.g. some ID number
                                    </GetItemPrice >
                                  </soap:Body>
                                </soap:Envelope>';
    
                $headers = array(
                            "Content-type: text/xml;charset=\"utf-8\"",
                            "Accept: text/xml",
                            "Cache-Control: no-cache",
                            "Pragma: no-cache",
                            "SOAPAction: http://connecting.website.com/WSDL_Service/GetPrice", // your op URL
                            "Content-length: ".strlen($xml_post_string),
                        );
    
                $url = $soapUrl;
    
                // PHP cURL  for https connection with auth
                $ch = curl_init();
                curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
                curl_setopt($ch, CURLOPT_URL, $url);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                curl_setopt($ch, CURLOPT_USERPWD, $soapUser.":".$soapPassword); // username and password - declared at the top of the doc
                curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
                curl_setopt($ch, CURLOPT_TIMEOUT, 10);
                curl_setopt($ch, CURLOPT_POST, true);
                curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_post_string); // XML REQUEST
                curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    
                // converting
                $response = curl_exec($ch); 
                curl_close($ch);
    
                // converting
                $response1 = str_replace("<soap:Body>","",$response);
                $response2 = str_replace("</soap:Body>","",$response1);
    
                // convertingc to XML
                $parser = simplexml_load_string($response2);        
    
    
    
        ?>
    

    Displaying single result example:

      $getPrice = $parser->GetItemPriceResponse->PRICE;
    
      if($getPrice) { // if found based on our $_POST entry echo the result
             echo $getPrice;
      } else { // if not found, echo error
            echo "Sorry. No price tag for this item.";
      }
    

    Displaying multiple results example:

     $getPrice = $parser->GetItemPriceResponse->PRICE;
    
                    if($getPrice) { // if found  more than 0, return as a select dropdown
    
                        echo "<form action='soapMoreDetails.php' method='post'>";
                        echo "<select name='priceMoreDetails'>";
    
                        foreach ($parser->GetItemPriceResponse as $item) {
                            echo '<option value="'.$item->PRICE.'">';
                            echo $item->PriceBasedOnSize; // for e.g. different prices for different sizes
                            echo '</option>';
                        }
    
                        echo "</select>";
                        echo "<input type='submit'>";
                        echo "</form>";
    
                    } else {
                        echo "Sorry. No records found.";
    
                    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I'm looking for the absolute, fastest way to perform the following: Load jQuery
I am using the jquery-ui-dialog plugin I am looking for way to refresh the
I'm looking for a way to perform a regex match on a string in
I am looking for a way to perform in-place editing on my webforms app.
I'm looking for a good way to perform multi-row inserts into an Oracle 9
I'm looking a way to enable IP logging with log4net in ASP.NET. I found
I am using codeigniter and looking a way to enable directly editting of doc
To clarify, I am looking for a way to perform a global search and
Im looking a way to use different IP addresses for each GET request with
I'm looking for a way to perform pointer operations in C# or .NET in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.