public void doCall(String method, Object value) throws Exception {
    Call call = new Call();
    call.setTargetObjectURI("http://soapinterop.org/");
    call.setMethodName(method);
    call.setEncodingStyleURI(encodingStyleURI);

    Vector params = new Vector();
    params.addElement(new Parameter("in", value.getClass(), value, null));
    call.setParams(params);

    // make the call: note that the action URI is empty because the
    // XML-SOAP rpc router does not need this. This may change in the
    // future.
    Response resp = call.invoke(url, "");

    // Check the response.
    if (resp.generatedFault()) {
      Fault fault = resp.getFault();
      System.out.println("Ouch, the call failed: ");
      System.out.println("  Fault Code   = " + fault.getFaultCode());
      System.out.println("  Fault String = " + fault.getFaultString());
    } else {
      Parameter result = resp.getReturnValue();
      System.out.println("Call succeeded: ");
      System.out.println("Result = " + result.getValue());
    }
  }
  @Override
  public void onMessage(final String message) {
    try {
      AbstractMessage msg = (AbstractMessage) (new XMLBuilder().fromXML(message));
      final int requestID = msg.getId();
      String messageType = msg.getType();
      final String destination = msg.getEndpoint();
      switch (messageType) {
        case "request":
          {
            if (DEBUG) System.out.println("Receiving the request: \n" + message);
            final Request request = (Request) msg;
            executors.submit(
                new Callable<Object>() {

                  @Override
                  public Object call() throws Exception {
                    try {

                      Object result = invokeOperation(request.getOpName(), request.getParams());

                      if (result instanceof OperationAborted) return null;
                      sendResponse(requestID, result, destination);

                    } catch (Exception e) {
                      e.printStackTrace();
                    }

                    return null;
                  }
                });
            break;
          }
        case "response":
          {
            if (DEBUG) System.out.println("Receiving the response: \n" + message);
            Response response = (Response) msg;
            if (response.getReturnType() != null) {
              Class<?> type = (Class<?>) response.getReturnType();
              results.put(response.getRequestID(), type.cast(response.getReturnValue()));
            } else {
              results.put(response.getRequestID(), NullObject);
            }
            synchronized (this) {
              this.notifyAll();
            }
            break;
          }
        default:
          break;
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }