199
社区成员
发帖
与我相关
我的任务
分享
public class SimpleHttpServer {
public static void main(String[] args) throws IOException {
HttpServer server = HttpServer.create(new InetSocketAddress(8000),0);
server.createContext("/test", new MyHandler());
server.setExecutor(null);
server.start();
}
}
@WebService
@SOAPBinding(style = Style.RPC)
public interface Station {
@WebMethod
public String getTime();
}
@WebService(endpointInterface = "webservice.Station")
public class StationImpl implements Station{
@Override
public String getTime() {
return DateFormat.getInstance().format(new Date());
}
}
public class StationPublisher {
public static void main(String[] args){
Endpoint.publish("http://localhost:8000/test", new StationImpl());
}
}