1. Create a blank page then create a region.
2. Create two items (Like P46_URL and P46_RESPONSE) , One for inputting web service URL and another one is for getting response.
3. Copy-pest the below JavaScript function into page propertice> Function and Global Variable Declaration
function CALL_TO_WEBSERVICE(){
var urlvariable;
var ItemJSON;
var v_url = apex.item("P46_URL").getValue();
URL = v_url ;
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = callbackFunction(xmlhttp);
xmlhttp.open("GET", URL, false);
xmlhttp.onreadystatechange = callbackFunction(xmlhttp);
xmlhttp.send(ItemJSON);
$x("P46_RESPONSE").value = xmlhttp.responseText;
}
function callbackFunction(xmlhttp)
{
// alert(xmlhttp.responseXML);
}
4. Create a button and create a Dynamic Action on click event the button with Execute JavaScript Action. just call the function below.
CALL_TO_WEBSERVICE();
5. That's All. Now just put the Web Service URL into the URL item and click on the button.
No comments:
Post a Comment