jdk 6.0 にはすでに jax-ws 実装と、組み込み可能な小さなサーバーが付属しているようです。私はすべての部分を理解していませんが、ここから始めます:
mkdir -p helloservice/endpoint/
helloservice/エンドポイント/Hello.java :
package helloservice.endpoint;
import javax.jws.WebService;
@WebService()
public class Hello {
private String message = new String("Hello, ");
public void Hello() {}
public String sayHello(String name) {
return message + name + ".";
}
}
ハローサービス/エンドポイント/Server.java:
package helloservice.endpoint;
import javax.xml.ws.Endpoint;
public class Server {
protected Server() throws Exception {
System.out.println("Starting Server");
Object implementor = new Hello();
String address = "http://localhost:9000/SoapContext/SoapPort";
Endpoint.publish(address, implementor);
}
public static void main(String args[]) throws Exception {
new Server();
System.out.println("Server ready...");
Thread.sleep(5 * 60 * 1000);
System.out.println("Server exiting");
System.exit(0);
}
}
ものを構築します。
mkdir build
javac -d build helloservice/endpoint/*java
$JAVA_HOME/wsgen -d build -s build -classpath . helloservice.endpoint.Hello
以下を実行します。
java -cp build helloservice.endpoint.Server
http://localhost:9000/SoapContext/SoapPortで何かが実行されています。http://localhost:9000/SoapContext/SoapPort?WSDLで wsdl を取得できます。
まだクライアントの作成に取り掛かっていません..