Skip to Content
0
Jun 27, 2005 at 09:53 AM

WebService problem

27 Views

<u>Scenario</u>

I want to call a web service from a Java Standalone class (not a servlet or portal class).

<u>Step 1</u>

I created a Java Project that includes a class. This class has a method that returns a String.

public class HelloWorld {

public String sayHelloWorld(){

return "Hello World";

}

}

<u>Step 2</u>

I opened the web services perspective in the Netweaver Developper Studio.

I selected the class and right click to create a web service.

The name of the web service is HelloWorldWebService.

I create an EAR file and deployed to the J2EE engine server.

<u>Step 3</u>I created a Standalone Proxy Project for the HelloWorldWebService.

Should I create a Deployable Proxy Project ?

<u>Step 4</u>

In order to call the web service, I created a separated Java Project with a class in it.

I added the proxy created to the Java Build Path of this project.

<u>Step 5</u>

Here is the code of the client.

import com.proxy.helloworld.*;

public class SampleApplication {

public static void main(String[] args) {

try {

HelloWorldWebServiceImpl service = new HelloWorldWebServiceImpl();

HelloWorldWebServiceViDocument port =

(HelloWorldWebServiceViDocument)service.getLogicalPort();

System.out.println(port.sayHelloIsrael());

} catch(Exception e) {

e.printStackTrace();

}

}

}

<u>Problem</u>

I have an error at compilation time.

The project was not built since its classpath is incomplete. Cannot find the class file for javax.xml.rpc.ServiceException. Fix the classpath then try rebuilding this project.

This compilation unit indirectly references the missing type javax.xml.rpc.ServiceException (typically some required class file is referencing a type outside the classpath)

I am missing some jar files (jaxrpc.jar ? and others).

How can I make the call to the web service ?

Thanks in advance for any help.