By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,209 Members | 1,706 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,209 IT Pros & Developers. It's quick & easy.

Need help in running the java program(web service client)

P: 3
This is a java program which i need to run facing compilation error
Its consuming a third party web service method
I have the supported files(folder) which contain necessary class files org/apache/axis

The following is what i need to do but am unable to do

set classpath where the below jars are located....

I have the above jars

Run the below command
java org.apache.axis.wsdl.WSDL2Java <URL>.wsdl

1) Setting Classpath:
a) AXISPATH = The path where all the below specifed jars are available.

b) %AXISPATH%axis.jar;%AXISPATH%commons-discovery.jar;%AXISPATH%commons-logging.jar;%AXISPATH%wsdl4j.jar;%AXISPATH%jaxrpc. jar;%AXISPATH%saaj.jar;

Command to Execute[In console]:
c:\user>java org.apache.axis.wsdl.WSDL2Java http://************************************?wsdl

After executing the above command you can find the output java files under c:\user dir

Also not correctly understanding where and how to set classpath while running the program

JAVA Source Code

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;

public class UserRegistration

public static void main(String [] args)

String endpoint = " URL";

Service service = new Service();

String methodName="Test";

Call call = (Call)service.createCall();
call.setTargetEndpointAddress( new );
call.setOperationName(new QName(methodName));
call.setProperty(Call.USERNAME_PROPERTY, "testcheck");

call.setProperty(Call.PASSWORD_PROPERTY, "testcheck");

String req = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><TestObject user=\"Test1\" password=\"Test2\" />";

System.out.println ("Invoked Operation : " + methodName);
System.out.println ("End Point : " + endpoint);
Object ret = call.invoke( new Object[] {req} );
System.out.println (ret);

Jun 9 '09 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.