cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache CXF Documentation > JavaScript Client Samples
Date Wed, 16 Jan 2013 14:29:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/2042/9/1/_/styles/combined.css?spaceKey=CXF20DOC&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/CXF20DOC/JavaScript+Client+Samples">JavaScript
Client Samples</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~coheigea@apache.org">Colm
O hEigeartaigh</a>
    </h4>
        <br/>
                         <h4>Changes (1)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-changed-lines" >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 <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">the</span>
flavor of an HTML page invoking a web service via the CXF JavaScript client generator. <br></td></tr>
            <tr><td class="diff-unchanged" > <br>{code:html} <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <p>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.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-html">
<span class="code-tag"><span class="code-comment">&lt;!-- Generate and retrieve
a JavaScript client for the server. --&gt;</span></span>
<span class="code-tag">&lt;script type=<span class="code-quote">"text/javascript"</span>
src=<span class="code-quote">"/SoapContext/SoapPort?js"</span>&gt;</span><span
class="code-tag">&lt;/script&gt;</span>
<span class="code-tag">&lt;script type=<span class="code-quote">"text/javascript"</span>&gt;</span>
<span class="code-tag"><span class="code-comment">&lt;!-- create an object
that talks to the Greeter service. --&gt;</span></span>
var Greeter = new apache_org_hello_world_soap_http_Greeter();
<span class="code-tag"><span class="code-comment">&lt;!-- set the URL for
the service. No cross-scripting allowed. --&gt;</span></span>
Greeter.url = <span class="code-quote">"/SoapContext/SoapPort"</span>;

var responseSpan;

<span class="code-tag"><span class="code-comment">&lt;!-- This is the function
called upon success. --&gt;</span></span>
function sayHiResponse(response)
{
    responseSpan.firstChild.nodeValue = response.getResponseType();
}

<span class="code-tag"><span class="code-comment">&lt;!-- This is the function
called for an error. --&gt;</span></span>
function sayHiError(error)
{
      alert('error ' + error);
}

<span class="code-tag"><span class="code-comment">&lt;!-- This function is
invoked from the button press to run the service. --&gt;</span></span>
function invokeSayHi()
{
    responseSpan = document.getElementById('sayHiResponse');
    responseSpan.firstChild.nodeValue = <span class="code-quote">" - pending - "</span>;
    Greeter.sayHi(sayHiResponse, sayHiError);
}
<span class="code-tag">&lt;/script&gt;</span>
<span class="code-tag">&lt;/head&gt;</span>
<span class="code-tag">&lt;body&gt;</span>
<span class="code-tag">&lt;h1&gt;</span>
Hello World Sample
<span class="code-tag">&lt;/h1&gt;</span>
<span class="code-tag">&lt;form&gt;</span>
<span class="code-tag">&lt;div&gt;</span>
        <span class="code-tag">&lt;table&gt;</span>
          <span class="code-tag">&lt;tr&gt;</span>
            <span class="code-tag">&lt;td&gt;</span>Run sayHi<span
class="code-tag">&lt;/td&gt;</span>
            <span class="code-tag">&lt;td&gt;</span>&lt;input type=<span
class="code-quote">"button"</span>
                       value=<span class="code-quote">"invoke"</span> name=<span
class="code-quote">"sayHi"</span>
                       onClick=<span class="code-quote">"invokeSayHi()"</span>&gt;
          <span class="code-tag">&lt;/tr&gt;</span>
          <span class="code-tag">&lt;tr&gt;</span>
            <span class="code-tag">&lt;td&gt;</span>sayHi response<span
class="code-tag">&lt;/td&gt;</span>
            <span class="code-tag">&lt;td&gt;</span><span class="code-tag">&lt;span
id='sayHiResponse'&gt;</span>- not yet invoked -<span class="code-tag">&lt;/span&gt;</span><span
class="code-tag">&lt;/td&gt;</span>
          <span class="code-tag">&lt;/tr&gt;</span>
        <span class="code-tag">&lt;/table&gt;</span>
<span class="code-tag">&lt;/div&gt;</span>
<span class="code-tag">&lt;/form&gt;</span>
<span class="code-tag">&lt;/body&gt;</span>
<span class="code-tag">&lt;/html&gt;</span>



</pre>
</div></div>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/CXF20DOC/JavaScript+Client+Samples">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=72746&revisedVersion=3&originalVersion=2">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/CXF20DOC/JavaScript+Client+Samples?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message