Home arrow Java arrow Page 5 - JSP Consumer for a Visual Studio Created Web Service Using Sun Java Studio Creator
JAVA

JSP Consumer for a Visual Studio Created Web Service Using Sun Java Studio Creator


It isn't supposed to matter to a web service what platform or programming language it's dealing with. When Sun Java Studio Creator first appeared in beta two years ago, it apparently was not fully compatible with Visual Studio. Now that both languages have changed, it is possible to create a JSP web client in one of them for a simple web service created in the other. This article explains how.

Author Info:
By: Jayaram Krishnaswamy
Rating: 5 stars5 stars5 stars5 stars5 stars / 3
October 03, 2006
TABLE OF CONTENTS:
  1. · JSP Consumer for a Visual Studio Created Web Service Using Sun Java Studio Creator
  2. · Test the Web Service In-situ
  3. · Creating the JSP Client with Java Studio Creator 2
  4. · Referencing the Web Service in Java Studio Creator 2
  5. · JSP Client Returning Result from the Web Service
  6. · The Completed Java Code

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

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).


blog comments powered by Disqus
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...

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 1 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials