The service you have deployed can be accessed by client programs as well as browsers that support cross-origin resource sharing. In this segment of the tutorial, you attempt to access the service using such a browser for the purpose of observing the results.
We provide a test script, bookAJAXtest.html, that contains an AJAX request. You run this script in a browser that supports CORS.
Nothing happens!
In fact, this is the expected result. The reason nothing happened is that your service interface's Allowed Origin field is empty, preventing the service from recognizing that your AJAX request is originating from an allowed source. The request and response are still being sent, but your browser is preventing you from seeing the response.
In the next segment, you correct this problem.
You need to reconfigure the AccessBooks Web service interface to enable it to accept an AJAX request from any origin, and then redeploy it to your enterprise server instance. To prepare the ESCORS enterprise server instance to accept the redeployed service interface, you need to delete the previously deployed service.
The Output window shows the progression of the deployment process.
Now that your service interface has once again been deployed as a Web service running on the ESCORS enterprise server instance, you can look at the details of the deployed service via Enterprise Server Administration.
In the row showing your service, AccessBooks, notice that the Current Status column shows all four operations as Available. This means that the service is ready to be accessed by a client. In addition, you should see that the Custom Configuration column for these operations now includes the following text:
[response headers] Access-Control-Allow-Credentials=false Access-Control-Allow-Origin=*
This indicates that your service is ready to be called by AJAX scripts.
Now that you have reconfigured and redeployed the AccessBooks Web service, try running that HTML script again.
The following text should appear below the Submit button:
Result: { "lnk_file_status" : "00", "lnk_b_text_details" : { "lnk_b_title" : "LORD OF THE RINGS", "lnk_b_type" : "FANTASY", "lnk_b_author" : "TOLKIEN" }, "lnk_b_stockno" : "1111", "lnk_b_retail" : 15, "lnk_b_onhand" : 4000, "lnk_b_sold" : 3444 }
The following text should appear below the Submit button:
Result: { "lnk_file_status" : "00", "lnk_b_text_details" : { "lnk_b_title" : "OLIVER TWIST", "lnk_b_type" : "FICTION", "lnk_b_author" : "DICKENS" }, "lnk_b_stockno" : "2222", "lnk_b_retail" : 10, "lnk_b_onhand" : 3000, "lnk_b_sold" : 2333 }
This concludes the tutorial.