@Override
  protected void execute(IProgressMonitor monitor)
      throws CoreException, InvocationTargetException, InterruptedException {
    try {
      String type;
      String wsdlLocation;
      ServiceModel sm = new Wsdl4jModel(pathToWSDL);

      serviceName = sm.getServiceName();
      targetNamespace = sm.getTargetNamespace();
      serviceUrl = sm.getServiceUrl();
      String impl = sm.getImplementorClass();
      implementorName =
          impl.substring(0, impl.lastIndexOf('.') + 1) + capitalize(sm.getSoapPortType());

      if (isConsumer) {
        type = "-client";
        wsdlLocation = new File(pathToWSDL).toURI().toString();
      } else {
        type = "-impl";
        implementorName += "Impl";
        wsdlLocation = "";
      }

      if (serviceName == null) {
        throw new Exception(Messages.ERROR_NO_SERVICE_CLASSES);
      }

      WSDLToJava w2j =
          new WSDLToJava(
              new String[] {
                type,
                "-wsdlLocation",
                wsdlLocation,
                "-d",
                srcFolder.getLocation().toOSString(),
                pathToWSDL
              });
      ToolContext context = new ToolContext();
      w2j.run(context);

      newProject.refreshLocal(IResource.DEPTH_INFINITE, monitor);

    } catch (CoreException e) {
      throw e;
    } catch (Exception e) {
      throw new InvocationTargetException(e);
    }
  }