[jboss-cvs] jboss-seam/examples/seambay/view ...

Shane Bryzak sbryzak at redhat.com
Sat Mar 24 01:38:10 EDT 2007


  User: sbryzak2
  Date: 07/03/24 01:38:10

  Modified:    examples/seambay/view    home.xhtml
  Added:       examples/seambay/view    test.js test.xhtml
  Log:
  added a web service test page
  
  Revision  Changes    Path
  1.2       +24 -0     jboss-seam/examples/seambay/view/home.xhtml
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: home.xhtml
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/seambay/view/home.xhtml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- home.xhtml	22 Mar 2007 15:02:47 -0000	1.1
  +++ home.xhtml	24 Mar 2007 05:38:10 -0000	1.2
  @@ -15,6 +15,30 @@
       <div class="container">
         <ui:include src="header.xhtml"/>  
        
  +      <div class="banner"></div>
  +     
  +      <div class="categories">
  +        <div class="sectionHeader">
  +          Categories
  +        </div>
  +        
  +        <ui:repeat value="#{categories}" var="cat">
  +          <a href="#">#{cat.name}</a>
  +        </ui:repeat>
  +                
  +      </div>
  +      
  +      <div id="content">
  +        <p>
  +          Welcome to <img src="img/seambay_inline.png" border="0"/>, an example Seam application that parodies a popular online auction site.
  +          This example demonstrates how Seam integrates with JBossWS.
  +        </p>
  +        
  +        <p>
  +          <span>You can access the web service test page </span>
  +          <s:link view="/test.seam" propagation="none">here</s:link>.
  +        </p>
  +      </div>
       </div>
     </body>
   </html>
  
  
  
  1.1      date: 2007/03/24 05:38:10;  author: sbryzak2;  state: Exp;jboss-seam/examples/seambay/view/test.js
  
  Index: test.js
  ===================================================================
  var webServices = {};
  
  ServiceMetadata = function(name)
  {
    this.name = name;
    this.parameters = {};
  
    webServices[name] = this;
  
    ServiceMetadata.prototype.setDescription = function(description) { this.description = description; };  
    ServiceMetadata.prototype.getDescription = function() { return this.description; };
    ServiceMetadata.prototype.addParameter = function(param) { this.parameters.push(param); };
    ServiceMetadata.prototype.setRequest = function(request) { this.request = request; };
    ServiceMetadata.prototype.getRequest = function() { return this.request; };
  }
  
  var svc = new ServiceMetadata("listCategories");
  svc.setDescription("List Categories");
  svc.setRequest("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" " +
                 "\n    xmlns:seam=\"http://seambay.example.seam.jboss.org/\">\n  <soapenv:Header/>" +
                 "\n  <soapenv:Body>\n    <seam:listCategories/>\n  </soapenv:Body>\n</soapenv:Envelope>");
  
  svc = new ServiceMetadata("listAuctions");
  svc.setDescription("List Auctions");
  
  
  
  function selectService(serviceName)
  {
    var svc = webServices[serviceName];
    
    if (!svc)
    {
      alert("Unknown service");
      return;
    }
    
    document.getElementById('selectedService').innerHTML = svc.getDescription();
    document.getElementById('serviceRequest').value = svc.getRequest();
  }
  
  function sendRequest()
  {
    var req;
    if (window.XMLHttpRequest)
    {
      req = new XMLHttpRequest();
      if (req.overrideMimeType)
        req.overrideMimeType("text/xml");
    }
    else
      req = new ActiveXObject("Microsoft.XMLHTTP");
      
    req.onreadystatechange = function() { receiveResponse(req); };
    req.open("POST", "/seam-bay-seam-bay/AuctionService", true);
    req.setRequestHeader("Content-type", "text/xml");
    req.send(document.getElementById("serviceRequest").value);
  }
  
  function receiveResponse(req)
  {
    if (req.readyState == 4)
    {
      if (req.responseText)
        document.getElementById("serviceResponse").value = req.responseText;
        
      if (req.status != 200)
      {
        alert("There was an error processing your request.  Error code: " + req.status);      
      }
    }  
  }
  
  
  1.1      date: 2007/03/24 05:38:10;  author: sbryzak2;  state: Exp;jboss-seam/examples/seambay/view/test.xhtml
  
  Index: test.xhtml
  ===================================================================
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:s="http://jboss.com/products/seam/taglib"
      xmlns:h="http://java.sun.com/jsf/html">
  
    <head>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
      <title>seamBay</title>
      <link href="style/test.css" rel="stylesheet" type="text/css"/> 
      <script type="text/javascript" src="test.js"/>   
    </head>
  
    <body>
      <h1>SeamBay Web Services - Test Page</h1>
    
      <div id="services">
        <span>Select a service to test</span>
        <a href="#" onclick="javascript:selectService('listCategories')">List Categories</a>
        <a href="#" onclick="javascript:selectService('listAuctions')">List Auctions</a>
      </div>
      
      <div id="detail">
        <div>
          Selected Web Service: <span id="selectedService">None</span>
        </div>
        
        <div>
          <h2>Parameters</h2>
          
          <div id="parameters">
            None
          </div>
          
          <button onclick="javascript:sendRequest()">Invoke service</button>
        </div>
             
        <div>
          <h2>Request</h2>
        
          <textarea id="serviceRequest"/>
        </div>
        
        <div>
          <h2>Response</h2>
          
          <textarea id="serviceResponse"/>
        </div>
      
      </div>
  
    </body>
  </html>
  
  



More information about the jboss-cvs-commits mailing list