Java
  Home arrow Java arrow Page 5 - JSP Consumer for a Visual Studio Created W...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVA

JSP Consumer for a Visual Studio Created Web Service Using Sun Java Studio Creator
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2006-10-03

    Table of Contents:
  • JSP Consumer for a Visual Studio Created Web Service Using Sun Java Studio Creator
  • Test the Web Service In-situ
  • Creating the JSP Client with Java Studio Creator 2
  • Referencing the Web Service in Java Studio Creator 2
  • JSP Client Returning Result from the Web Service
  • The Completed Java Code

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    JSP Consumer for a Visual Studio Created Web Service Using Sun Java Studio Creator - JSP Client Returning Result from the Web Service


    (Page 5 of 6 )

    In this section you will add a few standard controls to the JSP. You will also drag and drop the web service component whose return value will be displayed by the JSP, and write the necessary code to bind the returned value to the controls. When you drag and drop components the Java code gets modified to reflect the components added, so that in the code you will have access to the methods, properties and events.

    Add standard controls

    Bring up the TestHello.jsp page in the design mode. From the Palette add a Button and a TextBox as shown.

    Drag and drop the Web Service Component

    From the Web Services node in the Servers window drag and drop the  the service called Service (this is why you need to change default names). Service has two methods, HelloWorld() and Curtime(), both returning a string value. With this the Java code changes to reflect these additional objects. This also changes the JSP page content, as shown by the following window, by adding the serviceClient1 object.

    Write code to the button's click action

    When you click the button, the Java page opens, allowing you to enter your code to the button1_action(). Java Studio Creator makes it very easy to insert exception handling code by providing a canned snippet which can be accessed from the window named Code Clips shown in the next picture.  You can drag and drop the code onto the tabbed page Java at the point where you want to insert the snippet.

    Now inside the try block you will be writing the code to bind the textbox's textField1 (similar to the text property of a textbox in Microsoft) by calling the setValue() method.  This value is the one returned by the service's Curtime() method (which happens to be a string) as shown in the next paragraph.

    try {
    textField1.setValue (serviceClient1.curtime());
    } catch (Exception ex) {
    log ("Error occurred", ex);
    } 

    You do get coding help displaying methods and properties after you choose an object as shown in the next window, but it does take a finite amount of time and is not instantaneous (have patience).

    More Java Articles
    More By Jayaram Krishnaswamy


       · The last time I did not succeed, thanks to the refurbished, enhanced, Java Studio...
     

    JAVA ARTICLES

    - Deploying Multiple Java Applets as One
    - Deploying Java Applets
    - Understanding Deployment Frameworks
    - Database Programming in Java Using JDBC
    - Extension Interfaces and SAX
    - Entities, Handlers and SAX
    - Advanced SAX
    - Conversions and Java Print Streams
    - Formatters and Java Print Streams
    - Java Print Streams
    - Wildcards, Arrays, and Generics in Java
    - Wildcards and Generic Methods in Java
    - Finishing the Project: Java Web Development ...
    - Generics and Limitations in Java
    - Getting Started with Java Web Development in...







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek