JavaScript 调用SOAP
一直想直接用JavaScrip调用Xurrency.com 的 SOAP,实现汇率的AJAX,找到个JavaScript SOAP Client做了测试。本机上IE,Chrome成功返回,firefox与在host上报错,"access to restricted URI DENIED"不知其所以然。
决定放弃。改用php soapclient+jquery ajax实现。
JavaScript SOAP Client测试代码如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | < !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title>XHTML-document</title> <script type="text/javascript" src="soapclient.js"></script> <script type="text/javascript"> function currency (){ var url = "http://xurrency.com/servidor_soap.php"; var pl = new SOAPClientParameters(); pl.add("amount", 5); pl.add("base", "usd"); pl.add("target", "eur"); SOAPClient.invoke(url, "getValue", pl, true, Currency_callBack); } function Currency_callBack(r){ alert(r); } </script> </head> <body> <form action=""> <input type=button value="Invoke" onclick="currency();" /> </form> </body> </html> |











































