0

I am trying to call javascript adapter procedure using WLResourceRequest. But it is not getting called.

Client Code Snippet:

var url = "/adapters/AdapterNew/getFeed";
var resourceRequest = new WLResourceRequest(url, WLResourceRequest.POST);
resourceRequest.send().then(app.onSuccess, app.onFailure);

Server Code Snippet:

function getFeed(tag) {
    var input = {
        method : 'get',
        returnedContentType : 'xml',
        path : getPath(tag)
    };
    return MFP.Server.invokeHttp(input);
}

It is not giving any error. Please let me know the issue.

Thanks.

S.A.Norton Stanley
  • 1,833
  • 3
  • 23
  • 37
deepak
  • 11
  • 5
  • What is the code in your onSuccess and onFailure functions ? Do either of them get called ? – Srik Apr 06 '17 at 04:24
  • What does your client side logs say? What about server side? – Vivin K Apr 06 '17 at 05:49
  • Hi, Only alert(“Msg”) added in onSuccess and onFailure methods. Neither onSuccess nor onFailure get called. I have followed steps as per https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/adapters/server-side-log-collection/javascript-adapter/ for enabling of server logs. Still I cannot see logs in Analytics Console. Thanks, – deepak Apr 06 '17 at 09:06
  • 1) Wait for 30 seconds to see if the call times out. 2) Check your MFP server logs - not Analytics console 3) Use Wireshark or tcpdump to see the network traffic – Vivin K Apr 06 '17 at 11:14
  • 1) It doesn't timeout. 2) I have checked server log at path ..\MobileFirst-8.0.0.0\mfp-server\usr\servers\mfp\logs\messages.txt To display server log, I have used code snippet that includes MFP.Logger.debug(): function getFeed(tag) { MFP.Logger.debug("This is a debug message"); var input = { method : 'get', returnedContentType : 'xml', path : getPath(tag) }; return MFP.Server.invokeHttp(input); } Here, messages.txt doesn't update as per MFP.Logger.debug() statement. It seems that getFeed(tag) method is not getting called. Please suggest solution. Thanks, – deepak Apr 06 '17 at 17:05
  • Following is the way I have created adapter in MobileFirst 8.0: - Created MobileFirst Cordova project using Eclipse Thym. - Created a new adapter using mfpdev and imported into same Eclipse workspace. - Preview Cordova project and deploy adapter to MobileFirst console. Both are separate independent project in eclipse. Please let me know if I have to enable some settings. Thanks, – deepak Apr 06 '17 at 17:08
  • Provide a recreate sample – Vivin K Apr 10 '17 at 10:07

1 Answers1

0

Please refer the discussion here.

MobileFirst Platform JavaScript adapter can't get the parameters through WLResourceRequest

Basically for javascript parameters are handled differently and the explanation given in the above should help here as well.

Community
  • 1
  • 1