pentaho/pentaho-kettle · error · KettleStepException

WebServices.ERROR0002.InvalidURI

WebServices.ERROR0002.InvalidURI

Error message

WebServices.ERROR0002.InvalidURI

What it means

Thrown by WebService.requestSOAP() when java.net.URISyntaxException is raised building the request URI from the step's URL. The step wraps it in a KettleStepException with message key WebServices.ERROR0002.InvalidURI including the offending service URL. This means the configured URL string is not a syntactically valid URI (illegal characters, missing scheme, spaces, unencoded braces).

Solutions

  1. Print/inspect the effective URL at run time — check for unresolved ${VARS} or stray whitespace
  2. Percent-encode special characters in the URL (spaces -> %20)
  3. Ensure the URL includes the scheme (http:// or https://)
  4. If using variables, confirm they are defined before the transformation runs

Example fix

// before
// URL in dialog: "http://server/ws op" (space) -> InvalidURI
// after
// URL in dialog: "http://server/ws%20op" or fix the path to avoid the space
Defensive patterns

Strategy: validation

Validate before calling

// validate the URL is a syntactically valid, fully-resolved URI before running
String url = transMeta.environmentSubstitute( meta.getUrl() );
try {
  new java.net.URI( url.trim() );
} catch ( java.net.URISyntaxException use ) {
  throw new IllegalStateException( "WebService URL is not a valid URI: " + url, use );
}

Try / catch

try {
  trans.execute( null );
} catch ( KettleStepException e ) {
  if ( e.getMessage() != null && e.getMessage().contains( "ERROR0002" ) ) {
    logError( "Invalid SOAP URL: " + e.getMessage() + " — check for spaces/unencoded chars/unresolved variables" );
  }
}

Prevention

When it happens

Trigger: requestSOAP() constructs a URI/HttpUriRequest from cachedURLService and URISyntaxException is thrown in the catch clause — e.g., URL containing spaces, unencoded special characters, or an unresolved variable leaving '${HOST}' in the URL.

Common situations: Variable placeholders left unresolved (${SERVICE_URL} not defined), copy-pasted URLs with trailing spaces or smart quotes, query strings with unencoded &, =, or spaces, missing http:// scheme.

Understand the failure class

Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/0a7a08df24297855. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/webservices/WebService.java:405

        throw new KettleStepException( BaseMessages.getString( PKG, "WebServices.ERROR0011.Authentication",
          cachedURLService ) );
      } else if ( responseCode == HttpStatus.SC_NOT_FOUND ) {
        throw new KettleStepException( BaseMessages.getString( PKG,
          "WebServices.ERROR0012.NotFound", cachedURLService ) );
      } else {
        throw new KettleStepException( BaseMessages.getString( PKG,
          "WebServices.ERROR0001.ServerError", Integer.toString( responseCode ),
          Const.NVL( new String( EntityUtils.toString( httpEntity, charSet.toString() ) ), "" ), cachedURLService ) );
      }
      // requestTime += Const.nanoTime() - currentRequestTime;
    } catch ( UnknownHostException e ) {
      throw new KettleStepException( BaseMessages
        .getString( PKG, "WebServices.ERROR0013.UnknownHost", cachedURLService ), e );
    } catch ( IOException e ) {
      throw new KettleStepException( BaseMessages
        .getString( PKG, "WebServices.ERROR0005.IOException", cachedURLService ), e );
    } catch ( URISyntaxException e ) {
      throw new KettleStepException( BaseMessages.getString( PKG, "WebServices.ERROR0002.InvalidURI",
        cachedURLService ), e );
    } finally {
      data.argumentRows.clear(); // ready for the next batch.
      if ( vHttpMethod != null ) {
        vHttpMethod.releaseConnection();
      }
    }
  }

  private void initWsdlEnv() throws KettleException {
    if ( meta.equals( cachedMeta ) ) {
      return;
    }
    cachedMeta = meta;

    try {
      cachedWsdl = new Wsdl( new java.net.URI( data.realUrl ), null, null, environmentSubstitute( meta.getHttpLogin() ),
        Encr.decryptPasswordOptionallyEncrypted( environmentSubstitute( meta.getHttpPassword() ) ) );

View on GitHub (pinned to f3058517a1)