Search code examples
jsonibm-mobilefirstworklight-adapters

IBM Worklight 6.0 - FWLSE0099E: An error occurred while invoking procedure


I'm studying the worklight (6.0) tutorial (Insurance App) and in the chapter "Lab6_Integrate_With_Worklight_Apdaters_Part1_HTTPAdapter.pdf" I am instructed on how to create a procedure and invoke it. getting the json file strait from the worklight console URL works fine but when I build the procedure according to the tutorial I cant get the json file (in the "Invoke worklight procedure"), and receive an error:

[ERROR   ] FWLSE0099E: An error occurred while invoking procedure  [project InsuranceProj]CustomerDataAdapter/HttpRequestFWLSE0100E:  parameters: [project InsuranceProj]{    "arr": [
      {
         "method": "get",
         "path": "\/apps\/services\/www\/Insurance\/mobilewebapp\/default\/json\/Customer.json",
         "returnedContentType": "json"
      }    ] } Failed to parse JSON string <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta content="en-us" name="DC.Language" />......    "

I am doing the exact steps in the tutorial and can't find out what's wrong.... I cant find any solution for this problem, Hope to get some answers here

XML file:

    <?xml version="1.0" encoding="UTF-8"?>
<!--
    Licensed Materials - Property of IBM
    5725-G92 (C) Copyright IBM Corp. 2011, 2013. All Rights Reserved.
    US Government Users Restricted Rights - Use, duplication or
    disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
-->
<wl:adapter name="CustomerDataAdapter"
    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>CustomerDataAdapter</displayName>
    <description>CustomerDataAdapter</description>
    <connectivity>
        <connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
            <protocol>http</protocol>
            <domain>localhost</domain>
            <port>10080</port>  
            <!-- Following properties used by adapter's key manager for choosing specific certificate from key store  
            <sslCertificateAlias></sslCertificateAlias> 
            <sslCertificatePassword></sslCertificatePassword>
            -->
        </connectionPolicy>
        <loadConstraints maxConcurrentConnectionsPerNode="2" />
    </connectivity>

    <procedure name="getCustomerData">
        <displayName>GetCustomerData</displayName>
    </procedure>


</wl:adapter>

implementation file:

 function getCustomerData() {
    WL.Logger.debug("CustomerDataAdapter.getCustomerData procedure invoked");
    var input = {
            //headers : 'Content-Type: application/json',
            method : 'get',
            returnedContentType : 'json',
            path : "/apps/services/www/Insurance/mobilewebapp/default/json/Customer.json"
        };

        return WL.Server.invokeHttp(input);

}

Solution

  • Your adapter is trying to get the JSON from

    http://localhost:10080/apps/services/www/Insurance/mobilewebapp/default/json/Customer.json
    

    Which is a reference back into your project (a fairly strange thing to do, but I guess in a lab …)

    In any case, your path is missing an element. It should be:

    path : "/Insurance/apps/services/www/Insurance/mobilewebapp/default/json/Customer.json"