the control going failure function when i'm trying invoke http adapter.here adapter running fine , i'm getting data also.
here html code
<html> <head> <meta charset="utf-8"> <title>iib_wl_app</title> <meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, minimum-scale=1.0, user-scalable=0"> <link rel="shortcut icon" href="images/favicon.png"> <link rel="apple-touch-icon" href="images/apple-touch-icon.png"> <link rel="stylesheet" href="css/iib_wl_app.css"> <script>window.$ = window.jquery = wljq;</script> </head> <body id="content" style="display: none;"> <form name="f1"> enter employee id :<input type="text" id="empid"> <br> <input type="submit" value="getdetails" onclick="getdetails()"> </form> <!--application ui goes here--> <script src="js/initoptions.js"></script> <script src="js/iib_wl_app.js"></script> <script src="js/messages.js"></script> </body> </html>
here .js code getting details
function getdetails(){ //alert("function called"); var id=f1.empid.value; //var id=document.getelementbyid("empid").value(); alert(id); var invocationdata = { adapter : 'iib_wl_adapter', procedure : 'getdata', parameters : [id] }; var options={ onsuccess : getdatasuccess, onfailure : getdatafailure, }; wl.client.invokeprocedure(invocationdata,options); }; function getdatasuccess(result) { //wl.logger.debug("retrieve success" + json.stringify(result)); alert("success"); var httpstatuscode = result.status; alert(httpstatuscode); } function getdatafailure(result) { //wl.logger.debug("retrieve success" + json.stringify(result)); alert("failure"); var httpstatuscode = result.status; alert(httpstatuscode); }
and want display data in list view
here adapter.xml
<?xml version="1.0" encoding="utf-8"?> <!-- licensed materials - property of ibm 5725-g92 (c) copyright ibm corp. 2011, 2013. rights reserved. government users restricted rights - use, duplication or disclosure restricted gsa adp schedule contract ibm corp. --> <wl:adapter name="iib_wl_adapter" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:wl="http://www.worklight.com/integration" xmlns:http="http://www.worklight.com/integration/http"> <displayname>iib_wl_adapter</displayname> <description>iib_wl_adapter</description> <connectivity> <connectionpolicy xsi:type="http:httpconnectionpolicytype"> <protocol>http</protocol> <domain>172.17.14.228</domain> <port>7080</port> <!-- following properties used adapter's key manager choosing specific certificate key store <sslcertificatealias> </sslcertificatealias> <sslcertificatepassword></sslcertificatepassword> --> </connectionpolicy> <loadconstraints maxconcurrentconnectionspernode="2" /> </connectivity> <procedure name="getdata" />
here adpater-impl.js
function getdata(interest) { //path = getpath(interest); var input = { method : 'get', path : '/dbretrive', returnedcontenttype : 'xml', parameters : {'id' : interest} }; return wl.server.invokehttp(input);
}
i got solution problem. problem in html page i.e instead of using this.
<input type="submit" value="getdetails" onclick="getdetails()">
use following tag button type working.
<input type="button" value="getdetails" onclick="return getdetails()">
and displaying data added code in .js file
function getdetails(){ var id=f1.empid.value; alert(id); var invocationdata = { adapter : 'iib_wl_adapter', procedure : 'getdata', parameters : [id] }; var options={ onsuccess : getdatasuccess, onfailure : getdatafailure, }; wl.client.invokeprocedure(invocationdata,options); }; function getdatasuccess(result) { display(result.invocationresult.employee.data); } function getdatafailure(result) { alert(json.stringify(result)); alert(result.errormsg); var httpstatuscode = result.status; } function display(items){ var ul=$("#itemlist"); ul=$("#itemlist").html(" "); var li=$('<li/>').html("id:"+items.id); li.append($('<li/>').html("name:"+items.name)); li.append($('<li/>').html("age:"+items.age)); ul.append(li); }
Comments
Post a Comment