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 8516479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:26:27+00:00 2026-06-11T05:26:27+00:00

I am attempting to use PHP 5.2’s SoapServer functionality. I setup soapserv.php as shown

  • 0

I am attempting to use PHP 5.2’s SoapServer functionality. I setup soapserv.php as shown below. But I am lost as to how I can call the ‘add’ function with a language other than PHP (without WSDL). I want to make calls to it with AJAX (jQuery). Any help would be greatly appreciated!

<?php
    function add($a, $b) {
      return $a + $b;
    }

  $soap = new SoapServer(
    null,
    array('uri' => 'http://example.com/projects/php/soapserv/')
  );
  $soap->addFunction("add");
  $soap->handle();
?>

And my JavaScript looks like this (tried several ways though).

var req = $.post("http://example.com/projects/php/soapserv", {"add":{a: 1, b: 2}});

            req.done(function(msg){
                document.write(msg.responseText);
            });

            req.fail(function(msg){
                document.write(msg.responseText);
            });
  • 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-06-11T05:26:28+00:00Added an answer on June 11, 2026 at 5:26 am

    Got it… Just had to change the post data to a soap envelope!

            var request = "<?xml version=\"1.0\"?>\n";
            request += "<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\">\n";
            request += "<soap:Body xmlns:m=\"http://example.com/projects/php/soapserv\">\n";
            request += "<m:add>\n";
            request += "<m:a>1</m:a>\n";
            request += "<m:b>2</m:b>\n";
            request += "</m:add>\n";
            request += "</soap:Body>\n";
            request += "</soap:Envelope>";
    
            var req = $.ajax({
               type: "POST",
               url: "http://example.com/projects/php/soapserv",
               data: request,
               cache: false
            });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am attempting to use the data sources pluigin for rubymine 4.0.3 but I
I'm attempting to use the PHP DateTime class on a Solaris server with PHP
I'm attempting to use multiple ANDs in this query below, and it messes up
Sorry but I can't seem to get my special-kid helmet off today. I'm attempting
I am attempting to use PHP and cURL to: Access a web-form & maintain
I am attempting to use PHP to edit the DOM document tree. However, I
I'm attempting to use JS and PHP to dictate whether or not some navigation
I am attempting to use the following PHP class: <?php class Service { public
I'm attempting to make a php script that can load the current weather forecast
I'm attempting to use AJAX to insert data into a database, but am unable

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.