Example #1
0
  /**
   * Returns a client stub for the web-service.
   *
   * <p>This method reuses the last stub created by the current thread.
   *
   * @return the client stub.
   */
  public synchronized Object getClient() {
    if (threadLocalPort.get() == null) {
      URL wsdlURL =
          getClass().getClassLoader().getResource(wsTransactionConfiguration.getWsdlLocation());
      Service service = Service.create(wsdlURL, wsTransactionConfiguration.getServiceName());
      Object port = service.getPort(wsTransactionConfiguration.getSei());
      Client client = ClientProxy.getClient(port);
      configureBinding(port);
      configureInterceptors(client);

      threadLocalPort.set(port);
      LOG.debug("Created client adapter for: {}", wsTransactionConfiguration.getServiceName());
    }
    return threadLocalPort.get();
  }