Win a copy of Secure Financial Transactions with Ansible, Terraform, and OpenSCAP this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

Non JSP client for Web Service

Ranch Hand
Posts: 281
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Cany anybody point me to an article, or source code that shows an example of a client created to invoke a web service.

I created a web service using RAD 6.0. It gernerated corresponding wsdl etc. RAD can also create a client project for you that uses a JSP (Test.jsp) to test the service code.

However, I would like to know how I can write clinet code myself, instead of relying on the client code that can be generated by RAD.

I would like to write client code that will be invoked from a non web app. As such, I do not want the client code to be JSP or Servlet based.

Any help with example, or pointing out any article will be helpful.
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sam Gehouse
Other than Web Client (JSP) created by the RAD we can write the normal Standalone java class (main method) or we can write the EJB client

fine the example client below.


import org.apache.axis.client.Service;
import org.apache.axis.client.Call;
import org.apache.axis.encoding.XMLType;
import javax.xml.rpc.ParameterMode;
import javax.xml.namespace.QName;

public class Client {

// Creates new HelloWorldClient
public Client() {

public static void main (String args[]) {
try {
// EndPoint URL for the SparePartPrice web service.
String endpointURL =
// Method Name to invoke for the SparePartPrice web service
String methodName = "getMessage";
// Create the Service call
Service service = new Service();
Call call = (Call) service.createCall();
call.setOperationName(new QName("getMessage",methodName));
call.addParameter("name",XMLType.XSD_STRING, ParameterMode.IN);

Object[] params = new Object[] {"INDIA"};

//Invoke the SparePartPrice web service
String response= (String) call.invoke(params);
//Print out the result
System.out.println("Message is "+response);
catch (Exception e) {
Posts: 43024
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Be aware that this example uses the obsolete JAX-RPC API. You can find a client that uses the SAAJ API (which is still current) here.
catch it before it slithers away! Oh wait, it's a tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
    Bookmark Topic Watch Topic
  • New Topic