CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Threaded View

  1. #1
    Join Date
    Jun 2010
    Posts
    3

    Need help with SOAP with JavaScript

    I have a current function in javascript that is trying to use soap to get some values from a web service. However, I keep getting errors such as "Unterminated String Constant" and "Object Expected"

    here is my function:

    Code:
    <script type="text/javascript">      
          
        function test1(){
        var oXmlHttp = new ActiveXObject("MSXML2.XMLHTTP");
        
        oXmlHttp.open("POST","http://www.webservicex.net/WeatherForecast.asmx?wsdl",false);
        oXmlHttp.setRequestHeader("Content-Type", "text/xml");
    	
        oXmlHttp.setRequestHeader("SOAPAction", "http://www.webservicex.net/GetWeatherByZipCode");
           
       oXmlHttp.send(" \
    	<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>     \
     <GetWeatherByZipCode xmlns='http://www.webservicex.net'>   \
    <ZipCode>60609</ZipCode>   \
    </GetWeatherByZipCode>  \
    </soap:Body> \
    </soap:Envelope>   \
    ");
      	   
    		alert(oXmlHttp.responseText);
        }
    		
    </script>
    Here is the WSDL url:

    http://www.webservicex.net/WCF/Servi...ls.aspx?SID=44
    Last edited by PeejAvery; June 16th, 2010 at 07:48 PM. Reason: Added code tags

Tags for this Thread

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured