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

  • SEARCH
  • Home
  • 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 6686225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:08:51+00:00 2026-05-26T05:08:51+00:00

All I am using my SOAP API using java script. this example explain how

  • 0

All

I am using my SOAP API using java script.

this example explain how to send single soap request using js

var symbol = "MSFT"; 
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("POST", "http://www.webservicex.net/stockquote.asmx?op=GetQuote",true);
xmlhttp.onreadystatechange=function() {
 if (xmlhttp.readyState == 4) {
  alert(xmlhttp.responseText);
  // http://www.terracoder.com convert XML to JSON 
  var json = XMLObjectifier.xmlToJSON(xmlhttp.responseXML);
  var result = json.Body[0].GetQuoteResponse[0].GetQuoteResult[0].Text;
  // Result text is escaped XML string, convert string to XML object then convert to JSON object
  json = XMLObjectifier.xmlToJSON(XMLObjectifier.textToXML(result));
  alert(symbol + ' Stock Quote: $' + json.Stock[0].Last[0].Text); 
 }


}
xmlhttp.setRequestHeader("SOAPAction", "http://www.webserviceX.NET/GetQuote");
xmlhttp.setRequestHeader("Content-Type", "text/xml");
var xml = '<?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> ' +
     '<GetQuote xmlns="http://www.webserviceX.NET/"> ' +
       '<symbol>' + symbol + '</symbol> ' +
     '</GetQuote> ' +
   '</soap:Body> ' +
 '</soap:Envelope>';
xmlhttp.send(xml);
// ...Include Google and Terracoder JS code here...

Now i want to send multiple soap request at a time (mean request more than one envelop).

  • 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-26T05:08:52+00:00Added an answer on May 26, 2026 at 5:08 am

    As long as the third parameter in XMLHttpRequest.open is set to true the call will be asynchronous. So your should just be able to send a new one without much effort. You do need a new XMLHttpRequest object for it to work.

    If you want to use the same callback you can just define it as a function and use this to work with the request object.

    function soapCallback() {
        if (this.readyState == 4) {
            alert(this.responseText);
            // http://www.terracoder.com convert XML to JSON 
            var json = XMLObjectifier.xmlToJSON(this.responseXML);
            var result = json.Body[0].GetQuoteResponse[0].GetQuoteResult[0].Text;
            // Result text is escaped XML string, convert string to XML object then convert to JSON object
            json = XMLObjectifier.xmlToJSON(XMLObjectifier.textToXML(result));
            alert(symbol + ' Stock Quote: $' + json.Stock[0].Last[0].Text); 
        }
    }
    
    var symbol = "MSFT"; 
    var xml = '<?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> ' +
         '<GetQuote xmlns="http://www.webserviceX.NET/"> ' +
           '<symbol>' + symbol + '</symbol> ' +
         '</GetQuote> ' +
       '</soap:Body> ' +
     '</soap:Envelope>';
    
    var xmlhttp1 = new XMLHttpRequest();
    xmlhttp1.open("POST", "http://www.webservicex.net/stockquote.asmx?op=GetQuote",true);
    xmlhttp1.onreadystatechange=soapCallback;
    xmlhttp1.setRequestHeader("SOAPAction", "http://www.webserviceX.NET/GetQuote");
    xmlhttp1.setRequestHeader("Content-Type", "text/xml");
    xmlhttp1.send(xml);
    
    var xmlhttp2 = new XMLHttpRequest();
    xmlhttp2.open("POST", "http://www.webservicex.net/stockquote.asmx?op=GetQuote",true);
    xmlhttp2.onreadystatechange=soapCallback;
    xmlhttp2.setRequestHeader("SOAPAction", "http://www.webserviceX.NET/GetQuote");
    xmlhttp2.setRequestHeader("Content-Type", "text/xml");
    xmlhttp2.send(xml);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am successfully creating a Task using the SalesForce API SOAP API through Java.
First of all, let me say that I'm relatively new to SOAP/WSDL/API, so this
I do this all the time using VNC and it is very easy, but
When using the SOAP API to work with salesforce.com (SFDC) it seems that the
I just started using Fiddler 2 to create request objects for REST,JSON, and SOAP
Help! I'm getting this error when trying to connect using JAX-WS webservice call: java.lang.NoClassDefFoundError:
I have no problem importing simple products using Magento Core API (SOAP). How can
Using file_get_contents as part of custom SOAP implementation to apply SOAP calls (ALL libraries
This week I had to look into a Java WebService project which was using
When using the Salesforce SOAP API via PHP, if I have an object which

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.