ibm mobilefirst - Not able to login into Maximo Anywhere (work execution app) after adding new VIEW in app.xml -


i trying customize work execution app adding new view of maximo object (sr). had completed oslc integration steps mentioned ibm http://www-01.ibm.com/support/knowledgecenter/sspjlc_7.5.1/com.ibm.si.mpl.doc_7.5.1/integration/t_ctr_int_mam.html?lang=en after changed app.xml , added view definition as

<view id="sr.srview" label="service request">         <requiredresources>             <requiredresource name="servicerequest">                 <requiredattribute name="description" />             </requiredresource>         </requiredresources>         <list resource="servicerequest" attribute="description">             <sortoptions>                 <sortoption label="item">                     <sortattribute name="description" direction="asc" />                 </sortoption>             </sortoptions>             <listitemtemplate layout="plannedmateriallistitem">                 <listtext resourceattribute="description" layoutinsertat="item1" />             </listitemtemplate>         </list>     </view> 

and resource as

<resource providedby="/oslc/sp/servicerequest"         describedby="http://jazz.net/ns/ism/sr/smarter_physical_infrastructure#servicerequest"         name="servicerequest" pagesize="20">         <attributes>             <attribute name="description" describedbyproperty="dcterms:description" />         </attributes>     </resource> 

after building application when preview in worklight studio getting below error

