team, me how method name out of soap response server using javascript/jquery. note method name not fixed one. varies each notification server. accordingly have call method @ client side. don't want use library other jquery.
eg)
<soap-env:envelope soap-env:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"> <soap-env:header></soap-env:header> <soap-env:body> <m:activatedforresponse xmlns:m="http://schemas.velu.com"> <resultcode>0</resultcode> </m:activatedforresponse> </soap-env:body> </soap-env:envelope>
question-2
tried below if know method name (title). in real case don't know method name. , not working if replace "tittle" "m:tittle"? wrong here?
var xml = "<rss><channel><title>mytitle</title></channel></rss>", xmldoc = $.parsexml( xml ), $xml = $( xmldoc ), $title = $xml.find( "title" ); // please note don't want text; // want load "title" element when declared "m:title" in xml. alert($title.text());
solution
function test(){ xml=loadxmltext("config.xml"); var $xmldoc = $(xml), $bodynode = $xmldoc .find("soap-env\\:body"); $bodynode.each(function(){ //iterate mutiple body in different envelope $(this).children().each(function(){ //iterate mutiple remote methods inside body alert($(this).get(0).tagname); // remote method name $(this).children().each(function(){ alert($(this).prop("tagname")); //attribute name alert($(this).text()); //attribute value }); }); }); }
i did this:
http://jsfiddle.net/mattydsw/bsrtr/
var $xml = $("<rss><channel><m:title>mytitle</m:title></channel></rss>"), $title = $xml.find("m\\:title");
tested on chrome, ie , ff.
edit
var xml = "<rss><channel><title>mytitle</title></channel></rss>", $xml = $( xml ), $title = $xml.find( "title" ); alert($title.text());
Comments
Post a Comment