Dear sir,
I just joined the interest group.
I modified Hello examples of the Java WSDP tutorial'examples.And the scripts,environment is not modified.
HelloIF.java source code is as following:
package hello;
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface HelloIF extends Remote {
public String sayHello(String s) throws RemoteException;
public String testData(String s) throws RemoteException;
}
HelloImpl.java is as following:
package hello;
import java.util.*;
import java.util.*;
import java.io.*;
import java.sql.*;
public class HelloImpl implements HelloIF {
public String message = "Hello ";
public String rs = "";
public String sayHello(String s) {
return message + s;
};
public String testData(String s) {
try
{
/*GetNeData gnd = new GetNeData();
rs = gnd.NEDataBuild();
gnd.disConnect();*/
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@192.168.10.168:1521:tmnq3","nmsadmin","nmsadmin");
String sSql_Sdhne = "select sdhne_id ,sdhne_text from v_rs_ilog_sdhne ";
String rs = "";
Statement stmt_Sdhne = conn.createStatement();
ResultSet rset_Sdhne = stmt_Sdhne.executeQuery(sSql_Sdhne);
while (rset_Sdhne.next())
{
rs = rs+" "+rset_Sdhne.getString(1)+" "+rset_Sdhne.getString(2);
}
stmt_Sdhne.close();
conn.close();
return "Reading database"+rs;
} catch(Exception e)
{
return e.toString();
}
};
}
HelloClient.java is as following:
package hello;
import javax.xml.rpc.Stub;
public class HelloClient {
public static void main(String[] args) {
try {
Stub stub = createProxy();
HelloIF hello = (HelloIF)stub;
System.out.println(hello.sayHello("Network Management Center"));
System.out.println(hello.testData("Reading database:"));
} catch (Exception ex) {
ex.printStackTrace();
}
}
private static Stub createProxy() {
// Note: MyHello_Impl is implementation-specific.
return (Stub)(new MyHello_Impl().getHelloIFPort());
}
}
When I run ant build and deploy it, My hello can be deployed as a web service and there are two operation:sayHello and testData.
I continue the below steps:
ant generate-stubs
it is o.k.
ant compile-client
it is o.k.
ant jar-client
it is o.k.
ant run
Buildfile: build.xml
run:
[echo] Running the hello.HelloClient program....
[java] Hello Network Management Center
[java] java.rmi.ServerException: Missing port information
[java] at com.sun.xml.rpc.client.StreamingSender._raiseFault(StreamingS
ender.java:370)
[java] at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.
java:231)
[java] at hello.HelloIF_Stub.testData(HelloIF_Stub.java:62)
[java] at hello.HelloClient.main(Unknown Source)
BUILD SUCCESSFUL
Total time: 5 seconds
What is the problem? How can i fix it?
I hope to get your help.