[warning ] authentication error: unable respond of these challenges: {} [error   ] fwlse0099e: error occurred while invoking procedure  [project anywhereworkmanager]oslcgenericadapter/httprequestfwlse0100e:  parameters: [project anywhereworkmanager] failed parse json string <h1>srve0255e: webgroup/virtual host handle /maximoundefined has not been defined.</h1><br><h3>srve0255e: webgroup/virtual host handle maxpc:9080 has not been defined.</h3><br><i>ibm websphere application server</i> fwlse0101e: caused by:  [project anywhereworkmanager]java.io.ioexception: unexpected character '<' on line 1, column 1java.lang.runtimeexception: failed parse json string <h1>srve0255e: webgroup/virtual host handle /maximoundefined has not been defined.</h1><br><h3>srve0255e: webgroup/virtual host handle maxpc:9080 has not been defined.</h3><br><i>ibm websphere application server</i>     @ com.worklight.adapters.http.http.getresponseasscriptable(http.java:379)     @ com.worklight.adapters.http.http.parseresponsecontent(http.java:316)     @ com.worklight.adapters.http.http.execrequest(http.java:173)     @ com.worklight.adapters.http.http.invoke(http.java:133)     @ com.worklight.integration.model.procedureinvoker.invokeprocedure(procedureinvoker.java:57)     @ com.worklight.integration.model.procedure.invoke(procedure.java:166)     @ com.worklight.integration.model.invocationcontext.call(invocationcontext.java:169)     @ com.worklight.integration.model.invocationcontext.call(invocationcontext.java:38)     @ java.util.concurrent.futuretask$sync.innerrun(unknown source)     @ java.util.concurrent.futuretask.run(unknown source)     @ com.worklight.integration.model.invocationcontext$directexecutorservice.execute(invocationcontext.java:284)     @ java.util.concurrent.abstractexecutorservice.submit(unknown source)     @ com.worklight.integration.model.invocationcontext.submit(invocationcontext.java:138)     @ com.worklight.integration.model.invocationcontextmanager.submitinvocation(invocationcontextmanager.java:58)     @ com.worklight.integration.services.impl.dataaccessserviceimpl.callprocedure(dataaccessserviceimpl.java:497)     @ com.worklight.integration.services.impl.dataaccessserviceimpl.access$100(dataaccessserviceimpl.java:56)     @ com.worklight.integration.services.impl.dataaccessserviceimpl$4.execute(dataaccessserviceimpl.java:392)     @ com.worklight.core.auth.impl.authenticationservicebean.accessresource(authenticationservicebean.java:76)     @ com.worklight.integration.services.impl.dataaccessserviceimpl.invokeprocedureinternal(dataaccessserviceimpl.java:389)     @ com.worklight.integration.services.impl.dataaccessserviceimpl.invokedynamicprocedure(dataaccessserviceimpl.java:456)     @ com.worklight.integration.services.impl.dataaccessserviceimpl.invokedynamicprocedurewithenclosingprocedureproperties(dataaccessserviceimpl.java:440)     @ com.worklight.integration.js.javascriptintegrationlibraryimplementation.invokedynamicprocedurewithenclosingprocedureproperties(javascriptintegrationlibraryimplementation.java:136)     @ sun.reflect.generatedmethodaccessor33.invoke(unknown source)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source)     @ java.lang.reflect.method.invoke(unknown source)     @ org.mozilla.javascript.memberbox.invoke(memberbox.java:126)     @ org.mozilla.javascript.nativejavamethod.call(nativejavamethod.java:225)     @ org.mozilla.javascript.optimizer.optruntime.calln(optruntime.java:52)     @ org.mozilla.javascript.gen._integration_js_1._c_anonymous_10(/integration.js:95)     @ org.mozilla.javascript.gen._integration_js_1.call(/integration.js)     @ org.mozilla.javascript.optimizer.optruntime.call1(optruntime.java:32)     @ org.mozilla.javascript.gen.c_3a_5cnewworklight_kep_sr_5canywhereworkmanager_5cadapters_5coslcgenericadapter_oslcgenericadapter_impl_js_4._c_anonymous_2(c%3a%5cnewworklight-kep-sr%5canywhereworkmanager%5cadapters%5coslcgenericadapter/oslcgenericadapter-impl.js:7)     @ org.mozilla.javascript.gen.c_3a_5cnewworklight_kep_sr_5canywhereworkmanager_5cadapters_5coslcgenericadapter_oslcgenericadapter_impl_js_4.call(c%3a%5cnewworklight-kep-sr%5canywhereworkmanager%5cadapters%5coslcgenericadapter/oslcgenericadapter-impl.js)     @ org.mozilla.javascript.javaadapter.docall(javaadapter.java:603)     @ org.mozilla.javascript.javaadapter.callmethod(javaadapter.java:578)     @ adapter1.invokehttp(<adapter>)     @ com.ibm.tivoli.si.adapter.adapterdependenciesimpl.invokehttp(unknown source)     @ com.ibm.tivoli.si.adapter.oslcgenericadapter.queryimpl(unknown source)     @ com.ibm.tivoli.si.adapter.oslcgenericadapter.query(unknown source)     @ sun.reflect.generatedmethodaccessor32.invoke(unknown source)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source)     @ java.lang.reflect.method.invoke(unknown source)     @ org.mozilla.javascript.memberbox.invoke(memberbox.java:126)     @ org.mozilla.javascript.nativejavamethod.call(nativejavamethod.java:225)     @ org.mozilla.javascript.gen.c_3a_5cnewworklight_kep_sr_5canywhereworkmanager_5cadapters_5coslcgenericadapter_oslcgenericadapter_impl_js_4._c_query_10(c%3a%5cnewworklight-kep-sr%5canywhereworkmanager%5cadapters%5coslcgenericadapter/oslcgenericadapter-impl.js:183)     @ org.mozilla.javascript.gen.c_3a_5cnewworklight_kep_sr_5canywhereworkmanager_5cadapters_5coslcgenericadapter_oslcgenericadapter_impl_js_4.call(c%3a%5cnewworklight-kep-sr%5canywhereworkmanager%5cadapters%5coslcgenericadapter/oslcgenericadapter-impl.js)     @ org.mozilla.javascript.contextfactory.dotopcall(contextfactory.java:394)     @ org.mozilla.javascript.scriptruntime.dotopcall(scriptruntime.java:3091)     @ org.mozilla.javascript.gen.c_3a_5cnewworklight_kep_sr_5canywhereworkmanager_5cadapters_5coslcgenericadapter_oslcgenericadapter_impl_js_4.call(c%3a%5cnewworklight-kep-sr%5canywhereworkmanager%5cadapters%5coslcgenericadapter/oslcgenericadapter-impl.js)     @ com.worklight.integration.js.javascriptmanager.callfunction(javascriptmanager.java:240)     @ com.worklight.integration.js.javascriptmanager.invokefunction(javascriptmanager.java:214)     @ com.worklight.integration.js.javascriptmanager.invokefunction(javascriptmanager.java:194)     @ com.worklight.integration.services.impl.adaptermanagerimpl.invokefunction(adaptermanagerimpl.java:104)     @ com.worklight.integration.js.javascriptprocedureinvoker.invoke(javascriptprocedureinvoker.java:42)     @ com.worklight.integration.model.procedureinvoker.invokeprocedure(procedureinvoker.java:57)     @ com.worklight.integration.model.procedure.invoke(procedure.java:166)     @ com.worklight.integration.model.invocationcontext.call(invocationcontext.java:169)     @ com.worklight.integration.model.invocationcontext.call(invocationcontext.java:38)     @ java.util.concurrent.futuretask$sync.innerrun(unknown source)     @ java.util.concurrent.futuretask.run(unknown source)     @ java.util.concurrent.threadpoolexecutor.runworker(unknown source)     @ java.util.concurrent.threadpoolexecutor$worker.run(unknown source)     @ com.worklight.server.util.projectlocal$1runnablewrapper.run(projectlocal.java:267)     @ java.lang.thread.run(unknown source) caused by: java.io.ioexception: unexpected character '<' on line 1, column 1     @ com.ibm.json.java.internal.tokenizer.next(tokenizer.java:129)     @ com.ibm.json.java.internal.parser.parse(parser.java:57)     @ com.ibm.json.java.internal.parser.parse(parser.java:47)     @ com.ibm.json.java.jsonobject.parse(jsonobject.java:79)     @ com.ibm.json.java.jsonobject.parse(jsonobject.java:91)     @ com.worklight.adapters.http.http.getresponseasscriptable(http.java:376)     ... 63 more 

