JavaScript - Soap Using Javascript
I want to create an application that accesses a webservice .A WSDL describes the webservice in question .I need to use SOAP to pass and receive messages from this webservice. This webservice uses authentication credentials .
I use the following code.But didn't get the requered data. <html> <head> </head> <body> <a onclick="sendSoap()" href="#">testsoap</a> <script type="text/javascript" language=javascript> function sendSoap() { var xmlhttp = new XMLHttpRequest(); var url = "wsdl link"//here is the wsdl link var soap=soapXML // here will write the xml in soap format alert(soap); xmlhttp.open("GET", url, true); xmlhttp.send(soap); xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { var resultText = xmlhttp.responseText; alert(resultText); } } } </script> </body> </html> Similar TutorialsAll I am using my SOAP API using java script. this example explain how to send single soap request using js Code: 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). Hello! I am trying to find a script that allows you to open multiple browser tabs and then close each of those tabs, either one by one or all at once. Does anyone know how to do this please? Thanks so much for your help. I want to have another go at Javascript. I have several books on the subject but I find that my eyesight is a major problem. Therefore I want to try an on-line solution, preferably free. I have Googled, but there are so many that I am almost dizzy with the choices. Perhaps someone could recommend one. Not too fussy visually. My knowledge is VERY basic. Frank Does anyone know how to make URL links that use Javascript still work when users have Javascript disabled on their browser? The only reason I'm using JS on a URL is because my link opens a PDF file, and I'm forcing it not to cache so users have the latest version. I tried the <script><noscript> tags, but I'm not sure if I'm using it correctly, as my URL completely disappears. Below is my HTML/Javascript code: <p class="download"> <script type="text/javascript">document.write("<span style=\"text-decoration: underline;\"><a href=\"javascript:void(0);\" onclick=\"window.open( 'http://www.webchild.com.au/mediakit/Direct_Media_Kit_Web.pdf?nocache='+ Math.floor( Math.random()*11 ) );\" >The Child Magazines Media Kit</a></span> (PDF 1 MB) ");</script> <noscript><span style="text-decoration: underline;"><a href="http://www.webchild.com.au/mediakit/Direct_Media_Kit_Web.pdf" >The Child Magazines Media Kit</a></span> (PDF 1 MB)</noscript> </p> Thanks for any help, Michael Hi, I have the following code snippet: test.html ====== <script language="javascript" type="text/javascript"> var testVariable = "test"; </script> <script language="javascript" type="text/javascript" src="test.js"> </script> test.js ===== var testVariable = window.top.testVariable; In firefox, I'm able to access testvariable defined within test.html in test.js. But in chrome, test.js couldnot get the window.top.testVariable field defined in test.html. Can any one please let me know how i can make it work in chrome?. Am i missing something here?. Hi Guys, I am new at JavaScript and start to do some tutorials.What I am trying to do here is prompting user to input a name and if the name was valid the page(document) will display with all objects like the button.But if user enter a wrong name then the button will be disabled! I create the following code but it did not work <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>New Web Project</title> <script language="JavaScript" type=""> function changeColor(){ document.bgColor = "Gray"; } </script> </head> <body> <script language="JavaScript" type="text/javascript"> var person = ""; person = prompt('What is Your Name:'); if (person == "Foo") { document.write("<h1 />Welcome " + person); document.bgColor = "Yellow"; } else { document.write("<h1 />Access Denied!!!!"); document.bgColor = "Red"; document.getElementById("gree").disabled = true; } </script> <div> <p/><input id="gree" type="button" value="Gray " onClick="changeColor();"> </div> </body> </html> as you can see I used the: document.getElementById("gree").disabled = true; but it did not work , could you please give an idea how I can solve this problem? Thanks Hey, I've got to make the values of some textboxes change the co-ordinates of my sprite on a canvas and havent a clue on how to do it, Here is my form with the two textboxes and submit button: <form> x: <input type="text" name="x" /><br /> y: <input type="text" name:"y" /><br /> <input type="submit" value="Submit"/><br /> </form> And i need it so that they change the values of these: //this shows where my sprite will start on the canvas var block_x; var block_y; searched the internet for hours and cant really find anything i understand or works. any help is much appreciated I got an index.php Code: <html> <form action="bacakomik.php" method='post'> <select name="kodekomik"> <option value='../komik1/|23'>Judul Komik1</option> <option value="../komik2/|20">Judul Komik2</option> <option value="../komik3/|10">Juduk Komik3</option> <option value="../komik4/|20">Judul Komik4</option> </select> <input type="submit" /> </form> <?php echo ('<select>'); echo ('<option value= "'.$i.'">'.'Page '.$i.'</option>'); echo ('</select>'); ?> </html> As you can see, each of the option brings specific value "../komik1/|23" komik1 is a directory | is a delimiter 23 is the pages in one chapter and can be considered also as how many images are there on a specific directory This is my bacakomik.php Code: <?php $dirkomik = $_POST['kodekomik']; $exploded = explode("|", $dirkomik); echo ($exploded[0]); //picture directory echo ("<br>"); echo ($exploded[1]); //total page in the comic $pagecount = (int)$exploded[1]; //Take last posted value, process it right away echo ('<FORM name="guideform"> '); echo ('<select name="guidelinks">'); $i=1; do { echo ('<option value= "'.$i.'">'.'Page '.$i.'</option>'); $i= $i+1; }while($i <= $pagecount); //Printing option and select echo ("</select>"); ?> <input type="button" name="go" value="Go!" onClick="document.getElementById('im').src=document.guideform.guidelinks.options[document.guideform.guidelinks.selectedIndex].value+'.png';"> </FORM> <img src="img0.jpg" id="im"> With the current code on bacakomik.php, I only can change the img src of id "im" in the same directory only. What I want is that the Javascript could "add" the "$exploded[0]" variable so that the picture can be loaded from different directory. Anyone can do this? I believe that the fix should be somewhere on input tag inside OnClick, or do you know where? Anyway, I found this on the net http://p2p.wrox.com/php-faqs/11606-q...avascript.html Please help me to those who can... I want to insert this js snippet Code: function addText(smiley) { document.getElementById('message').value += " " + smiley + " "; document.getElementById('message').focus(); return false; } to a loaded iframe with name&id chtifrm. I can access it & change embed something in its html via using something like: Code: $(parent.chtifrm.document.body).append('<div id=\"smly\" style=\"cursor:pointer;float:left;top:200px;display:none;position:absolute;\"><\/div>'); .... Code: parent.chtifrm.document.getElementById('chatbox_option_disco').style.display == 'none' but how do I insert js in the head of loaded iframe? Hi Guys I am trying to modify the functionality of my page. I want to be able to activate this piece of code using another javascript function. This is the code I want to activate: Code: <script type="text/javascript"><!-- $('#button-cart').bind('click', function() { $.ajax({ url: 'index.php?route=checkout/cart/update', type: 'post', data: $('.product-info input[type=\'text\'], .product-info input[type=\'hidden\'], .product-info input[type=\'radio\']:checked, .product-info input[type=\'checkbox\']:checked, .product-info select, .product-info textarea, .date_data input[type=\'text\']'), dataType: 'json', success: function(json) { $('.success, .warning, .attention, information, .error').remove(); if (json['error']) { if (json['error']['warning']) { $('#notification').html('<div class="warning" style="display: none;">' + json['error']['warning'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>'); $('.warning').fadeIn('slow'); } for (i in json['error']) { $('#option-' + i).after('<span class="error">' + json['error'][i] + '</span>'); } } if (json['success']) { $('#notification').html('<div class="success" style="display: none;">' + json['success'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>'); $('.success').fadeIn('slow'); $('#cart_total').html(json['total']); $('html, body').animate({ scrollTop: 0 }, 'slow'); } } }); }); //--></script> And this is how I want the format of the function to be: function testsession() { if there is a session called 'hiredate' { activate the script above } else { var el = document.getElementById("product_data"); } } I just dont know how to write this in javascript Could you help me if possible please All -- I have a JavaScript config file called gameSetting.js which contains a bunch of variables which configures a particular game. I also have a shared JavaScript library which uses the variables in gameSetting.js, which I include like so: <script type="text/javascript" src="gameSetting.js" ></script> <script type="text/javascript" src="gameLibrary.js" ></script> In gameSetting.js I have: $(document).ready(function() { // call some functions / classes in gameLibrary.js } in Firefox, Safari, and Chrome, this works fine. However, in IE, when it's parsing gameSetting.js, it complains that the functions that live in gameLibrary.js aren't defined. When it gets to parsing gameLibrary.js, the variables in gameSetting.js are reported as not being defined. I've tried dynamically bootstrapping the gameLibrary file using this function in document.ready for dynamic load... $.getScript("gameLibrary.js"); However, the same problem still happens in IE, where when it parses the files individually it's not taking into context the file/variables that came before, so it's not an out of load order problem. My options a 1) collapsing all the functions in gameLibrary.js and variables in gameSetting.js into one file. However, this is not practical because this is dealing with literally hundreds of games, and having a gameLibrary.js in ONE location for ONE update is what makes most logical sense. 2) figure out a way to get this to work where variables in file1 are accessible to file2 in IE (as it seems they are in other browsers). jQuery seems to be able to have multiple plugins that all refer to the based jQuery-1.3.2.js, so I know there is a way to get this to work. Help appreciated. Nero I wrote a log function that took note of various function calls. Thinking that functions are first class objects, and objects have properties, I made the name of each logged function a property of that function, e.g., brightenInnerPara.name = "brightenInnerPara"; Every browser I tried (Firefox, MSIE, Opera, Chrome, Safari) accepted the assignment, no problem. In Firefox and MSIE, the result was what I wanted: brightenInnerPara.name == "brightenInnerPara" But in the others, the result was: brightenInnerPara.name == null Question 1. Which Javascript is correct here? I favor Firefox and MSIE, not merely because they were willing to give me what I wanted, but also because it makes no sense to accept an assignment statement without throwing an error and then give it a null semantics, like Chrome, Opera, and Safari did. I found a workaround, using assignments like this: brightenInnerPara.prototype.name = "brightenInnerPara"; To my surprise, that worked in every browser. But I don't know why. It seems that such assignments are enough to cause each function to have its own distinct prototype. Question 2. Just how inefficient is my workaround, and why does it work? Hey guys, I don't really know javascript but I'm starting to learn it. Anyways I need help with something. So I have a form and I went to make it so when i user selects one of the radios on the form, a checkbox below it will uncheck and become disabled. Can anyone show me how to do this? Thanks in advance. Sir i have a problem that, in head tag i have a easyslider script that working well, now i want to add new script of lightbox for image viewing but it does not working, when i remove the slider script files then lightbox working properly but when i add slider scripts files then lightbox not working, may be some function have same names or may be other problem i do not know. plz help me I am implementing a card trick on a website. What I want to do is the user picks 4 cards then based on those cards the user is forced to pick 4 more that are of opposite color. So right now I have the cards displayed on the page but I want to keep track of each card. For example set reds to zero and blacks to ones. So lets say the user picks 4 black cards. Then I want it to display all cards that have the value zero (red cards). Then the user picks. Then it refreshes the cards to display the cards with the value zero and the user picks another card and it does that 2 more times. Is there a way I can assign a value to each card (1 or 0) and then display cards by there value? Any help would be greatly appreciated. I am new to javascript, I need help in completing this project at school HERE IS MY HTML CODE: I need a function to add the radio buttom plus the check boxes when someone click on the total submit buttom. please help me with project. don't worry about my CSS link. thanks <html> <head> <title>pizza online</title> <script type="text/javascript"> /*<![CDATA[ */ function addprice(){ for (var i=0; i <document.forms[0].addsubtotal.legth; ++i) { if (document.forms[0].addsubtotal[i].checked== true) { document.forms[0].addsubtotal[i].checked=false; break; } /* ]]> */ </head> <body> <!-- Your XHTML here --> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td class="logo" rowspan="3"></td> <td class="topbar"></td> </tr> <tr> <td class="centerbar"><div class="nav_bar">Menu | Order | Location | Coupons</div></td> </tr> <tr> <td class="bottom"></td> </tr> <tr> <td colspan="2" class="nav"></td> </tr> </table> <p> </p> <h3>Order Your Pizza online</h3> <!--begins form--> <form action="FormProcessor.html" name="pizza" method="get" enctype="application/x-www-form-urlencoded" onsubmit="return confirmSubmit()"> <table class="tb" border="0"> <tr> <td class="tb" colspan="5"><h4>Pizzas Selection</h4></td> </tr> <tr> <td class="tb" > </td> <td class="tb2" >Pizzas</td> <td class="" > </td> <td class="tb2" >Price</td> <td class="tb2" >Order Your Pizza online Here</td> </tr> <!--begins radio buttoms--> <tr> <td style="width: 60px;" class="tb"><input type="radio" name="pizza" value="10.99" onclick="addprice();"/></td> <td style="width: 140px;" class="tb">Four Cheese</td> <td style="width: 100px;" > </td> <td style="width: 200px;" class="tb3">$10.99</td> <td rowspan="5" style="width: 500px;" class="tb2" align="center"><img src="image/each1.png" alt="" width="300" height="130" /></td> </tr> <tr> <td style="width: 60px;" class="tb"><input type="radio" name="pizza" value="11.99" onclick="addprice();/></td> <td style="width: 140px;" class="tb">Vegetarian</td> <td style="width: 100px;" > </td> <td style="width: 200px;" class="tb3">$11.99</td> </tr> <tr> <td style="width: 60px;" class="tb"><input type="radio" name="pizza" value="12.99" onclick="addprice();/></td> <td style="width: 140px;" class="tb">Italian</td> <td style="width: 100px;" > </td> <td style="width: 200px;" class="tb3">$12.99</td> </tr> <tr> <td style="width: 60px;" class="tb"><input type="radio" name="pizza" value="13.99" onclick="addprice();/></td> <td style="width: 140px;" class="tb">Chicago</td> <td style="width: 100px;" > </td> <td style="width: 200px;" class="tb3">$13.99</td> </tr> <tr> <td style="width: 60px;" class="tb"><input type="radio" name="pizza" value="14.99" onclick="addprice();/></td> <td style="width: 140px;" class="tb">Deluxe</td> <td style="width: 100px;" > </td> <td style="width: 200px;" class="tb3">$14.99</td> </tr> <tr> <td class="tb" colspan="5"><h4>Toppings Selection</h4></td> </tr> <!--begins check boxes--> <tr> <td style="width: 60px;" class="tb"><input type="checkbox" name="topping" value="1.00" onclick="addprice();/></td> <td style="width: 140px;" class="tb">Pepperoni</td> <td style="width: 100px;" > </td> <td style="width: 100px;" class="tb3">$1.00</td> <td rowspan="5" style="width: 500px;" class="tb">Here is a list of all Topping available for you to choose from. </td> </tr> <tr> <td style="width: 60px;" class="tb"><input type="checkbox" name="topping" value="1.00" onclick="addprice();/></td> <td style="width: 140px;" class="tb">Ham</td> <td style="width: 100px;" > </td> <td style="width: 100px;" class="tb3">$1.00</td> </tr> <tr> <td style="width: 60px;" class="tb"><input type="checkbox" name="topping" value="1.00" onclick="addprice();/></td> <td style="width: 140px;" class="tb">Mushroom</td> <td style="width: 100px;" > </td> <td style="width: 100px;" class="tb3">$1.00</td> </tr> <tr> <td style="width: 60px;" class="tb"><input type="checkbox" name="topping" value="1.00" onclick="addprice();/></td> <td style="width: 140px;" class="tb">Onions</td> <td style="width: 100px;" > </td> <td style="width: 100px;" class="tb3">$1.00</td> </tr> <tr> <td style="width: 60px;" class="tb"><input type="checkbox" name="topping" value="1.00" onclick="addprice();/></td> <td style="width: 140px;" class="tb">Sausage</td> <td style="width: 100px;" > </td> <td style="width: 100px;" class="tb3">$1.00</td> </tr> <tr> <td class="tb" colspan="5"> </td> </tr> <tr> <td style="width: 60px;" class="tb"><input type="checkbox" name="topping" value="1.00" /></td> <td style="width: 140px;" colspan="2"><input type="submit" value="Total" /><input type="reset" value="Reset" /></td> <td style="width: 100px;" class="tb"><input type="text" value="Total" /></td> </tr> </table> </form> <!-- your XHTML validation icon--> </body> </html> Thanks Ossie So i have this: Code: #wrap { background-color:#FFFFFF;filter:alpha(opacity=80);opacity:.6; } And with javascript I want to basically, make turn the opacity up, so i tried this: Code: function mouseOver() { document.getElementById('wrap').style.background-color = "#FFFFFF;filter:alpha(opacity=80);opacity:.9;" } Though it's not working, can anyone help me? Hi All, This is my first ever thread here at CodingForums.com. I am currently doing a Information and Computer Science degree at Birkbeck University, London. Unfortunately, due to the volcanic ash cloud problems, and being stuck in Cyprus because of it, I unfortunately missed the first FOUR lectures of my Javascript module. I have a Tutor Marked Assignment to do, and have been given a bit longer to submit this because of the problems I had getting home to the UK. Can anyone recommend any good JavaScript websites where I can try and bring myself up to speed quickly? Thanks in advance for any help offered. Kind regards, Daz. Hello I am trying to validate a web form. Someone else wrote the Html code and implemented it with an iframe using asp and php. I didn't want to mess too much with the code so I decided to use javascript to make the form validate, before it was sending email alerts with every field blank. For the most part the validation works but it skips the email field for some reasons and is really bugging me to death. I hope that there is someone that is more experienced in javascript than me to help me find the bug. this is the code: <head> <link type="text/css" rel="stylesheet" href="CSS/style.css"/> <title>Bid Form</title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <script src="gen_validatorv4.js" type="text/javascript"></script> <script type="text/javascript"> function docload() { var frmvalidator = new Validator("bidrequest"); if(frmvalidator.addValidation) { frmvalidator.addValidation("CompanyName","req","Please enter the company Name"); frmvalidator.addValidation("CompanyName","maxlen=50","Max length for company name is 50 characters"); frmvalidator.addValidation("Contact","req","Please enter the contact name"); frmvalidator.addValidation("Contact","maxlen=30","Max length for contact name is 30 characters"); frmvalidator.addValidation("email","req","Please insert your E-mail"); frmvalidator.addValidation("Phone","req","Enter the phone number please"); frmvalidator.addValidation("Phone","maxlen=30","Max lenght is 30"); frmvalidator.addValidation("Phone","numeric","Only numbers please"); frmvalidator.addValidation("Fax","numeric","req","Enter the phone number please"); frmvalidator.addValidation("Address1","req","maxlen=100","Enter the address please"); frmvalidator.addValidation("Address2","maxlen=100"); frmvalidator.addValidation("Country","dontselect=000"); frmvalidator.addValidation("State","dontselect=000"); frmvalidator.addValidation("City","alpha","req","Please insert your City"); frmvalidator.addValidation("Zip","req","numeric"); frmvalidator.addValidation("SourceLanguage","req","Please insert the Source Language"); frmvalidator.addValidation("TargetLanguage","req","Please insert the Target Language"); /*var chktestValidator = new Validator("bidrequest"); chktestValidator.EnableOnPageErrorDisplaySingleBox(); chktestValidator.EnableMsgsTogether(); chktestValidator.addValidation("NewProject","selectradio","Is this a new project? Plese select the one'"); chktestValidator.addValidation("Revision","selectradio","Is this a Revsion? Plese select the one'"); chktestValidator.addValidation("Glossary","selectradio","Any Glossary Development? Please select one'");*/ } } </script> </head> I found the gen_validatorv4.js file online. One more thing, if I un-commnet the radio buttons validations the whole validation stop working...weird. I appreciate any help. Best, Manu HI All, I'm trying to create a web form that asks for username and password. What im using as validation is http codes. If users inputs correct credentials it will generate a 200 -ok if password is incorrect it will generate a 400 http error. My script is below which i admit is quite rough. but i wish to be pointed in the direction. I want to accomplish the following: If on form submit http is 200 redirect to specified URL. if http 400 i want to add a warning message "Invalid Password, try again" or something like that. ANy help, please. Thanks. --------------------------------------------------------------------- [code] function checkUrl(form1) { var username = form1.username.value; var password = form1.password.value; var url = "https://some url" ; var data = "<cwaRequests xmlns=http://schemas.microsoft.com/2006/09/rtc/cwa>...</cwaRequests>" ; var httpRequest = new XMLHttpRequest(); var isAsync = true; httpRequest.open("POST", url, isAsync); httpRequest.setRequestHeader("Accept", "*/*"); httpRequest.setRequestHeader("UserAgent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50215)"); httpRequest.setRequestHeader("ContentType", "application/x-www-form-urlencoded"); httpRequest.setRequestHeader("Timeout", 1000*60); httpRequest.setRequestHeader("CWA-Ticket", this.authTicket); httpRequest.onreadystatechange = ReadyStateChanged; httpRequest.send(data); function ReadyStateChanged() { if (httpRequest.readyState == 4) { if (httpRequest.Status == 200) { window.location = url var responseText = httpRequest.ResponseText; } else { alert (Password incorrect, Please try again; } } } } [code] |