cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1723
Views
0
Helpful
1
Replies

Web Service sample errors with 'finesse' is undefined

David Pendleton
Level 1
Level 1

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);

---

1 Accepted Solution

Accepted Solutions

David Pendleton
Level 1
Level 1

The problems I described with the Web Service sample gadget occurred using IE 9.

When I used another client PC with IE 11, the Web Service sample gadget began working correctly. Data "Jane Doe 123456" was retrieved from the HelloWorld.xml file.

On the new PC, even with IE's emulation mode set to v9, the gadget still works.

The answer to question I had about whether a full path is required to the CSS and JS files is that full path is not required - at least on Finesse 10.5(1).

Hosting the Web Service gadget on a third party web server and with Finesse 10.5(1), the gadget works without adding paths to the component file names.

The CDATA section of the working WebService.xml:

<![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>

Apparently, Finesse used the path information in the gadget declaration in the Team Layout :

<gadget>http://172.28.36.58/WebService2/WebService2.xml</gadget>

I can see in the browser debugger that the path to the component files on the 3rd party server are automatically prefixed to each of the component file names at run time:

<body dir="ltr"><script src="//17x.xxx.xxx.x6:8443/gadgets/concat?container=default&amp;gadget=http%3A%2F%2F17x.xxx.xxx.x8%2FWebService2%2FWebService2.xml&amp;debug=0&amp;nocache=0&amp;type=js&amp;1=http%3A%2F%2F17x.xxx.xxx.x8%2FWebService2%2Fjquery-1.9.1.min.js&amp;2=http%3A%2F%2F17x.xxx.xxx.x8%2FWebService2%2Ffinesse-10.5.1.js&amp;3=http%3A%2F%2F17x.xxx.xxx.x8%2FWebService2%2FWebService_10.5.1.js" type="text/javascript"></script>

From what I've read, this prefixing of the path to the component file names is not performed starting in version 10.6 of Finesse. See the instructions for converting 10.5 gadgets to 10.6 or later here: https://communities.cisco.com/community/developer/finesse/blog/2016/03/16/how-to-convert-your-existing-1051-custom-gadget-to-work-with-1061-or-1101

View solution in original post

1 Reply 1

David Pendleton
Level 1
Level 1

The problems I described with the Web Service sample gadget occurred using IE 9.

When I used another client PC with IE 11, the Web Service sample gadget began working correctly. Data "Jane Doe 123456" was retrieved from the HelloWorld.xml file.

On the new PC, even with IE's emulation mode set to v9, the gadget still works.

The answer to question I had about whether a full path is required to the CSS and JS files is that full path is not required - at least on Finesse 10.5(1).

Hosting the Web Service gadget on a third party web server and with Finesse 10.5(1), the gadget works without adding paths to the component file names.

The CDATA section of the working WebService.xml:

<![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>

Apparently, Finesse used the path information in the gadget declaration in the Team Layout :

<gadget>http://172.28.36.58/WebService2/WebService2.xml</gadget>

I can see in the browser debugger that the path to the component files on the 3rd party server are automatically prefixed to each of the component file names at run time:

<body dir="ltr"><script src="//17x.xxx.xxx.x6:8443/gadgets/concat?container=default&amp;gadget=http%3A%2F%2F17x.xxx.xxx.x8%2FWebService2%2FWebService2.xml&amp;debug=0&amp;nocache=0&amp;type=js&amp;1=http%3A%2F%2F17x.xxx.xxx.x8%2FWebService2%2Fjquery-1.9.1.min.js&amp;2=http%3A%2F%2F17x.xxx.xxx.x8%2FWebService2%2Ffinesse-10.5.1.js&amp;3=http%3A%2F%2F17x.xxx.xxx.x8%2FWebService2%2FWebService_10.5.1.js" type="text/javascript"></script>

From what I've read, this prefixing of the path to the component file names is not performed starting in version 10.6 of Finesse. See the instructions for converting 10.5 gadgets to 10.6 or later here: https://communities.cisco.com/community/developer/finesse/blog/2016/03/16/how-to-convert-your-existing-1051-custom-gadget-to-work-with-1061-or-1101