AnsweredAssumed Answered

Web Service sample errors with 'finesse' is undefined

Question asked by david.pendleton on Jan 14, 2017
Latest reply on Jan 15, 2017 by david.pendleton

I'm working with the Web Service Sample Gadget for Finesse 10.5(1).

 

When I reference the WebService.xml in a layout, It does not display the data from HelloWorld.xml.  IE's shows the error "finesse" is undefined.

 

I have tried many revisions, and have been careful to clear caches, but I can't get this sample to work in the Finesse desktop.

I can get this gadget to work outside of the desktop by referencing it with the 'ifr' syntax on the url

Interestingly, if I comment out the WebService....js reference in the WebService.xml to keep it from loading, the "finesse is undefined" error is replaced with "SampleGadget is undefined" which is referenced in the button's "onclick" event.  This second error implies that finesse is instantiated if the WebService's script is not loaded. 

 

I would really appreciate some suggestions on how to get this sample working.  It is a mature sample, so I'm assuming that I've configured something incorrectly.

 

I'm also really curious about whether paths are needed to the js, css files referenced in the WebService.xml.  I've read that in Finesse 10.6 or later you must include full paths when the gadget files are on a third party web server (as I have done), but I'm not seeing same advice for Finesse 10.5(1)

 

My Setup:

The  Web Service gadget is referenced in the team desktop layout like this:

<tab>

<id>testAgent</id>

<label>testAgent</label>

<gadgets>

<gadget>http://17x.xxx.xxx.8/WebService2/WebService.xml</gadget>

</gadgets>

</tab>

 

All of the Web Service sample files are in a single folder (/WebService2) on a web server.

The sample gadget files are:

     finesse-10.5.1.js

     HelloWorld.xml

     jquery-1.9.1.min.js

     WebService.css

     WebService.xml

     WebService-10.5.1js

 

I changed the underscore "_" to "-" in the webservice javascript name - this rename didn't help.

Except for renaming the javascript file, the WebService.xml is as supplied.  Here is the Content portion which references the css and js components of the sample:

<Content type="html">

<![CDATA[

    <!DOCTYPE html>

    <!-- Styling -->

    <link rel="stylesheet" href="WebService.css" type="text/css" />

 

    <!-- jQuery 1.5 -->

    <script type="text/javascript" src="jquery-1.9.1.min.js"></script>

  

    <!-- Finesse Library -->

    <script type="text/javascript" src="finesse-10.5.1.js"></script>

 

    <!-- Gadget Business Logic -->

    <script type="text/javascript" src="WebService-10.5.1.js"></script>

 

    <body>

 

    <!-- sample gadget -->

     <div>

        <br>  

        <fieldset id="hubfieldset">

        <legend>WebService</legend>

            <button onClick="finesse.modules.SampleGadget.makeWebService();">Make Request</button>

            <div>Text: <span id="result"></div>

        </fieldset>

   </div>

    </body>

 

    <script type="text/javascript">

    gadgets.HubSettings.onConnect = function () {

        finesse.modules.SampleGadget.init();

    };

    </script>

]]>

</Content>

 

In the javascript file, I made the following edits as instructed:

...

// TODO: change Rest path to match your own web server

 

        this.myrestRequest("/WebService2/HelloWorld.xml", {

            method: 'GET',

...

// TODO: Change the IP address to your server

  

            gadgets.io.makeRequest(encodeURI("http://17x.xxx.xxx.x8") + url, handler, params);

---

Outcomes