Javascript to set a SOAP endpoint

Discussion in 'JavaScript' started by ianpiper, Nov 4, 2006.

  1. #1
    Hi all,

    I have a problem with a piece of JavaScript that I am using within a Yahoo widget. I am making a SOAP Web Services client. I need to define the end point of the service like this (and this works BTW):

    var http_req = new XMLHttpRequest();
    http_req.open( "POST", "http://fred.bloggs.com/webservices/soap/search/Products", false );

    However I don't want to hard-code the url, so I have set a variable called theSearchURL and thought I could do this:

    http_req.open( "POST", theSearchURL, false );

    but it doesn't work (even when I surround the url string with &quot. Is there a problem with putting variables within commands like this?

    Baffling me, so any help much appreciated.

    Thanks,


    Ian.
    --
     
    ianpiper, Nov 4, 2006 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    I don't see why this wouldn't work. Try this.

    
    
    var theSearchURL = 'http://fred.bloggs.com/webservices/soap/search/Products';
    
    http_req.open( "POST", theSearchURL, false );
    
    Code (markup):
    Check Firefox's error console and see what error you get.
     
    nico_swd, Nov 5, 2006 IP