如何部署基于SOAP的Web服务

时间:2014-11-18 20:01:57

标签: java web-services tomcat soap

我正在尝试托管基于SOAP的Web服务,以便在其他客户端尝试访问它时测试它是如何工作的。发布后,我似乎无法建立与端点的连接。我还没有尝试将此服务部署到tomcat或glass fish服务器,这是实现跨机器通信的唯一方法还是我错过了什么?

任何事情都会有所帮助,谢谢。

编辑:发布端点的代码:

public class WebAppPublisher {
private Endpoint endpoint;

public static void main(String[ ] args) {
    WebAppPublisher self = new WebAppPublisher();
    self.create_endpoint();
    self.configure_endpoint();
    self.publish();
}
private void create_endpoint() {
    endpoint = Endpoint.create(new LionSync());
}
private void configure_endpoint() {
    endpoint.setExecutor(new MyThreadPool());
}
private void publish() {
    int port = 8888;
    String url = "http://localhost:" + port + "/lionSync";
    endpoint.publish(url);
    System.out.println("Server published with url:\n\n\thttp://localhost:"+port+"/lionSync");
    System.out.println("\nTo generate client code run:");
    System.out.println("\twsimport -p <packageName> http://localhsot:"+port+"/lionSync?wsdl -keep");
}

}

线程池:

public class MyThreadPool extends ThreadPoolExecutor {
private static final int pool_size = 10;
private boolean is_paused;
private ReentrantLock pause_lock = new ReentrantLock();
private Condition unpaused = pause_lock.newCondition();

public MyThreadPool(){
   super(pool_size,        // core pool size
         pool_size,        // maximum pool size
         0L,               // keep-alive time for idle thread
         TimeUnit.SECONDS, // time unit for keep-alive setting
         new LinkedBlockingQueue<Runnable>(pool_size)); // work queue 
}

// some overrides
protected void beforeExecute(Thread t, Runnable r) {
   super.beforeExecute(t, r);
   pause_lock.lock();
   try {
      while (is_paused) unpaused.await();
   } 
   catch (InterruptedException e) { t.interrupt(); } 
   finally { pause_lock.unlock(); }
}

public void pause() {
   pause_lock.lock();
   try {
      is_paused = true;
   } 
   finally { pause_lock.unlock(); }
}

public void resume() {
   pause_lock.lock();
   try {
      is_paused = false;
      unpaused.signalAll();
   } 
   finally { pause_lock.unlock(); }
}

}

0 个答案:

没有答案