{"record":{"id":"0a7a08df24297855","repo":"pentaho/pentaho-kettle","slug":"webservices-error0002-invaliduri","errorCode":"WebServices.ERROR0002.InvalidURI","errorMessage":"WebServices.ERROR0002.InvalidURI","messagePattern":"WebServices\\.ERROR0002\\.InvalidURI","errorType":"error_code","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/webservices/WebService.java","lineNumber":405,"sourceCode":"        throw new KettleStepException( BaseMessages.getString( PKG, \"WebServices.ERROR0011.Authentication\",\n          cachedURLService ) );\n      } else if ( responseCode == HttpStatus.SC_NOT_FOUND ) {\n        throw new KettleStepException( BaseMessages.getString( PKG,\n          \"WebServices.ERROR0012.NotFound\", cachedURLService ) );\n      } else {\n        throw new KettleStepException( BaseMessages.getString( PKG,\n          \"WebServices.ERROR0001.ServerError\", Integer.toString( responseCode ),\n          Const.NVL( new String( EntityUtils.toString( httpEntity, charSet.toString() ) ), \"\" ), cachedURLService ) );\n      }\n      // requestTime += Const.nanoTime() - currentRequestTime;\n    } catch ( UnknownHostException e ) {\n      throw new KettleStepException( BaseMessages\n        .getString( PKG, \"WebServices.ERROR0013.UnknownHost\", cachedURLService ), e );\n    } catch ( IOException e ) {\n      throw new KettleStepException( BaseMessages\n        .getString( PKG, \"WebServices.ERROR0005.IOException\", cachedURLService ), e );\n    } catch ( URISyntaxException e ) {\n      throw new KettleStepException( BaseMessages.getString( PKG, \"WebServices.ERROR0002.InvalidURI\",\n        cachedURLService ), e );\n    } finally {\n      data.argumentRows.clear(); // ready for the next batch.\n      if ( vHttpMethod != null ) {\n        vHttpMethod.releaseConnection();\n      }\n    }\n  }\n\n  private void initWsdlEnv() throws KettleException {\n    if ( meta.equals( cachedMeta ) ) {\n      return;\n    }\n    cachedMeta = meta;\n\n    try {\n      cachedWsdl = new Wsdl( new java.net.URI( data.realUrl ), null, null, environmentSubstitute( meta.getHttpLogin() ),\n        Encr.decryptPasswordOptionallyEncrypted( environmentSubstitute( meta.getHttpPassword() ) ) );","sourceCodeStart":387,"sourceCodeEnd":423,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/webservices/WebService.java#L387-L423","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Print/inspect the effective URL at run time — check for unresolved ${VARS} or stray whitespace","Percent-encode special characters in the URL (spaces -> %20)","Ensure the URL includes the scheme (http:// or https://)","If using variables, confirm they are defined before the transformation runs"],"exampleFix":"// before\n// URL in dialog: \"http://server/ws op\" (space) -> InvalidURI\n// after\n// URL in dialog: \"http://server/ws%20op\" or fix the path to avoid the space","handlingStrategy":"validation","validationCode":"// validate the URL is a syntactically valid, fully-resolved URI before running\nString url = transMeta.environmentSubstitute( meta.getUrl() );\ntry {\n  new java.net.URI( url.trim() );\n} catch ( java.net.URISyntaxException use ) {\n  throw new IllegalStateException( \"WebService URL is not a valid URI: \" + url, use );\n}","typeGuard":null,"tryCatchPattern":"try {\n  trans.execute( null );\n} catch ( KettleStepException e ) {\n  if ( e.getMessage() != null && e.getMessage().contains( \"ERROR0002\" ) ) {\n    logError( \"Invalid SOAP URL: \" + e.getMessage() + \" — check for spaces/unencoded chars/unresolved variables\" );\n  }\n}","preventionTips":["Run environmentSubstitute on URLs that use variables and assert no '${' remains","Trim whitespace and percent-encode spaces/special characters in URLs","Always include the http:// or https:// scheme","Lint transformation files for URL fields before deployment"],"tags":["uri","url","soap","configuration"],"backgroundTag":"invalid-url-format","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}