×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    May 2011
    Posts
    10

    Lightbulb Problem with soap xml http request [with code]

    Hi,
    I need to get some data using soap xml http request, but the response always shows "Error code 400 received: Bad Request".
    Who can tell me what's wrong with my js code which is as follows?
    Any help or pointer to same would be appreciated. Regards.

    Code:
    function sendRequest(){
    	var symbol = "MSFT";  
    	var xmlhttp = new XMLHttpRequest();
    	xmlhttp.open("POST", "http://www.webservicex.net/stockquote.asmx?op=GetQuote", true);
    	xmlhttp.setRequestHeader("SOAPAction", "http://www.webserviceX.NET/GetQuote"); 
    	xmlhttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8"); 
    	xmlhttp.onreadystatechange = function() { 
            if (xmlhttp.readyState == 4) {
                if (xmlhttp.status == 200) {
                    if (xmlhttp.responseText != null) {
                        alert(xmlhttp.responseText);
                    }
                    else {
                        alert("Failed to receive RSS file from the server - file not found.");
                        return false;
                    }
                }
                else {
                    alert("Error code " + xmlhttp.status + " received: " + xmlhttp.statusText); // error here
                }
            }
    		else {
    			alert("Error ready state " + xmlhttp.readyState);
    		}
    	} 
    
    	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);
    }

  2. #2
    Super Contributor
    Join Date
    Jun 2008
    Location
    Tampere
    Posts
    833

    Re: Problem with soap xml http request [with code]

    Hi,

    Discussion is continuing in this thread:
    http://discussion.forum.nokia.com/fo...n-S40-web-apps

    (just in case somebody finds this one first)

    -Ilkka

Similar Threads

  1. Problem with soap xml http request [with code]
    By boq in forum Nokia Asha Web Apps
    Replies: 0
    Last Post: 2011-05-28, 10:35
  2. problem with xml request and response
    By srinivas.symbian in forum Qt
    Replies: 2
    Last Post: 2011-02-09, 16:44
  3. XML onLoad with background http server problem
    By simonjuric in forum [Archived] Flash Lite on Nokia Devices
    Replies: 5
    Last Post: 2009-06-08, 16:47
  4. Weird problem with HTTP/1.1 GET request.
    By cidrick in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2006-07-20, 05:27
  5. How to make soap request thru HTTP
    By dtripathy in forum Symbian
    Replies: 1
    Last Post: 2006-04-23, 21:13

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •