pentaho/pentaho-kettle · error · IllegalArgumentException

Service: + serviceQName + is not defined in the WSDL file…

Error message

Service:  + serviceQName +  is not defined in the WSDL file  + wsdlURI

What it means

IllegalArgumentException from the URI-based Wsdl constructor when the WSDL document loaded fine but does not contain a <service> whose QName equals the requested serviceQName. The parser requires an explicit service match; it never silently falls back.

Solutions

  1. Open the WSDL and copy the exact <service name> and its targetNamespace into the transform settings
  2. Ensure the namespace portion of the QName matches the WSDL targetNamespace character-for-character
  3. Re-import/refresh the transform's WSDL metadata after a server-side WSDL change
  4. Leave serviceQName null (or blank) if you want the first service in the document to be auto-selected

Example fix

// before
QName svc = new QName("http://example.com/wrong-ns", "MyService");
// after
QName svc = new QName("http://example.com/actual/targetNamespace", "MyService"); // copied from WSDL
Defensive patterns

Strategy: validation

Validate before calling

javax.wsdl.Definition d = WSDLFactory.newInstance().newWSDLReader().readWSDL(wsdlUrl);
boolean found = d.getServices().keySet().contains(serviceQName);
if (!found) throw new IllegalArgumentException("Unknown service " + serviceQName + "; available: " + d.getServices().keySet());

Try / catch

try {
  Wsdl wsdl = new Wsdl(uri, user, pass, serviceQName, portName);
} catch (IllegalArgumentException e) {
  logError("Service mismatch: " + e.getMessage() + " — re-import the WSDL metadata");
  throw e;
}

Prevention

When it happens

Trigger: new Wsdl(wsdlURI, username, password, serviceQName, ...) with a serviceQName whose local part or namespace does not match any <wsdl:service name=... targetNamespace=...> in the document.

Common situations: Service renamed on the server after the transform was configured; namespace URI typo (target namespace must match exactly, including trailing slash); copying a transform between services without updating the service QName.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/webservices/wsdl/Wsdl.java:91

  public Wsdl( URI wsdlURI, QName serviceQName, String portName, String username, String password ) throws AuthenticationException {

    this.wsdlURI = wsdlURI;
    try {
      _wsdlDefinition = parse( wsdlURI, username, password );
    } catch ( AuthenticationException ae ) {
      // throw this again since KettleException is catching it
      throw ae;
    } catch ( WSDLException e ) {
      throw new RuntimeException( "Could not load WSDL file: " + e.getMessage(), e );
    } catch ( KettleException e ) {
      throw new RuntimeException( "Could not load WSDL file: " + e.getMessage(), e );
    }
    if ( serviceQName == null ) {
      _service = (Service) _wsdlDefinition.getServices().values().iterator().next();
    } else {
      _service = _wsdlDefinition.getService( serviceQName );
      if ( _service == null ) {
        throw new IllegalArgumentException( "Service: "
          + serviceQName + " is not defined in the WSDL file " + wsdlURI );
      }
    }

    if ( portName == null ) {
      _port = getSoapPort( _service.getPorts().values() );
    } else {
      _port = _service.getPort( portName );
      if ( _port == null ) {
        throw new IllegalArgumentException( "Port: "
          + portName + " is not defined in the service: " + serviceQName );
      } else {
        _port = _service.getPort( portName );
      }
    }

    _wsdlTypes = new WsdlTypes( _wsdlDefinition );
    _operationCache = new HashMap<String, WsdlOperation>();

View on GitHub (pinned to f3058517a1)