You need to add
import java.rmi.RemoteException;
before your class declaration
Question
I'm really new to Java and trying to call web-service. I have taken a code from net
String message = "";
static Map output;
public static void main(String args[]) {
try {
String inputparam = "10000";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(""));
call.setOperationName(new QName("http://testPackage.fc.com/, doBasicStuff"));
call.addParameter("Hello", org.apache.axis.Constants.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
call.setReturnType(org.apache.axis.Constants.XSD_STRING);
Object responseWS = call.invoke(new Object[] { inpurparam });
System.out.println("ReceivingResponse: " + (String) responseWS);
output = call.getOutputParams();
String firstName = (String) output.get(new QName("", "firstName"));
} catch (Exception e) {
System.err.println(e.toString());
}
}
which gives a syntax error
The type java.rmi.RemoteException cannot be resolved. It is indirectly referenced from required .class files
on the line
Object responseWS = call.invoke(new Object[] { inpurparam });
So I'm added "import java.rmi.RemoteException;" statement it gives error to the import statement "The import java.rmi.RemoteException cannot be resolved", so please tell how to remove this error
Solution
You need to add
import java.rmi.RemoteException;
before your class declaration
OTHER TIPS
The java.rmi
packages are part of the standard Java SE library, so they should be available to all Java code by default. If your IDE can't find these classes, check your settings, project build path, etc. and make sure they are correct and that the project is set up to use a Java SE runtime as opposed to, for example, Android (which provides some java.*
packages but not java.rmi
).