Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Non JSP client for Web Service  RSS feed

Sam Gehouse
Ranch Hand
Posts: 281
  • Mark post as helpful
  • send pies
  • 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.
viswa vishveswara
Posts: 2
  • Mark post as helpful
  • send pies
  • 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) {
Ulf Dittmer
Posts: 42972
  • Mark post as helpful
  • send pies
  • 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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!