note able result below url in browser.

[http://maxpc:9080/maximo/oslc/os/oslcsrequest?_lid=maxadmin&_lpwd=maxadmin ]

i appreciate help.

adaptor code: (xml)

    <?xml version="1.0" encoding="utf-8" standalone="no"?>  <wl:adapter xmlns:wl="http://www.worklight.com/integration"      xmlns:http="http://www.worklight.com/integration/http"      xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"      name="oslcgenericadapter">      <displayname>oslcgenericadapter</displayname>     <description>oslcgenericadapter</description>     <connectivity>         <connectionpolicy xsi:type="http:httpconnectionpolicytype" cookiepolicy="ignore_cookies">             <protocol>http</protocol>             <domain>maxpc</domain>             <port>9080</port>                    </connectionpolicy>         <loadconstraints maxconcurrentconnectionspernode="120" />     </connectivity>      <procedure name="create" securitytest="customadapter-securitytest" />     <procedure name="deleteresource" securitytest="customadapter-securitytest"/>     <procedure name="get" securitytest="customadapter-securitytest"/>     <procedure name="getresource" securitytest="customadapter-securitytest"/>     <procedure name="query" securitytest="customadapter-securitytest" connectas="enduser" requesttimeoutinseconds="360"/>     <procedure name="insertresource" securitytest="customadapter-securitytest" connectas="enduser"/>     <procedure name="update"  securitytest="customadapter-securitytest"/>     <procedure name="updateresource" securitytest="customadapter-securitytest" connectas="enduser"/>     <!-- getproperties used before authentication, need keep unprotected -->     <procedure name="getproperties" securitytest="wl_unprotected" connectas="enduser"/>     <procedure name="login" securitytest="customadapter-securitytest" connectas="enduser"/>     <procedure name="logout" securitytest="customadapter-securitytest" connectas="enduser"/>     <procedure name="getactiveuseridentity" securitytest="customadapter-securitytest" connectas="enduser"/>     <procedure name="changepassword" securitytest="customadapter-securitytest" connectas="enduser"/>     <procedure name="nosessionchangepassword" securitytest="wl_unprotected" connectas="enduser"/>      <!-- when getsecuritydata called client, initiate security test see if authenticated? -->     <procedure name="getsecretdata" securitytest="customadapter-securitytest"/>     <!-- query2 temporary procedure testing authentication unique user data -->     <procedure name="query2" />      <!--         server datetime , register before/after requesting server's information.          used calibrating delta between server , device clocks         -->     <procedure name="getserverdate" securitytest="wl_unprotected" connectas="enduser"/>    </wl:adapter> 

adaptor impl

    var adapterdependenciesimpl = {     encodeuri : function(uri) {         return encodeuri(uri);     },     invokehttp : function(input) {         wl.logger.debug(json.stringify(input));         return wl.server.invokehttp(input);     },     debug : function(input) {         wl.logger.debug(input);     } };  var adapterdependencies = com.ibm.tivoli.si.adapter         .jsadapterdependencies(adapterdependenciesimpl); var adapterimpl = com.ibm.tivoli.si.adapter.oslcgenericadapter         .createoslcgenericadapter(adapterdependencies); /**  * wl.server.invokehttp(parameters) accepts following json object  * argument:  *  { // mandatory method : 'get' , 'post', 'delete' , 'put' or 'head' path:  * value,  *  // optional returnedcontenttype: known mime-type or 1 of "json",  * "css", "csv", "javascript", "plain", "xml", "html" returnedcontentencoding :  * 'encoding', parameters: {name1: value1, ... }, headers: {name1: value1, ... },  * cookies: {name1: value1, ... }, body: { contenttype: 'text/xml;  * charset=utf-8' or similar value, content: stringvalue }, transformation: {  * type: 'default', or 'xslfile', xslfile: filename } }  */  function login(user, pwd, langcode) {     var credentials = adapterimpl.base64encodecredentials(user, pwd);      path = getbasepath() + 'login';      var heardervalue = null;     if(langcode == null)     {         heardervalue= {             'maxauth' : credentials,             'accept' : 'application/json'         }     }     else     {         heardervalue= {             'maxauth' : credentials,             'accept' : 'application/json',             'accept-language' : langcode         }     };             var input = {         method : 'get',         returnedcontenttype : 'application/json',         path : path,         headers : heardervalue     };     try {         var response = wl.server.invokehttp(input);          if (response['statuscode'] == 200) {             var cookies = response['responseheaders']['set-cookie'];             if (!cookies) {                 throw "no jsessionid returned";             }             var jsessionid = cookies.split(';')[0].split('=')[1];             wl.logger.debug(jsessionid);             return {                 sessionid : jsessionid             };         }         wl.logger.debug(response);         return {             issuccessful : false,             errors : [ response["oslc:error"] ]         };     } catch (e) {         throw e;     } }  function logout(jsessionid) {     path = getbasepath() + 'logout';      var input = {         method : 'get',         returnedcontenttype : 'application/json',         path : path,         cookies : {             'jsessionid' : jsessionid         },         headers : {             'accept' : 'application/json',             'cookie' : 'jsessionid=' + jsessionid         }     };      try {         wl.server.invokehttp(input);      } catch (e) {         wl.logger.error(e);     }     return {         issuccessful : true     }; }  function getactiveuseridentity() {     return wl.server.getactiveuser(); }  function create(params) {     if (params == null) {         return {};     }      path = getbasepath();      var input = {         method : 'post',         returnedcontenttype : 'application/json',         path : path,         body : {             contenttype : 'json; charset=utf-8',             content : params.resource         },     };      return wl.server.invokehttp(input); }  function deleteresource(params) {     if (params == null) {         return '';     }     path = getbasepath();     path = path + '/' + params.id;      var input = {         method : 'delete',         returnedcontenttype : 'application/json',         path : path     };      return wl.server.invokehttp(input); }  function get(params) {     if (params == null) {         return {};     }      path = getbasepath();     path = path + '/' + params.id;      var input = {         method : 'get',         returnedcontenttype : 'application/json',         path : path     };      return wl.server.invokehttp(input); }  function query(params) {     var errors = [];     if (null == params) {         errors.push("no parameter present.");     } else {         if (null == params.url)             errors.push("must have url parameter.");     }     if (errors.length > 0) {         // required parameter not present         return resp = {             "issuccessful" : "false",             "errors" : errors         };     }     var response = adapterimpl.query(params);     if ("oslc:error" in response) {         return {             issuccessful : false,             errors : [ response["oslc:error"] ]         };     }     return response; }  function getresource(params) {     var errors = [];     if (null == params) {         errors.push("no parameter present.");     } else {         if (null == params.url)             errors.push("must have url parameter.");     }     if (errors.length > 0) {         // required parameter not present         return resp = {             "issuccessful" : "false",             "errors" : errors         };     }      var returnvalue = adapterimpl.getresource(params);     return returnvalue; }  function insertresource(params) {     var errors = [];     if (null == params) {         errors.push("no parameter present.");     } else {         if (null == params.url)             errors.push("must have url parameter.");         if (null == params.payload)             errors.push("must have payload parameter.");     }     if (errors.length > 0) {         // required parameter not present         return resp = {             "issuccessful" : false,             "errors" : errors         };     }     var response = adapterimpl.insertresource(params);     if ("oslc:error" in response) {         return {             issuccessful : false,             responseheaders: response.responseheaders,             errors : [ response["oslc:error"] ]         };     }     return response; } function updateresource(params) {     var errors = [];     if (null == params) {         errors.push("no parameter present.");     } else {         if (null == params.url)             errors.push("must have url parameter.");         if (null == params.payload)             errors.push("must have payload parameter.");     }     if (errors.length > 0) {         // required parameter not present         return {             "issuccessful" : "false",             "errors" : errors         };     }      var response = adapterimpl.updateresource(params);     if ("oslc:error" in response) {         return {             issuccessful : false,             responseheaders: response.responseheaders,             errors : [ response["oslc:error"] ]         };     }     return response; }  function nosessionchangepassword(params){     return  changepassword(params); }  function changepassword(params) {     var errors = [];     if (null == params) {         errors.push("no parameter . ");     }     if (errors.length > 0) {         // required parameter not present         return resp = {             "issuccessful" : "false",             "errors" : errors         };     }      var returnvalue = adapterimpl.changepassword(params);     return returnvalue; }  function update(params) {     if (params == null) {         return {};     }      path = getbasepath();     path = path + '/' + params.id;      var input = {         method : 'put',         returnedcontenttype : 'application/json',         path : path,         body : {             contenttype : 'json; charset=utf-8',             content : params.resource         },     };      return wl.server.invokehttp(input); }  function getproperties(params) {     var resp = {};     for(var index in params.propertynames){         var name = params.propertynames[index];         resp[name] = wl.server.configuration[name];     }     return {"properties" : resp}; }  function getbasepath() {     var si_platform_context=wl.server.configuration['si.platform.context'];      if (null == si_platform_context || '' == si_platform_context ) {         return 'maximo/oslc/';     }       //wl.logger.log("++++ worklight property [si.maximo.context]=[" + wl.server.configuration['si.maximo.context'] + "]");     return si_platform_context + '/oslc/'; }  /**  * procedures support query2  *   * @param params  * @returns  */ function geturlpath(params) {     var path = getbasepath();     path += "os/oslcwodetail/?oslc.pagesize=20&oslc.select="             + params.oslcselect;     return path; }  /**  * procedure support query2  *   * @returns {___anonymous4713_4741}  */ function getsecretdata() {     var activeuser = wl.server.getactiveuser();     var activeuserstring = json.stringify(activeuser);     wl.logger.debug("oslcadapter: secret data - current identity object ="             + activeuserstring);     return {         secretdata : '123456'     }; }  // ==================== authentication functions =======================//  /**  * todo: convert procedure java  *   * wl.logger.debug writes wl server message.log , console.log  *   */ function query2(params) {     if (null == params || null == params.resource || null == params.querybase             || null == params.oslcselect) {         return {};     }      wl.logger.debug("oslc adapter - query2 :: entering");      // attempting session token wl getactiveuser api     var activeuser = wl.server.getactiveuser();     var activeuserstring = json.stringify(activeuser);     var parsestring = json.parse(activeuserstring);     var activeusercookies = parsestring["attributes"]["jsessionid"];      var stringparams = json.stringify(params);      wl.logger.debug("oslc adapter: query2 - wl.server.getactiveuser  ["             + activeuserstring + "]");     wl.logger.debug("oslc adapter: query2 - activeusercookies        ["             + activeusercookies + "]");     wl.logger.debug("oslc adapter: query2 - input string             ["             + stringparams + "]");      // attempt session token client/device params     var parse2 = json.parse(stringparams);     var jsessionidobj = parse2["myjsessionidobj"];      // wl.logger.debug("oslc adapter: query2 - input string jsessionidobj [" +     // json.stringify(jsessionidobj) + "]");     var token = jsessionidobj.split("=")[1];     var cookie = {         "jsessionid" : token     };      wl.logger.debug("oslc adapter: query2 - send token  ["             + json.stringify(token) + "]");     wl.logger.debug("oslc adapter: query2 - send cookie ["             + json.stringify(cookie) + "]");      path = geturlpath(params);     path = encodeuri(path);      wl.logger.debug("oslc adapter: query2 - path =[" + path + "]");      var input = {         method : 'get',         returnedcontenttype : 'application/json',         path : path,         cookies : cookie     };      wl.logger.debug("oslc adapter: query2 - send maximo input ="             + json.stringify(input));      return wl.server.invokehttp(input); }   /**  * specific function ping server , date it. calculates  * network latency based on before/after datetime when requesting server  */ function getserverdate(params) {      wl.logger.debug("server clock synchronization::init");      path = getbasepath();      if (path.lastindexof('/') == path.length - 1) { // verify if last char                                                     // '/' , remove         path = path.substring(0, path.lastindexof("/"));     }      var input = {         method : 'get',         returnedcontenttype : 'application/json',         path : path,         //cookies : {         //  'jsessionid' : params.jsessionid         //},         headers : {             'accept' : 'application/json',             'cookie' : params.cookie         }     };      wl.logger.debug("server clock synchronization::path::" + path);      try {          var befinvoke = date.parse(new date().toutcstring());         var response = wl.server.invokehttp(input);         var aftinvoke = date.parse(new date().toutcstring());          if (response['statuscode'] == 200) {             var srvdate = response['responseheaders']['date'];              wl.logger.debug(srvdate);              return {                 beforeinvoke : befinvoke,                 afterinvoke : aftinvoke,                 serverdate : srvdate             };         }         wl.logger.debug(response);         return {             issuccessful : false,             errors : [ response["oslc:error"] ]         };     } catch (e) {         wl.logger.debug("server clock synchronization::error::" + e);         throw e;     } } 

you're missing querybase specifier resource. without information, can't determine url go to retrieve new sr objects.

it should under new resource section:

    <querybases>         <querybase name="getsr" queryuri="/oslc/os/<yournewosurl>"/>     </querybases>    

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -