So far, there is one sample in the distribution. This sample, called js_browser_client_simple, provides an HTML user interface to the tiny hello_world service also present in the wsdl_first sample. The HTML page for the sample is here. This gives a flavor of an HTML page invoking a web service via the CXF JavaScript client generator.
<!-- Generate and retrieve a JavaScript client for the server. -->
<script type="text/javascript" src="/SoapContext/SoapPort?js"></script>
<script type="text/javascript">
<!-- create an object that talks to the Greeter service. -->
var Greeter = new apache_org_hello_world_soap_http_Greeter();
<!-- set the URL for the service. No cross-scripting allowed. -->
Greeter.url = "/SoapContext/SoapPort";
var responseSpan;
<!-- This is the function called upon success. -->
function sayHiResponse(response)
{
responseSpan.firstChild.nodeValue = response.getResponseType();
}
<!-- This is the function called for an error. -->
function sayHiError(error)
{
alert('error ' + error);
}
<!-- This function is invoked from the button press to run the service. -->
function invokeSayHi()
{
responseSpan = document.getElementById('sayHiResponse');
responseSpan.firstChild.nodeValue = " - pending - ";
Greeter.sayHi(sayHiResponse, sayHiError);
}
</script>
</head>
<body>
<h1>
Hello World Sample
</h1>
<form>
<div>
<table>
<tr>
<td>Run sayHi</td>
<td><input type="button"
value="invoke" name="sayHi"
onClick="invokeSayHi()">
</tr>
<tr>
<td>sayHi response</td>
<td><span id='sayHiResponse'>- not yet invoked -</span></td>
</tr>
</table>
</div>
</form>
</body>
</html>