cancel
Showing results for 
Search instead for 
Did you mean: 

WebService problem

david_fryda2
Participant
0 Kudos
134

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi david,

You need to reference on both side your JAR files.

In your case you need to get the Webservices_lib.jar

which is located on your J2EE engin server.

Add it to java build path in NWDS and also in

<b><javahome>\j2sdk1.4.2_07\jre\lib\ext</b>.

david_fryda2
Participant
0 Kudos

Hi Joseph,

Thanks! It is working.

I could never guess that I must reference my jars two times.

Nice day

Answers (0)