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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:00:34+00:00 2026-05-13T20:00:34+00:00

All right, so previously I asked… SOAP Prototype AJAX SOAPAction Header Question (can’t hyperlink

  • 0

All right, so previously I asked…
SOAP Prototype AJAX SOAPAction Header Question (can’t hyperlink it unfortunately, not enough rep for “2” links… see below)

Which never worked out. I think it has something to do with Prototype, it will return a 0 as onSuccess. I can’t figure out the Content-type utf-8 formatting. Now if I go back to straight javascript and use xmlhttprequest

<html xmlns="http://www.w3.org/1999/xhtml">

    function getUVIndex() {
        // In Firefox, we must ask the user to grant the privileges we need to run.
        // We need special privileges because we're talking to a web server other
        // than the one that served the document that contains this script. UniversalXPConnect
        // allows us to make an XMLHttpRequest to the server, and
        // UniversalBrowserRead allows us to look at its response.
        // In IE, the user must instead enable "Access data sources across domains"
        // in the Tools->Internet Options->Security dialog.
        if (typeof netscape != "undefined") {
            netscape.security.PrivilegeManager.
                    enablePrivilege("UniversalXPConnect UniversalBrowserRead");
        }
        // Create an XMLHttpRequest to issue the SOAP request. This is a utility
        // function defined in the last chapter.
        var request = new XMLHttpRequest();
        // We're going to be POSTing to this URL and want a synchronous response
        request.open("POST", "http://iaspub.epa.gov/uvindexalert/services/UVIndexAlertPort?wsdl", false);

        request.onreadystatechange=function() {
                if (request.readyState==4) {
                    var index = request.responseXML.getElementByTagName('index')[0].firstChild.data;
                    alert(request.responseText);
                }
            }
        // Set some headers: the body of this POST request is XML
        request.setRequestHeader("Content-Type", "text/xml");
        // This header is a required part of the SOAP protocol
        request.setRequestHeader("SOAPAction", '""');
        // Now send an XML-formatted SOAP request to the server
        request.send(               
            '<?xml version="1.0" encoding="utf-8"?>' +
            '<soap:Envelope' +
            ' xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"' +
            ' xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"' +
            ' xmlns:tns="urn:uvindexalert" xmlns:types="urn:uvindexalert/encodedTypes"' +
            ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
            ' xmlns:xsd="http://www.w3.org/2001/XMLSchema">' +
            '  <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">' +
            '    <tns:getUVIndexAlertByZipCode>' +
            '       <in0 xsi:type="xsd:string">12306</in0>' +
            '   </tns:getUVIndexAlertByZipCode>' +
            '  </soap:Body>' +
            '</soap:Envelope>'

            );
        // If we got an HTTP error, throw an exception
        if (request.status != 200) throw request.statusText;

        //return request.responseXML.childNodes[0].childNodes[1].childNodes[3].childNodes[5].textContent;
    }

    getUVIndex();
</script>

This never calls the onreadystatechange. If you uncomment the
return request.responseXML.childNodes[0].childNodes[1].childNodes[3].childNodes[5].textContent;

It will retrieve the value needed and if you are in Firebug you will see the readyState == 4 and status == 200 (not that I check for that). I usually never need to be spoon fed but I just don’t understand why I am not getting the values back I need from the listener, or why it is never called. Also, not that this should matter really but I am approving the request on Firefox to be cross-domain, it is really for mobile so the call will not need to be have a confirmation of cross-domain, it will do that automatically.

I hope someone can look at this and see what I overlooked. Thanks!

  • 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-13T20:00:34+00:00Added an answer on May 13, 2026 at 8:00 pm

    onreadystatechange will only be called for asynchronous requests to the server, your code is sending a synchronous request.

    Set the third parameter on the open call to true (or remove the third parameter as default is true).

    request.open("POST", "http://iaspub.epa.gov/uvindexalert/services/UVIndexAlertPort?wsdl", true);
    

    http://msdn.microsoft.com/en-us/library/ms536648(VS.85).aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 300k
  • Answers 300k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It appeared to be possible through using a "Routing options"… May 13, 2026 at 8:01 pm
  • Editorial Team
    Editorial Team added an answer In the case of singleton-type IValueConverters (e.g. they don't need… May 13, 2026 at 8:01 pm
  • Editorial Team
    Editorial Team added an answer You can use lookahead assertions: /<a>(?!computer).*?<\/a>/ May 13, 2026 at 8:01 pm

Related Questions

I asked a question about interfaces previously and got some excellent responses. I'm really
I am trying to create a go-moku game using jquery,php, and mysql database. I
This is a more specific question to follow up on [another question that I
I have an MDI app written in Qt. Some of the subwindows include QGLWidget
I have a question about sharing data between views, hopefully it's not too basic.

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.